From adb273bd5ba37bfd955604319e8b6ec9b5964184 Mon Sep 17 00:00:00 2001 From: lanariel Date: Mon, 10 Feb 2014 09:35:03 +0100 Subject: [PATCH] Fixed las bug in 2d rendering --- Code/OysterGraphics/Shader/Passes/2D/2DPixel.hlsl | 2 +- .../Shader/Passes/Light/LightPass.hlsl | 4 ++-- .../Shader/Passes/Post/PostPass.hlsl | 14 +++++--------- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/Code/OysterGraphics/Shader/Passes/2D/2DPixel.hlsl b/Code/OysterGraphics/Shader/Passes/2D/2DPixel.hlsl index 7531f715..a09111b9 100644 --- a/Code/OysterGraphics/Shader/Passes/2D/2DPixel.hlsl +++ b/Code/OysterGraphics/Shader/Passes/2D/2DPixel.hlsl @@ -2,5 +2,5 @@ float4 main(Pixel2DIn input) : SV_Target0 { - return float4(Material.Sample(LinearSampler,input.Uv).xyz,0.5); + return Material.Sample(LinearSampler,input.Uv); } \ No newline at end of file diff --git a/Code/OysterGraphics/Shader/Passes/Light/LightPass.hlsl b/Code/OysterGraphics/Shader/Passes/Light/LightPass.hlsl index 8c988f1f..dc54187e 100644 --- a/Code/OysterGraphics/Shader/Passes/Light/LightPass.hlsl +++ b/Code/OysterGraphics/Shader/Passes/Light/LightPass.hlsl @@ -27,8 +27,8 @@ void main( uint3 DTid : SV_DispatchThreadID, uint3 GTid : SV_GroupThreadID ) Shaded.Specular += light.Specular; } - Diffuse[DTid.xy] = float4(Shaded.Diffuse * DiffuseGlow[DTid.xy].xyz,1); - Specular[DTid.xy] = float4(Shaded.Specular, 1); + Diffuse[DTid.xy] = float4(Shaded.Diffuse * DiffuseGlow[DTid.xy].xyz,0); + Specular[DTid.xy] = float4(Shaded.Specular, 0); if(DTid.x & 1 && DTid.y & 1 ) diff --git a/Code/OysterGraphics/Shader/Passes/Post/PostPass.hlsl b/Code/OysterGraphics/Shader/Passes/Post/PostPass.hlsl index 78d6ebd1..b219bd28 100644 --- a/Code/OysterGraphics/Shader/Passes/Post/PostPass.hlsl +++ b/Code/OysterGraphics/Shader/Passes/Post/PostPass.hlsl @@ -14,17 +14,13 @@ cbuffer Size : register(b0) [numthreads(16, 16, 1)] void main( uint3 DTid : SV_DispatchThreadID ) { - float4 Light = Diffuse[DTid.xy] + Specular[DTid.xy]; - float4 Amb = float4(Ambient[DTid.xy/2].xyz,1);// * Ambient[DTid.xy/2].w,1); - //Output[DTid.xy] = float4(Ambient[DTid.xy/2].xyz /* * Ambient[DTid.xy/2].w */, 1); - //Output[DTid.xy] = Diffuse[DTid.xy] + Specular[DTid.xy]; - //Output[DTid.xy] = Light + Amb * AmbFactor; - //Output[DTid.xy] = Ambient[DTid.xy/2].w; + float4 Light = Diffuse[DTid.xy] + saturate(Specular[DTid.xy]); + float4 Amb = float4(Ambient[DTid.xy/2].xyz * Ambient[DTid.xy/2].w, 0); float4 GUI; uint2 index = DTid.xy/2 + int2(Pixels.x/2,0); - float3 PostLight = Light.xyz + Amb.xyz * AmbFactor; + float3 PostLight = Amb.xyz * AmbFactor; + PostLight = PostLight + Light.xyz; GUI = float4(Ambient[index]); - PostLight = PostLight * (1-GUI.w); - //Output[DTid.xy] = float4((GUI.xyz * GUI.w) + ((Light + Amb * AmbFactor) * (1 - GUI.w)),0); + PostLight = PostLight * (1 - GUI.w); Output[DTid.xy] = float4((GUI.xyz * GUI.w) + PostLight, 1); } \ No newline at end of file