Hello,
I’ve got billboard sprites in my game. Given the nature of billboard sprites (2d textures translated into world space), their rotation is contained to the camera’s view. This is perfect for some effects, but I’m trying to understand the techniques used for constraining billboard rotation based on a value. I could use this create older style effects where I render two billboard sprites perpendicular to one another, like so:
I’ve searched this topic extensively, but most results are individuals looking for the effect I’ve already achieved. These are my potential thoughts on how to solve this, but I’m by no means an expert:
-Use blender to create a textured plane, then I can easily render the plane twice and rotate one on the Y-axis.
-Solve this using my existing billboard rendering method, based upon this: https://blogs.msdn.microsoft.com/shawnhar/2011/01/12/spritebatch-billboards-in-a-3d-world/
To save you all time, this is the extent of my existing code. I’m not using a shader to render billboards because despite my attempts, I’m struggling to find good shaders that factor in world space, most “hello world” examples aren’t concerned with presenting more than sprites on a screen.
As always, thanks to anyone who assists. I’ve been working on this for days with not much luck. As per my usual logic, if it’s this hard, I’m probably doing it wrong.
foreach (Sprite sprite in sprites)
{
Vector3 textPosition = new Vector3(0, 45, 0);
BasicEffect.World = Matrix.CreateScale(1, -1, 1) * Matrix.CreateTranslation(sprite.Position);
BasicEffect.View = camera.View;
BasicEffect.Projection = camera.Projection;
SpriteBatch.Begin(0, null, SamplerState.PointWrap, DepthStencilState.DepthRead, RasterizerState.CullNone, BasicEffect);
SpriteBatch.Draw(sprite.Texture, Vector2.Zero, Color.White);
SpriteBatch.End();
}