Jump to content
  • Advertisement
Sign in to follow this  
d3dnewb

Projecting 2d vector roads onto 3d terrain at surface height?

This topic is 4874 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 wonder if anyone can help me out here Basically I have height data that is at a certain level of detail plotted to a 3d terrain map. (lots of triangles). I then want to add roads which are at a greater level of detail to this map. The roads would have verticies at x,y locations not on the height data. They are 2d vectors so the PrimitiveType.Linestrip would suit them perfectly. I think it would be very difficult to go through and culculate heights for the road line points from the height data. Is there any way to project it onto the 3d at all? THanks!

Share this post


Link to post
Share on other sites
Advertisement
Quote:
I think it would be very difficult to go through and culculate heights for the road line points from the height data. Is there any way to project it onto the 3d at all?
If I understand you correctly, this sounds like a variation of the 'how do I find the height at a specific xy point on my terrain' question that comes up occasionally. Search for 'bilinear interpolation' or 'barycentric coordinates'. If you have a ray-triangle intersection test, you could also just project a ray straight up or down at a given xy, and find out what triangle it intersects and where the intersection point is.

Share this post


Link to post
Share on other sites
Thanks for the pointers, will look into it. I'm using direct3d mobile so the app will work on WM2005 when its available. I've never heard of the ray triangle intercept thing before. You got the right idea - but ist not as if I want to go coding this stuff, i hope there is a function of some sought in directx that would do it for me.

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!