# Finding domain/range of a specific shader node input/output, inside the Blender UI?

Is there anywhere within the Blender UI that displays the dimensionality & bounding sets (e.g., all floats, floats in [0,1], floats in [0,255], etc) of arbitrary shader node inputs & outputs?

I consistently find myself digging through stackexchange/the Blender docs/experimenting with less-than-equal-to to try to figure out what I need to divide by to normalize shader nodes' input/output values to within a specific range, or to center them at 0, etc. This seems like functionality that Blender's very rich UI might already have built into it, though, so I am wondering if I am just overlooking it somewhere.

As an example, I can do something like this, varying the threshold between 0, 0.5, and 1, and observing that in rendered view my sphere switches from all black to mixed black/white to all white, to convince myself that Blender's (Perlin) Noise Texture's Fac output naturally outputs floats in [0,1]:

But it seems odd that I should have to experiment, or search through docs or stackexchanges, to discover something like this. Is this information maybe already neatly displayed somewhere inside the Blender UI, and I just don't know where to look?

You can access this information for every IntProperty and FloatProperty through Python. It requires the access of RNA properties. The approach is the same for UI sliders as it is for node sockets, but as an easier introduction the first example uses a property of Eevee's render settings.

Example 1 - Regular UI Property

Let's start with finding the limits of Eevee's bloom threshold. The value that is currently set can be accessed through:

bpy.context.scene.eevee.bloom_threshold


This will only give us the current float value. If we want to get the property, we have to access the RNA. The following code gets the underlying FloatProperty.

bpy.context.scene.eevee.bl_rna.properties["bloom_threshold"]


There are four limits to the property soft_min, soft_max, hard_min and hard_max. The soft limits are used for the minimum and maximum value that can be reached through the slider, while the hard limits are the actual maximum and minimum values that can be entered manually.*

* This doesn't seem to apply to the nodes though, they allow to enter float values higher than the hard limits.

bloom_threshold = bpy.context.scene.eevee.bl_rna.properties["bloom_threshold"]
print(f"soft_min: {bloom_threshold.soft_min}")
print(f"soft_max: {bloom_threshold.soft_max}")
print(f"hard_min: {bloom_threshold.hard_min}")
print(f"hard_max: {bloom_threshold.hard_max}")


For the bloom threshold the values are:

soft_min:      0.0
soft_max:     10.0
hard_min:      0.0
hard_max: 100000.0


Example 2 - Node Socket

The following example assumes that the material with the node exists. Normally you would need to check for the existence of the keys first.

Assume that you have a material called Material which contains a node Noise Texture for which you would like to know the limits of the input Scale and the output Fac.

First the node has to be accessed (assuming that all these elements exist):

noise_texture = bpy.data.materials["Material"].node_tree.nodes["Noise Texture"]


For the limits of the Scale input we need to access the Property that is behind default_value of the socket that we're interested in. Scale is an input socket.

scale_property = noise_texture.inputs["Scale"].bl_rna.properties["default_value"]
print(f"soft_min: {scale_property.soft_min}")
print(f"soft_max: {scale_property.soft_max}")
print(f"hard_min: {scale_property.hard_min}")
print(f"hard_max: {scale_property.hard_max}")


The limits are:

soft_min: -10000.0
soft_max:  10000.0
hard_min:     -3.4028234663852886e+38
hard_max:      3.4028234663852886e+38


The same approach can be used to find the limits of an output socket, like Fac.

fac_property = noise_texture.outputs["Fac"].bl_rna.properties["default_value"]
print(f"soft_min: {fac_property.soft_min}")
print(f"soft_max: {fac_property.soft_max}")
print(f"hard_min: {fac_property.hard_min}")
print(f"hard_max: {fac_property.hard_max}")


The limits for this socket are:

soft_min: 0.0
soft_max: 1.0
hard_min: 0.0
hard_max: 1.0


There may be cases where the limits change dynamically, which isn't covered by this answer. It looks like a similar approach could possibly work for Vector sockets, where the limits likely apply for each dimension.

• Interesting -- thanks. I was hoping this was already displayed somewhere in the graphical UI (without the need to use the Python API), but if that's not the case, this will certainly be less painful than my current approach! Maybe it will also motivate me to write a simple little add-on for my own personal use that displays these values in a convenient place or some such. Marking as accepted (unless/until someone comes along and says there's somewhere in the graphical UI that the same can be found :) ) – NeverConvex Oct 16 '19 at 23:56