Jump to content
  • Advertisement
Sign in to follow this  
nickwinters

Disabling Lighting on certain things, and switching view in the middle of the render

This topic is 4863 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

I'm currently writing up my HUD system. The question is how to render it. One option is to put it on the near Z plane, but that would take a bit of math. My other idea would be to switch from perspective to ortho once I'm done rendering the scene and ready to render my hud. Is this possible? I also want to turn off lighting on them, and it just display the rectangles and textures. Is it possible to turn off lighting on them? Thanks. -Nick

Share this post


Link to post
Share on other sites
Advertisement
People sometimes think about this in ways that are too complicated... but to me Direct3D just draws stuff, your HUD is just what gets drawn last. You can use screen transformed vertices or an ortho projection, it's your choice. Just disable lighting, disable your Z test, and keep rendering. It's definitely ok to change states, render, change states, etc... in fact it's essential!

If you want to use screen transformed coordinates, I recommend you set up a "virtual resolution" so that your controls/text/etc appear the same physical size regardless of the actual resolution. Scaling all your vertices to the "virtual resolution" would be the very last step before you render your quads.

Share this post


Link to post
Share on other sites
MasterWorks is right, I just want to add a little more because implementing screen space coords for the first time can sometimes be confusing.

You're probaly going to want to use transformed coordinates, which are positions in screen space. If you are using a vertex buffer to hold a triangle list of all the quad's, then you will need to specify D3DFVF_XYZRHW as your flexible vertex format flag. That specifies your positions will use screen space coordinates. RHW stands for recipical of homogenous w or 1/w. This says that all the x,y,z coordinates have already gone through the divide by w(projection).

You can leave your z test on if you want to have some windows be overlapped or you can simply sort them back to front and render with z-test off. But regardless of the z value you put in no perspective will be used because you are specifying the x,y in screen space coordinates. Like MasterWorks already suggested, you should probaly create your hud system using percentages instead of hardcoded values so you can switch resolutions without a hitch.

[Edited by - ph33r on July 25, 2005 1:51:06 AM]

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!