aboutsummaryrefslogtreecommitdiff
path: root/demo/d3d/shaders/pointThicknessPS.hlsl
diff options
context:
space:
mode:
authorMiles Macklin <[email protected]>2018-03-19 15:10:24 +1300
committerMiles Macklin <[email protected]>2018-03-19 15:10:24 +1300
commit8ee05c79ae1748ef132a12e4fb0af284899faec6 (patch)
tree82bd5aa1892e28ce7886b6cfeafe66a47ff38e67 /demo/d3d/shaders/pointThicknessPS.hlsl
parentFlex 1.2 (beta 2) (diff)
downloadflex-8ee05c79ae1748ef132a12e4fb0af284899faec6.tar.xz
flex-8ee05c79ae1748ef132a12e4fb0af284899faec6.zip
Flex 1.2.0 release
Diffstat (limited to 'demo/d3d/shaders/pointThicknessPS.hlsl')
-rw-r--r--demo/d3d/shaders/pointThicknessPS.hlsl29
1 files changed, 29 insertions, 0 deletions
diff --git a/demo/d3d/shaders/pointThicknessPS.hlsl b/demo/d3d/shaders/pointThicknessPS.hlsl
new file mode 100644
index 0000000..54fc0aa
--- /dev/null
+++ b/demo/d3d/shaders/pointThicknessPS.hlsl
@@ -0,0 +1,29 @@
+#include "shaderCommon.h"
+
+cbuffer constBuf : register(b0)
+{
+ FluidShaderConst gParams;
+};
+
+float4 pointThicknessPS(FluidGeoOut input) : SV_TARGET
+{
+ float4 gl_FragColor;
+ float4 gl_TexCoord[1];
+
+ //[unroll]
+ //for (int i = 0; i < 2; i++)
+ // gl_TexCoord[i] = input.texCoord[i];
+ gl_TexCoord[0] = input.invQ0;
+
+ // calculate normal from texture coordinates
+ float3 normal;
+ normal.xy = gl_TexCoord[0].xy * float2(2.0, -2.0) + float2(-1.0, 1.0);
+ float mag = dot(normal.xy, normal.xy);
+ if (mag > 1.0) discard; // kill pixels outside circle
+ normal.z = sqrt(1.0 - mag);
+
+ float tmp = normal.z * 0.005;
+ gl_FragColor = float4(tmp, tmp, tmp, tmp);
+
+ return gl_FragColor;
+}