[Caustic] Add intensity property.

This commit is contained in:
Tanasart 2024-12-20 10:36:55 +07:00
parent c60d6de266
commit 800c6bbf9a
2 changed files with 8 additions and 3 deletions

View file

@ -19,8 +19,12 @@ function Node_Caustic(_x, _y, _group = noone) : Node_Shader_Generator(_x, _y, _g
.setDisplay(VALUE_DISPLAY.slider, { range: [ 0, 2, 0.01 ] });
addShaderProp(SHADER_UNIFORM.float, "detail");
newInput(6, nodeValue_Float("Intensity", self, 1))
.setDisplay(VALUE_DISPLAY.slider, { range: [ 0, 4, 0.01 ] });
addShaderProp(SHADER_UNIFORM.float, "intensity");
input_display_list = [
["Output", true], 0,
["Noise", false], 1, 2, 4, 5,
["Noise", false], 1, 2, 6, 4, 5,
];
}

View file

@ -6,6 +6,7 @@ varying vec4 v_vColour;
uniform float seed;
uniform float progress;
uniform float detail;
uniform float intensity;
uniform vec2 dimension;
uniform vec2 position;
@ -95,6 +96,6 @@ void main() {
n = snoise( pos );
// noise [-1..+1] -> color
float intensity = exp(n.w * 3. - 1.5);
gl_FragColor = vec4(vec3(intensity), 1.);
float i = exp(n.w * 3. - 1.5) * intensity;
gl_FragColor = vec4(vec3(i), 1.);
}