- Home /
Using Shader Graph to Create RGB Gradient for Terrain on a Sphere
Hi everyone,
So, I've begun researching this and unfortunately I don't know what I don't know.
Heres the idea:
- I have a non-perfect spherical object that has some terrain. Craters, ridges, depressions, etc...
- I would like to create an RGB gradient digital terrain map of that sphere, where different elevations have a different color.
I believe this will involve vertex shading? In my head the idea is to calculate the distance between the center of the object, and a given vertex then apply the appropriate color to that vertex based on the distance.
Trying to accomplish this in Shader Graph has been a bit, over-whelming as I've stumbled upon tri-planar mapping, geometric shaders, vertex shaders, etc...
Would someone please point me in the right direction? Thanks!
*Worth mentioning that I'm using the URP.
**I've attached a photo of the basic idea that I'd like to accomplish, however the coloring in the photo is wrong as it looks like its probably shading along a global y axis, or using the bottom of the object as the origin rather than the center.
Answer by BastianUrbach · Jan 30, 2021 at 06:38 PM
I don't really know what you don't know either. It seems like you have a good idea of the math behind it so all you need to do is translate that to a graph. I'm guessing the center is the origin of the object so you can just take the length of the position vector as height (otherwise you'd just feed in the center point and calculate the distance).
Your answer
Follow this Question
Related Questions
Vertex Displacement Shader Problems 1 Answer
How to calculate light from behind a quad? (and other light positions) 1 Answer
Shader : issue with vertex positions when multiple models are on the scene 1 Answer
Track patch ID's in Tessellation rendering pipeline 0 Answers
How does appdata_base work? 0 Answers