• Create Account

# Finding the Slope of a giving Vertex in HLSL

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

3 replies to this topic

### #1James Proctor  Members   -  Reputation: 119

Like
0Likes
Like

Posted 11 September 2012 - 08:29 AM

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!

### #2Nik02  Crossbones+   -  Reputation: 3866

Like
0Likes
Like

Posted 11 September 2012 - 09:19 AM

A single vertex has no slope, if you think about it.

Niko Suni

### #3Catmull Dog  Members   -  Reputation: 136

Like
0Likes
Like

Posted 11 September 2012 - 09:54 AM

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.

### #4kauna  Crossbones+   -  Reputation: 2918

Like
0Likes
Like

Posted 11 September 2012 - 12:57 PM

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!

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

PARTNERS