Jump to content
  • Advertisement
Sign in to follow this  
Meshboy

Managed Mesh behind Sprite problem

This topic is 4239 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi! im pretty new to this MDX stuff, but i have completed rendering a 3DS model and it is working correct, i have also created a sprite by using the Direct3D.Sprite,texture and also a rectangle that set the size. My problem is that the sprite is being drawn ontop of the mesh even though i am rendering the model after drawing my sprite. is there something im not thinking of? set z-buffer layers or something, i want to create a background sprite that is behind my rendered mesh model. help please... here is some code... device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, Color.Black, 1.0f, 0); //setup Cameras SetupCamera(); device.BeginScene(); //Sprite begin sprite.Begin(SpriteFlags.AlphaBlend); sprite.Draw(spriteTexture, new Rectangle(0, 0, 320, 480), new Vector3(0,0,0),new Vector3(0,0,0), Color.White); sprite.End(); DrawMesh(angle / (float)Math.PI, angle / (float)Math.PI * 0.001f, 0 / (float)Math.PI / 4.0f, 0.0f, 0.0f, 0.0f); device.EndScene(); device.Present(); this.Invalidate();

Share this post


Link to post
Share on other sites
Advertisement
Have you tried changing the Z coordinate? I remember something about getting 2D elements to render behind 3D ones by setting the Z value to around 1.0. If that doesn't work you can try making the sprite render in object space using the SpriteFlags.ObjectSpace flag.

Edit: I know the effect you're looking for is possible using a vertex buffer, so even if this doesn't work, you're not stuck.

Share this post


Link to post
Share on other sites
thanks, im gona try with the Z-buffer thing, but i really want to use the object objectSpace flag, beacuse i plan to pivit some sprites to get a terrain from it...

if anyone have dont this, i would be thankful for some code...

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!