- Home /
simple shader for your spatial mesh which renders different colors based on the distance from the camera and the interpolated normal vector per pixel to differentiate floors and obstacles.
we need to write a simple shader for your spatial mesh which renders different colors based on the distance from the camera and the interpolated normal vector per pixel. This will allow us to color (we need blue) that are floor-like (e.g. by rendering all triangles/pixels of the spatial mesh which are some configurable distance away from your camera, and potentially also which have normals that are mostly in the up direction). Triangles/Pixels which are further away or closer to the camera, or for which the normal is not predominantly in the z-axis, should be colored something else (in our case we need a gray color). we have configured our orthographic camera to only render a specific layer and configured our spatial mesh to be the only object in this layer. Then our render texture should be blue where the spatial mesh is the most likely floor, gray where the spatial mesh is most likely obstacles, and a different color (we need white) as the default color / clear color anywhere that is not rendered.
Your answer
Follow this Question
Related Questions
Raycast on mesh deformed by shader 0 Answers
Need help with using world position in shader 1 Answer
how can i catch the sky box and do a reflection in object 0 Answers
Unity shader vertex displace doesn't work 0 Answers
Using compute shader, how to take every vertex of a mesh and make a cube spawn and move to each one? 0 Answers