Fixed las bug in 2d rendering

This commit is contained in:
lanariel 2014-02-10 09:35:03 +01:00
parent e6e56ba21b
commit adb273bd5b
3 changed files with 8 additions and 12 deletions

View File

@ -2,5 +2,5 @@
float4 main(Pixel2DIn input) : SV_Target0 float4 main(Pixel2DIn input) : SV_Target0
{ {
return float4(Material.Sample(LinearSampler,input.Uv).xyz,0.5); return Material.Sample(LinearSampler,input.Uv);
} }

View File

@ -27,8 +27,8 @@ void main( uint3 DTid : SV_DispatchThreadID, uint3 GTid : SV_GroupThreadID )
Shaded.Specular += light.Specular; Shaded.Specular += light.Specular;
} }
Diffuse[DTid.xy] = float4(Shaded.Diffuse * DiffuseGlow[DTid.xy].xyz,1); Diffuse[DTid.xy] = float4(Shaded.Diffuse * DiffuseGlow[DTid.xy].xyz,0);
Specular[DTid.xy] = float4(Shaded.Specular, 1); Specular[DTid.xy] = float4(Shaded.Specular, 0);
if(DTid.x & 1 && DTid.y & 1 ) if(DTid.x & 1 && DTid.y & 1 )

View File

@ -14,17 +14,13 @@ cbuffer Size : register(b0)
[numthreads(16, 16, 1)] [numthreads(16, 16, 1)]
void main( uint3 DTid : SV_DispatchThreadID ) void main( uint3 DTid : SV_DispatchThreadID )
{ {
float4 Light = Diffuse[DTid.xy] + Specular[DTid.xy]; float4 Light = Diffuse[DTid.xy] + saturate(Specular[DTid.xy]);
float4 Amb = float4(Ambient[DTid.xy/2].xyz,1);// * Ambient[DTid.xy/2].w,1); float4 Amb = float4(Ambient[DTid.xy/2].xyz * Ambient[DTid.xy/2].w, 0);
//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 GUI; float4 GUI;
uint2 index = DTid.xy/2 + int2(Pixels.x/2,0); 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]); GUI = float4(Ambient[index]);
PostLight = PostLight * (1 - GUI.w); PostLight = PostLight * (1 - GUI.w);
//Output[DTid.xy] = float4((GUI.xyz * GUI.w) + ((Light + Amb * AmbFactor) * (1 - GUI.w)),0);
Output[DTid.xy] = float4((GUI.xyz * GUI.w) + PostLight, 1); Output[DTid.xy] = float4((GUI.xyz * GUI.w) + PostLight, 1);
} }