Jump to content
  • Advertisement
Sign in to follow this  
tonyoto

Implementing axis lines in a model viewer

This topic is 4088 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, I'd like to implement three colored axis lines that indicate the world orientation in my simple model/scene viewer. Up until now all objects have been part of my scene graph as a hierarchy, but these lines are different. They should always be in the same place on the screen regardless of camera orientation but should of course always be rotated like the camera. Could anyone suggest a way to achieve this? The lines are at the moment implemented as scene nodes and I suppose one solution would be to add the lines as child nodes to the camera, which by the way is also a scene node. This way the lines would always be in view, following the camera. [Camera node] ..[Container node] ....[Blue Z-axis line] ....[Red X-axis line] ....[Green Y-axis line] One downside might be that since they are part of the scene, objects in front of them might cover them. Also they have to be translated every render call. Another option I guess is to render them to a texture which is then rendered onto the view as a quad, more like a gui element. Is there a better, more correct or more efficient way to do this or am I on to something? Thanks.

Share this post


Link to post
Share on other sites
Advertisement
Orientation lines for world-space definitely seem like they should be a GUI element to me. You shouldn't have to render them onto a quad though, just render them last. Clear the depth buffer first so they don't disappear behind objects.

I would use view-space coordinates for the lines, so that you get them to stay at the same location on the screen. The directions of the lines are actually contained directly within the world-to-view matrix, either as the first three columns if you're using column vectors or rows if you're using row vectors. Each line has the same start point, and the end point is just the start point plus each line's respective direction. When you pass the coordinates to the API, make sure it doesn't perform the world-to-view transformation again - just projection.

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!