New to blender, coming from engineering discipline and want to learn more about rendering CFD/model results in Blender.

Right now I'm struggling with generating a coloramp for a 3d surface. What I've done is made a random 3d surface to test with, and developed a shading node setup to achieve a coloramp based on the geometry of each vertex. My current shading node setup and render looks like this:

current render

Right now it looks fine and what I think it's doing is scaling the min/max z-values of the geometry to cover the entire coloramp.

What I would like to do is clip the colorramp. For example, to have a min value of -5 and a max value of 5. Anything below -5 will be red, anything above 5 green, anything in between interpolated.

I want to achieve this so I can have a constant coloramp/values between frames if my z-values change.

How can I go about doing this?

  • $\begingroup$ "Right now it looks fine and what I think it's doing is scaling the min/max z-values of the geometry to cover the entire coloramp." That is what the Generated Coordinates do, for absolute positioning in local coordinates use Object, then adjust with Math Node operations. You can also use Vector Mapping to absolute Worldspace coordinates if you have scaled objects $\endgroup$ – Duarte Farrajota Ramos Apr 17 '20 at 17:36
  • $\begingroup$ Not sure I understand how this helps me. Are you saying I can clip the coloramp by using the local coordinates then math nodes to clip the values ? And how could I replace z values with another array of values? $\endgroup$ – Derek Eden Apr 17 '20 at 17:42
  • $\begingroup$ More detail pertaining to the OP would be appreciated $\endgroup$ – Derek Eden Apr 17 '20 at 17:43

I'm not sure I follow your second (sub)question, but as far as the first question is concerned:

Node setup

node setup

The important node I think is the Map Range node, which will take the Z-component of the geometry as input (set your desired clamp ranges here) and maps them to [0, 1], which the ColorRamp node requires.



In this animation, I am changing From Max in the Map Range node. As you can see, all values above From Max get clipped to the upper limit of the ColorRamp.

Hope this helps.

  • $\begingroup$ this absolutely helps and solved my issue..I thank you very much!!! $\endgroup$ – Derek Eden Apr 17 '20 at 19:27
  • $\begingroup$ my second subquestion (sorry if unclear) is: say I have a mesh with n points..there will be n z-values associated with the points that I can use for a color ramp such as in your solution...now, say I have a list of n values that I want to use instead of the z values for the color ramp, how can I basically replace the geometry -> separate xyz nodes (which basically strips out the z values of the points) with a list of predefined values, maybe they represent temperature, salinity, speed, etc... $\endgroup$ – Derek Eden Apr 17 '20 at 19:29
  • $\begingroup$ @DerekEden I now understand your second goal clearly. My (perhaps bad) guess is that the most straightforward answer will require some python scripting; at the least, an approach quite different than my answer above. Thus, you may want to consider posting your second goal as a separate question. Edit: Also, my pleasure! These are neat questions! $\endgroup$ – Jeremy Hilgar Apr 17 '20 at 20:30
  • $\begingroup$ thanks, expect a few more over the next couple days related in some manner to this one :) much appreciated $\endgroup$ – Derek Eden Apr 17 '20 at 20:44
  • $\begingroup$ if you are able to help... blender.stackexchange.com/questions/174943/… $\endgroup$ – Derek Eden Apr 18 '20 at 1:48

Following @Duarte advice for absolute positioning, combining 'Object Info' and 'Texture Coordinates', I hope I got it right :)

Don't forget to 'Apply Scale' after scaling your object. Also, check out the 'Max Value' and 'Min Value' nodes feeding the 'Map Range' in order to clamp to the desired Z locations.

enter image description here enter image description here

  • $\begingroup$ this looks promising as well, I will try this - between the two solutions I'll combine them where necessary $\endgroup$ – Derek Eden Apr 17 '20 at 20:41
  • $\begingroup$ thank you!!!!!! $\endgroup$ – Derek Eden Apr 17 '20 at 20:42

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.