From 7b12f89deb51434c707f6b1247a7fff333dd19ff Mon Sep 17 00:00:00 2001 From: Ben Clayton Date: Thu, 21 May 2020 15:01:41 +0100 Subject: [PATCH] Apply ab38f8b1's changes to offscreen HLSL shaders --- data/hlsl/README.md | 2 +- data/hlsl/offscreen/mirror.vert | 3 ++- data/hlsl/offscreen/phong.vert | 5 +++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/data/hlsl/README.md b/data/hlsl/README.md index 8d0be9cc..00e274bd 100644 --- a/data/hlsl/README.md +++ b/data/hlsl/README.md @@ -49,7 +49,7 @@ Shaders written to mirror the GLSL versions at `eddd724`. There have been change | nv_ray_tracing_reflections | ☑ | ☑ | ☑ | ☑ | nv_ray_tracing_shadows | ☑ | ☑ | ☑ | ☑ | occlusionquery | ☑ | ☑ | ☑ | ☑ -| offscreen | ☑ | ☑ | ☑ | ❌ +| offscreen | ☑ | ☑ | ☑ | ☑ | parallaxmapping | ☑ | ☑ | ☑ | ☑ | particlefire | ☑ | ☑ | ☑ | ☑ | pbrbasic | ☑ | ☑ | ☑ | ☑ diff --git a/data/hlsl/offscreen/mirror.vert b/data/hlsl/offscreen/mirror.vert index 8793d02b..671a3138 100644 --- a/data/hlsl/offscreen/mirror.vert +++ b/data/hlsl/offscreen/mirror.vert @@ -9,6 +9,7 @@ struct VSInput struct UBO { float4x4 projection; + float4x4 view; float4x4 model; }; @@ -25,7 +26,7 @@ VSOutput main(VSInput input) { VSOutput output = (VSOutput)0; output.UV = input.UV; - output.ProjCoord = mul(ubo.projection, mul(ubo.model, float4(input.Pos.xyz, 1.0))); + output.ProjCoord = mul(ubo.projection, mul(ubo.view, mul(ubo.model, float4(input.Pos.xyz, 1.0)))); output.Pos = output.ProjCoord; return output; } diff --git a/data/hlsl/offscreen/phong.vert b/data/hlsl/offscreen/phong.vert index 792eb7c5..43656439 100644 --- a/data/hlsl/offscreen/phong.vert +++ b/data/hlsl/offscreen/phong.vert @@ -10,6 +10,7 @@ struct VSInput struct UBO { float4x4 projection; + float4x4 view; float4x4 model; float4 lightPos; }; @@ -31,8 +32,8 @@ VSOutput main(VSInput input) VSOutput output = (VSOutput)0; output.Normal = input.Normal; output.Color = input.Color; - output.Pos = mul(ubo.projection, mul(ubo.model, input.Pos)); - output.EyePos = mul(ubo.model, input.Pos).xyz; + output.Pos = mul(ubo.projection, mul(ubo.view, mul(ubo.model, input.Pos))); + output.EyePos = mul(ubo.view, mul(ubo.model, input.Pos)).xyz; output.LightVec = normalize(ubo.lightPos.xyz - output.EyePos); // Clip against reflection plane