• Advertisement
Sign in to follow this  

Finding the Slope of a giving Vertex in HLSL

This topic is 1988 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 am working on developing a Game Engine. A big part of the Engine will be Procedural Content. Well the first Procedural thing I am working on are Planets based on ROAM. I've got the planets being generated and the terrain is created using the code for the Complex Planet example for Libnoise. I am now trying to set up texturing in a HLSL vertex and Pixel Shader. I'm able to texture it based on Height but I now want to texture the slopes a different texture. How can I go about getting the slope of the vertex? Thanks!

Share this post


Link to post
Share on other sites
Advertisement
The slope is the difference between two adjacent vertices. You probably want the point normal though, or the weighted, normalized average of all adjacent edges at a given vertex.

Share this post


Link to post
Share on other sites
Is there a particual reason to use ROAM? I mean, it was good lod-technique 10 years ago, but nowadays may be too CPU intensive or may not map well to the graphics accelerator architecture.

you may calculate the vertex normal by looking at the neighbouring height values. From the normal you may calculate the slope.

Cheers!

Share this post


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

  • Advertisement