Jump to content
  • Advertisement
Sign in to follow this  
eXXXile

Terrain: Polygon area definition and drawing

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

Hello people

I have a terrain and I want to be able to show areas over it. Each area will be defined by an array of 2D points that form a polygon. I want somehow this polygon to be projected to the terrain. What are my options? I don't really know if the polygon will be textured of filled with some pattern (the 2nd option though would be preferable). I saw something about texture splatting but this should be restricted only in the area of the polygon and I don't know how to do it.

Any hint would be much appreciated.

Share this post


Link to post
Share on other sites
Advertisement

Hello people

I have a terrain and I want to be able to show areas over it. Each area will be defined by an array of 2D points that form a polygon. I want somehow this polygon to be projected to the terrain. What are my options? I don't really know if the polygon will be textured of filled with some pattern (the 2nd option though would be preferable). I saw something about texture splatting but this should be restricted only in the area of the polygon and I don't know how to do it.

Any hint would be much appreciated.
You may want to look into Projective Texturing. Alternatively, you can probably set each of the vertices of your polygon to the "ground height" of your terrain (I am assuming that you're using a heightmap for your terrain) and then simply draw your polygon with Z-testing (D3DRS_ZENABLE) disabled.

Share this post


Link to post
Share on other sites
Thanx for taking time to help me

The terrain is created by some special GIS file (u may consider it a kind of height map), and I have made utility that returns height at specific x,z position using interpolation and stuff.
The z-test-disable approach result is not satisfactory, especially when someone rotates the terrain around to inspect it. It looks like a sheet thrown over the mountains. I suppose that it would look better if I had a way to convert the polygon to a large number of triangles so it would fit more correctly over the terrain morphology. Has direct3d a way to do it or do I have to do it myself?

Now, about Projective Texturing... I may have to deal with machines that don't have very advanced graphics abilities, so I'm hesitant to use shaders. Is it necessary to use shaders for this technique, and If no, are there any samples that do PT with fixed function pipeline? And I suppose u suggest that I create dynamically a texture with the shape of the polygon area I want to show on terrain and somehow project it from above?

I tried to follow the mathematical approach (ie to find where the polygon intersects with the terrain grid and make the area to be a separate mesh but I have very hard time to find the indices of the triangles)
Another solution I thought (but don't know how to implement it) is, to create a copy of the terrain and somehow scissor-out the portion that does not intersect with the desired polygon area. Is there any technique to mask somehow a mesh u are drawing?

I really appreciate your time and effort to help 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!