Page MenuHome

Shading: Add Map Range node to Cycles and EEVEE.
ClosedPublic

Authored by Omar Ahmad (OmarSquircleArt) on Tue, Aug 13, 2:45 PM.

Details

Summary

This patch adds a new Map Range node that linearly remaps an input
value from a range to another. This node is similar to the compositor's
Map Range node.

Diff Detail

Repository
rB Blender

Event Timeline

Seems to work fine, I cannot see any mistakes.

This revision is now accepted and ready to land.Tue, Aug 13, 3:18 PM
Brecht Van Lommel (brecht) requested changes to this revision.Tue, Aug 13, 3:28 PM

Looks great, just one minor comment.

intern/cycles/render/nodes.cpp
5268–5272

These socket names should be from_min, from_max, ... the convention is to use snake case instead of camel case here.

This revision now requires changes to proceed.Tue, Aug 13, 3:28 PM
  • Use standard naming convention.
Brecht Van Lommel (brecht) accepted this revision.

This can go into master.

From a suggestion by @LazyDodo (LazyDodo), I think it would be important to add a Clamp option for this node.

It doesn't have to be done as part of this patch, but would be good to add after since it's probably what you want at least half the time.

This revision is now accepted and ready to land.Tue, Aug 13, 4:15 PM

This can go into master.
From a suggestion by @LazyDodo (LazyDodo), I think it would be important to add a Clamp option for this node.
It doesn't have to be done as part of this patch, but would be good to add after since it's probably what you want at least half the time.

To clamp the output to the [0, 1] range? We have a dedicated Clamp node for this, will add a patch for it next.

I guess to clamp to To Min and To Max. I agree, it makes sense to have this option in this node (at least it makes much more sense than in the math node).

I guess to clamp to To Min and To Max. I agree, it makes sense to have this option in this node (at least it makes much more sense than in the math node).

Ah ok. Will do.