Skip to content

Commit

Permalink
Blur depth threshold as a parameter on VolumetricLighting.hx
Browse files Browse the repository at this point in the history
  • Loading branch information
clementlandrin committed Nov 20, 2024
1 parent 4f2f38a commit 53fe082
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions hrt/prefab/rfx/VolumetricLighting.hx
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ class VolumetricLighting extends RendererFX {
@:s public var color : Int = 0xFFFFFF;
@:s public var steps : Int = 10;
@:s public var blur : Float = 0.0;
@:s public var blurDepthThreshold : Float = 10.0;
@:s public var startDistance : Float = 0.0;
@:s public var endDistance : Float = 200.0;
@:s public var distanceOpacity : Float = 1.0;
Expand Down Expand Up @@ -326,7 +327,7 @@ class VolumetricLighting extends RendererFX {
blurPass.shader.isDepthDependant = true;
blurPass.shader.depthTexture = halfDepth;
blurPass.shader.inverseProj = inverseProj;
blurPass.shader.depthThreshold = 10;
blurPass.shader.depthThreshold = blurDepthThreshold;
blurPass.apply(r.ctx, tex);

var b : h3d.mat.BlendMode = switch ( blend ) {
Expand Down Expand Up @@ -355,10 +356,10 @@ class VolumetricLighting extends RendererFX {
if ( !AFTER_FX )
execute(r, step);
}

override function end(r:h3d.scene.Renderer, step:h3d.impl.RendererFX.Step) {
if ( AFTER_FX )
execute(r, step);
execute(r, step);
}

function makeNoiseTex() : h3d.mat.Texture {
Expand Down Expand Up @@ -441,6 +442,7 @@ class VolumetricLighting extends RendererFX {
<dl>
<dt><font color=#FF0000>Steps</font></dt><dd><input type="range" step="1" min="0" max="255" field="steps"/></dd>
<dt>Blur</dt><dd><input type="range" step="1" min="0" max="100" field="blur"/></dd>
<dt>Blur depth threshold</dt><dd><input type="range" field="blurDepthThreshold"/></dd>
<dt>Dithering intensity</dt><dd><input type="range" min="0" max="1" field="ditheringIntensity"/></dd>
</dl>
</div>
Expand Down

0 comments on commit 53fe082

Please sign in to comment.