Created
October 8, 2024 18:32
-
-
Save sclark39/55d9d6cd5b1dd13087fa310e3c0d0189 to your computer and use it in GitHub Desktop.
Custom Material node to fix improper noise bounding. This will return a normalized 0..1 value out of the noise function in UE5.3.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
float Out = MaterialExpressionNoise( | |
DERIV_BASE_VALUE(Position), // Position | |
Scale, // Scale | |
1.00000000, // Quality | |
0.00000000, // Function | |
bTurbulence, // bTurbulence | |
Levels, // Levels | |
0.00000000, // OutputMin | |
1.00000000, // OutputMax | |
LevelScale, // LevelScale | |
0.00000000, // FilterWidth | |
0.00000000, // bTiling | |
512.00000000); // RepeatSize | |
float MinOut = 0.0; | |
float MaxOut = LevelScale * ( 1.0 - pow(LevelScale, -Levels)) / ( LevelScale - 1.0 ); | |
if ( !bTurbulence) | |
{ | |
MinOut = MaxOut * -1.0f; | |
MinOut = MinOut * 0.5f + 0.5f; | |
MaxOut = MaxOut * 0.5f + 0.5f; | |
} | |
return (Out - MinOut) / (MaxOut - MinOut); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment