2
$\begingroup$

very new to blender and not an expert. Coming from engineering field and want to learn more about rendering CFD/model results in Blender.

Right now I am struggling with adding a coloramp to a surface. I want the color to be based on the x/y/z values of the node coordinates. For example if I want to plot a water surface, I want it to be colored by z-value.

What I've done so far is:

  1. Created a plane mesh
  2. Added displacement modifier to the mesh to give it some bumpiness (z-values)
  3. In the shading editor, I added a Texture Coordinates node -> mapping node -> separate xyz node -> coloramp node -> principle bdsf node -> material output node

My node shading node set up is below.

Right now, when I use separate xyz node to color by x it works fine, and also by y. But if I choose z I get no coloring even though there is definitely z values?

using x using y using z

Can anyone explain to me why this isn't working and how to get it working by coloring the surface using a colormap based on z values of the nodes?

Thanks

$\endgroup$
0
$\begingroup$

I think that you have just to remap your values, it should work that way. So on the Z axis displacement is not maybe enough to be visualized properly. I would suggest you to try something like this (if you want to keep the actual colors) or to just move the sliders of your color ramp indices towards the center (narrow their distance).

enter image description here

| improve this answer | |
$\endgroup$
  • $\begingroup$ actually it seems to work fine when I don't use the displacement modifier to give it the z-values...in fact your method actually didnt work for me? I do not know why...but I just made a plane and manually dragged some points up and down and the colormapping works well $\endgroup$ – Derek Eden Apr 17 at 16:28
  • $\begingroup$ are you able to explain how I could set the min/max values of the colorramp? assuming my colorramp is 1,1,1 to 0,0,0 (white to black)...I want to say all z-values <-10 should be white, all >10 should be black, then all values in between are linear interpolation. I'm trying to have a consistent colormap min/max values between frames if the z-values change $\endgroup$ – Derek Eden Apr 17 at 16:29
0
$\begingroup$

You should use the "Object" output from the texture coordinate node when working with a displacement modifier. The "Generated" remaps the value between 0 and 1 but doesn't seem to take into account the modifier.

Use a "Map Range" node to remap depending on your actual geometry. enter image description here

Example with this modifier :

enter image description here

The Z values with vary between -0.5 and 0.5, so you should remap the input between these values.

enter image description here

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.