mx_splitlr
A convenient utility node that creates a vertical left/right split view on a model's surface, making it easy to compare two effects or stitch two materials together.
Core Advantages
It encapsulates the common left/right split logic into a single node, dramatically simplifying A/B testing and debugging within shaders without needing to manually combine `step` and `mix` nodes.
Common Uses
A/B testing effects: Connect before-and-after nodes to visually compare their differences.
Creating stitched materials: Apply two different materials or patterns to the left and right sides of a model.
Educational demos: Show original data and its processed result side-by-side, such as UV distortion.
How to adjust
Primarily adjusted by controlling the `center` parameter. Animating the `center` value from 0 to 1 creates a 'wipe' or 'reveal' transition effect. Connecting it to a time-varying node (like `sin(time)`) can create a dynamic effect where the split line animates back and forth.
Code Examples
1// Define the colors for the left and right sides
2const leftSideColor = color( '#ff0000' );
3const rightSideColor = color( '#00ff00' );
4
5// Define the split position (0.5 is the center)
6const splitPoint = uniform( 0.5 );
7
8// Shows left color if UV.x < splitPoint, otherwise shows right color
9const finalColor = mx_splitlr( leftSideColor, rightSideColor, splitPoint );