Saturday 15 February 2014

c# - XNA Texture2D Billboarding appears as a white block -


very strange problem when I try to go and draw your billboard Sprite it always appears as a white block It still pulls it as white, it does not matter whether I use JPEG or transparent PNG.

[edit]

So now instead of the original effect to get an X and Y screen coordinate instead of a viewport the scaling problem will be fixed, but the image is exactly the same place on the screen (this situation by not changing the camera) and how base away from does not get any bigger or smaller

My new billboard rendering function:

  public That void Draw (camera, Grafiksdiwais device, Spraitbac Spreetbac, textures 2D textures) {viewport Wupport = new Viewport (new Rectangle (0, 0, 800, 480)); Vector 3 ViewSpaceTechPashPoint = Viewport Project (this. Low, camera. Projection, camera. Scene, camera world); SpriteBatch.Begin (); SpritebatchkDraw (texture, new vector 2 (view Spestakspakshn.aks, view Spestakshposn. Y), clear, color. White, 0, new vector 2 (texture. Bakskkendra.aks texture. Bouncing. Center. Y) it. Scale, Sprite effects. one Drishyspes reader. spriteBatch.End (); Device.RasterizerState = RasterizerState.CullCounterClockwise; device. Blendstet = Blendstet. Opakyu; Device.DepthStencilState = DepthStencilState.Default;}   

Is my viewport wrong or do I know about it Need to use the spritebatch.Draw () in different ways?

I think it should do the trick using viewport project ... take two projection points and gain distance calculated value affects you deeply ... so if it's deep value small

  Public Zero Draw (Camera Camera, Graphics Device Device, SpriteBatch SpreadBatch, Navt 2D texture) {Vector3 pos1 = device.Viewport.Project (this is the case, the camera. Launch, camera See, camera. world); Vector3 pos2 = device.Viewport.Project (this.position + Vactor3.UnitY * 10, camera. Projection, camera .view, camera world); Vector 2 position = new vector 2 (pause 1.x, pOS 1.w); Vector 2 origin = new vector 2 (texture center, center x, texture bounds center. Y); Float scale = vector 3. Distance (pause 1, pause 2) * customary; SpriteBatch.Begin (); Spritebatch.Draw (Texture, Position, Zero, Color White, 0, Basic, Scale, Sprite Effects., 0); SpriteBatch.End (); Device.RasterizerState = RasterizerState.CullCounterClockwise; Device. Blendstate = Blendstate. Opaque; Device.DepthStencilState = DepthStencilState.Default; }   

On the other hand ... your previous code is being removed from a source that drinks from this article created by the person behind Xenas who thinks basisf fect 3d How to use billboards in Spritebatch ...

I hope this helps you

No comments:

Post a Comment