From 02bdd85ed41d76debc7c702a8fd9b73ee6165c46 Mon Sep 17 00:00:00 2001 From: Daniel Hodgson Date: Sun, 1 Nov 2020 08:28:45 -0800 Subject: [PATCH] examples: Added adjustable luminance to hexagon size (#364) --- data/examples/shaders/filter/hexagonize.effect | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/data/examples/shaders/filter/hexagonize.effect b/data/examples/shaders/filter/hexagonize.effect index fe0d6175..9f9285d0 100644 --- a/data/examples/shaders/filter/hexagonize.effect +++ b/data/examples/shaders/filter/hexagonize.effect @@ -37,6 +37,14 @@ uniform float HexagonWallScale< float step = 0.01; float scale = 0.01; > = 100.0; +uniform float LuminanceScale< + string name = "Luminance Scale"; + string field_type = "slider"; + float minimum = 0.0; + float maximum = 100.0; + float step = 0.01; + float scale = 0.01; +> = 0.00; // ---------- Shader Code sampler_state def_sampler { @@ -120,8 +128,9 @@ float4 PSDefault(VertData v_in) : TARGET { float dist = hexDist(coord, nearest); float luminance = (texel.r + texel.g + texel.b)/3.0; + luminance = (luminance * LuminanceScale) + (1-LuminanceScale); //float interiorSize = luminance*s; - float interiorSize = s * HexagonWallScale; + float interiorSize = luminance * s * HexagonWallScale; float interior = 1.0 - smoothstep(interiorSize-1.0, interiorSize, dist); //fragColor = float4(dist); return float4(texel.rgb*interior, 1.0);