Also I am attempting to implement some simple coloring by "slope" onto my planet and to do this I take the normal mapped normal "y" component and subtract it from one. Yet I am getting some strange effects, using a small grid for example:
to get this image I had to use the following code:
float slope = 1.0 - normal.y;
if(slope < 0.89){
color = vec3(0.545,0.353,0.169);
}else{
color = vec3(0.237,0.457,0.137);
}
Which doesn't make much sense to me. Also, as you can see, only one side of the terrain is being colored in this way. Shouldn't lower values for slope being more level? Thanks for the help
EDIT: Here is the terrain colored according to the pixels normal:
normal.z
? \$\endgroup\$(normal.x,normal.y)
). Its magnitude is between[0,1]
, so you can use it to color code the terrain from.. let's say.. blue to red (temperature map) to highlight steep vs flat regions. Is this what you want? \$\endgroup\$