modelRadius
A float value representing the bounding sphere radius of the currently rendered object. It provides a convenient way to access the object's overall size within the shader to create size-dependent visual effects.
Core Advantages
It offers a standardized interface for accessing object size, eliminating the need for manual uniforms. The value is pre-calculated on the CPU, avoiding GPU performance overhead, and greatly simplifying the logic for implementing size-aware effects like procedural textures, outlines, and glows.
Common Uses
Size-aware procedural textures: Used as a scaling factor to adjust texture density for objects of different sizes.
NPR outlines: Acts as a base scale to achieve visually consistent outline widths.
Size-dependent glow/emission: Serves as an intensity controller to link the effect's strength to the object's size.
How to adjust
This node is read-only and has no adjustable parameters. The key to adjusting its effect is in how you *use* the radius value. For example, you can use its inverse to control effect strength, like `const effectStrength = float( 10 ).div( modelRadius )`. This creates an effect inversely proportional to the object's size: smaller objects (small radius) get a stronger effect, while larger objects (large radius) get a weaker one, which is useful for effects that imply 'energy density'.
Code Examples
1
2// Use modelRadius to scale procedural textures
3// Prevents textures from being too dense on small objects or stretched on large ones
4const scaledUV = uv().mul( modelRadius );
5const pattern = noise( scaledUV );
6