UV Mapping SDF in Fuse

Hello

Is there a way to apply UV Mapping to SDF’s in Fuse? I would like to project this a grid only from one side to this SDF - ideally to show the contours of some sort of terrain… i got stuck with the Triplanar node… how else could i do that?

Thank you very much!

the raymarcher is a pixel shader, that draws the sphere when the sdf function for that pixel is close to 0. you can for example create a function that “colours the space”.

build a float4 function that takes values from “worldspace” for control values, and input it as the “diffuse color” on your pbr material before raymarching. xyzw or rgba - it does not matter on gpu.

you take the y value of the world space to control R of the color. worldspace is (let’s say) -1,-1,-1 to 1,1,1. the lower part of the cube is black, because die graphics card can just display colors, so values from 0 to 1.

take that times 10- you get 0,0,0 to 10,10,10. those are all float, so they go from 0.001 - 0.500 - 1.720101 and so on up to 10. take the fractal part of that, and we end up with numbers going from 0.000 to 0.999 - 10 times in a row. now we have multiple gradients.

use a step to turn the gradient into either 0 or 1, use the fuse hlstorgb to generate your color.
As mentioned, this example colors the whole world space, so I use four different raymarcher. you can use sdf functions to set colors too!


3dcolor.vl (43.5 KB)

4 Likes

thank you so much for that! very cool! that’s helpful! thanks!