[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 ] }); .setDisplay(VALUE_DISPLAY.slider, { range: [ 0, 2, 0.01 ] });
addShaderProp(SHADER_UNIFORM.float, "detail"); 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 = [ input_display_list = [
["Output", true], 0, ["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 seed;
uniform float progress; uniform float progress;
uniform float detail; uniform float detail;
uniform float intensity;
uniform vec2 dimension; uniform vec2 dimension;
uniform vec2 position; uniform vec2 position;
@ -95,6 +96,6 @@ void main() {
n = snoise( pos ); n = snoise( pos );
// noise [-1..+1] -> color // noise [-1..+1] -> color
float intensity = exp(n.w * 3. - 1.5); float i = exp(n.w * 3. - 1.5) * intensity;
gl_FragColor = vec4(vec3(intensity), 1.); gl_FragColor = vec4(vec3(i), 1.);
} }