From 3e72421cb5d6773360eb63656f8b6534a38a9f39 Mon Sep 17 00:00:00 2001 From: lanariel Date: Thu, 27 Feb 2014 09:04:12 +0100 Subject: [PATCH] half baked tiles --- Code/Game/GameClient/DanBiasGame_Impl.cpp | 2 +- .../GameClient/GameClientState/GameState.cpp | 10 +- .../GameServerDebugEnvironment/Source.cpp | 2 +- Code/Misc/OysterMath/LinearMath.h | 2 +- .../Definitions/GraphicalDefinition.h | 3 +- Code/OysterGraphics/DllInterfaces/GFXAPI.cpp | 6 +- .../OysterGraphics/Render/DefaultRenderer.cpp | 14 +- Code/OysterGraphics/Render/DefaultRenderer.h | 2 +- Code/OysterGraphics/Render/Resources.h | 2 +- .../Shader/Passes/Light/Defines.hlsli | 18 ++- .../Shader/Passes/Light/LightCalc.hlsli | 26 ++-- .../Shader/Passes/Light/LightPass.hlsl | 124 +++++++++++------- .../Shader/Passes/Light/SSAO.hlsli | 5 +- .../Shader/Passes/Post/PostPass.hlsl | 5 +- 14 files changed, 139 insertions(+), 82 deletions(-) diff --git a/Code/Game/GameClient/DanBiasGame_Impl.cpp b/Code/Game/GameClient/DanBiasGame_Impl.cpp index b461f908..535357e7 100644 --- a/Code/Game/GameClient/DanBiasGame_Impl.cpp +++ b/Code/Game/GameClient/DanBiasGame_Impl.cpp @@ -118,7 +118,7 @@ namespace DanBias Graphics::API::Update( data.capFrame ); if(Render() != S_OK) return DanBiasClientReturn_Error; - data.capFrame -= 0.03f; + data.capFrame = 0.0f; } if(data.networkClient.IsConnected()) diff --git a/Code/Game/GameClient/GameClientState/GameState.cpp b/Code/Game/GameClient/GameClientState/GameState.cpp index b608a4f3..92b3c7e8 100644 --- a/Code/Game/GameClient/GameClientState/GameState.cpp +++ b/Code/Game/GameClient/GameClientState/GameState.cpp @@ -73,9 +73,15 @@ bool GameState::Init( SharedStateContent &shared ) Graphics::API::Option gfxOp = Graphics::API::GetOption(); Float aspectRatio = gfxOp.Resolution.x / gfxOp.Resolution.y; - this->privData->camera.SetPerspectiveProjection( Utility::Value::Radian(90.0f), aspectRatio, 0.1f, 1000.0f ); + this->privData->camera.SetPerspectiveProjection( Utility::Value::Radian(90.0f), aspectRatio, 1.0f, 100.0f ); + + // HACK: debug test + Matrix debug_p = this->privData->camera.GetProjectionMatrix(); + Float debug_n = - debug_p.m34 / debug_p.m33; + Float debug_f = debug_p.m34 / (1.0f - debug_p.m33); + Graphics::API::SetProjection( this->privData->camera.GetProjectionMatrix() ); - gfxOp.AmbientValue = 0.5f; + gfxOp.AmbientValue = 0.3f; gfxOp.GlobalGlowTint = Math::Float3(1,1,1); gfxOp.GlobalTint = Math::Float3(1,1,1); Graphics::API::SetOptions(gfxOp); diff --git a/Code/Game/LanServer/GameServerDebugEnvironment/Source.cpp b/Code/Game/LanServer/GameServerDebugEnvironment/Source.cpp index 3357f52c..8ec4c9aa 100644 --- a/Code/Game/LanServer/GameServerDebugEnvironment/Source.cpp +++ b/Code/Game/LanServer/GameServerDebugEnvironment/Source.cpp @@ -32,7 +32,7 @@ int WINAPI WinMain( HINSTANCE hinst, HINSTANCE prevInst, PSTR cmdLine, int cmdSh GameServerAPI::GameSetGameMode(L"free-for-all"); GameServerAPI::GameSetGameName(L"DebugServer"); GameServerAPI::GameSetGameTime(15); - GameServerAPI::GameSetMapName(L"erik_250.bias"); + GameServerAPI::GameSetMapName(L"manyLights.bias"); GameServerAPI::GameSetMaxClients(10); if(GameServerAPI::GameStart(true)) diff --git a/Code/Misc/OysterMath/LinearMath.h b/Code/Misc/OysterMath/LinearMath.h index 5b87d83d..c4158035 100644 --- a/Code/Misc/OysterMath/LinearMath.h +++ b/Code/Misc/OysterMath/LinearMath.h @@ -78,7 +78,7 @@ inline ::LinearAlgebra::Vector4 operator * ( const ::LinearAlgebra:: { return ::LinearAlgebra::Vector4( (matrix.m11 * vector.x) + (matrix.m12 * vector.y) + (matrix.m13 * vector.z) + (matrix.m14 * vector.w), (matrix.m21 * vector.x) + (matrix.m22 * vector.y) + (matrix.m23 * vector.z) + (matrix.m24 * vector.w), - (matrix.m23 * vector.x) + (matrix.m32 * vector.y) + (matrix.m33 * vector.z) + (matrix.m34 * vector.w), + (matrix.m31 * vector.x) + (matrix.m32 * vector.y) + (matrix.m33 * vector.z) + (matrix.m34 * vector.w), (matrix.m41 * vector.x) + (matrix.m42 * vector.y) + (matrix.m43 * vector.z) + (matrix.m44 * vector.w) ); } diff --git a/Code/OysterGraphics/Definitions/GraphicalDefinition.h b/Code/OysterGraphics/Definitions/GraphicalDefinition.h index 77aecdc8..5572be72 100644 --- a/Code/OysterGraphics/Definitions/GraphicalDefinition.h +++ b/Code/OysterGraphics/Definitions/GraphicalDefinition.h @@ -35,9 +35,10 @@ namespace Oyster { Math::Float4x4 InvProj; Math::Float4x4 Proj; - Math::Float2 Pixels; + float FoV; int Lights; float SSAORadius; + float pad; Oyster::Math::Float4x4 View; }; diff --git a/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp b/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp index ee3d9f8a..46145430 100644 --- a/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp +++ b/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp @@ -20,6 +20,7 @@ namespace Oyster std::vector Lights; float deltaTime; int MostModel; + float FoV; #ifdef _DEBUG Model::Model* cube; Model::Model* sphere; @@ -85,6 +86,7 @@ namespace Oyster void API::SetProjection(const Math::Float4x4& projection) { Projection = projection; + FoV = 2 * std::atanf(1/projection.m[1][1]); } void API::SetView(const Math::Float4x4& view) @@ -96,11 +98,11 @@ namespace Oyster { if(Lights.size()) { - Render::DefaultRenderer::NewFrame(View, Projection, &Lights[0], (int)Lights.size()); + Render::DefaultRenderer::NewFrame(View, Projection, &Lights[0], (int)Lights.size(), FoV); } else { - Render::DefaultRenderer::NewFrame(View, Projection, NULL, 0); + Render::DefaultRenderer::NewFrame(View, Projection, NULL, 0, FoV); } } diff --git a/Code/OysterGraphics/Render/DefaultRenderer.cpp b/Code/OysterGraphics/Render/DefaultRenderer.cpp index 4b979be8..4e9d197d 100644 --- a/Code/OysterGraphics/Render/DefaultRenderer.cpp +++ b/Code/OysterGraphics/Render/DefaultRenderer.cpp @@ -14,7 +14,7 @@ namespace Oyster { Definitions::Pointlight pl; - void DefaultRenderer::NewFrame(Oyster::Math::Float4x4 View, Oyster::Math::Float4x4 Projection, Definitions::Pointlight* Lights, int numLights) + void DefaultRenderer::NewFrame(Oyster::Math::Float4x4 View, Oyster::Math::Float4x4 Projection, Definitions::Pointlight* Lights, int numLights, float Fov) { Preparations::Basic::ClearBackBuffer(Oyster::Math::Float4(0,0,0,0)); Preparations::Basic::ClearDepthStencil(Resources::Gui::depth); @@ -25,7 +25,7 @@ namespace Oyster Definitions::LightConstants lc; lc.InvProj = Projection.GetInverse(); - lc.Pixels = Core::resolution; + lc.FoV = Fov; lc.Lights = numLights; lc.View = View; lc.Proj = Projection; @@ -36,7 +36,15 @@ namespace Oyster Resources::Light::LightConstantsData.Unmap(); data = Resources::Light::PointLightsData.Map(); - memcpy(data, Lights, sizeof(Definitions::Pointlight) * numLights); + Definitions::Pointlight* plData = (Definitions::Pointlight*)data; + for(int i=0; i < numLights; ++i) + { + plData[i].Pos = (View * Math::Float4(Lights[i].Pos,1)).xyz; + plData[i].Radius = Lights[i].Radius; + plData[i].Color = Lights[i].Color; + plData[i].Bright = Lights[i].Bright; + } + //memcpy(data, Lights, sizeof(Definitions::Pointlight) * numLights); Resources::Light::PointLightsData.Unmap(); for(auto i = Render::Resources::RenderData.begin(); i != Render::Resources::RenderData.end(); i++ ) diff --git a/Code/OysterGraphics/Render/DefaultRenderer.h b/Code/OysterGraphics/Render/DefaultRenderer.h index 1a5cdcc0..74a1e4ff 100644 --- a/Code/OysterGraphics/Render/DefaultRenderer.h +++ b/Code/OysterGraphics/Render/DefaultRenderer.h @@ -13,7 +13,7 @@ namespace Oyster class DefaultRenderer { public: - static void NewFrame(Oyster::Math::Float4x4 View, Oyster::Math::Float4x4 Projection, Definitions::Pointlight* Lights, int numLights); + static void NewFrame(Oyster::Math::Float4x4 View, Oyster::Math::Float4x4 Projection, Definitions::Pointlight* Lights, int numLights, float Fov); static void RenderScene(Model::Model* models, int count, Math::Matrix View, Math::Matrix Projection, float DeltaTime = 0); static void EndFrame(); }; diff --git a/Code/OysterGraphics/Render/Resources.h b/Code/OysterGraphics/Render/Resources.h index fe1393b9..d7f66199 100644 --- a/Code/OysterGraphics/Render/Resources.h +++ b/Code/OysterGraphics/Render/Resources.h @@ -24,7 +24,7 @@ namespace Oyster static const int GBufferSize = 3; static const int LBufferSize = 3; - static const int MaxLightSize = 100; + static const int MaxLightSize = 1024; //! GBuffers //! 0 = Diffuse + Glow diff --git a/Code/OysterGraphics/Shader/Passes/Light/Defines.hlsli b/Code/OysterGraphics/Shader/Passes/Light/Defines.hlsli index fb125b12..0db1b98f 100644 --- a/Code/OysterGraphics/Shader/Passes/Light/Defines.hlsli +++ b/Code/OysterGraphics/Shader/Passes/Light/Defines.hlsli @@ -19,20 +19,24 @@ cbuffer LightConstants : register(b0) { float4x4 InvProj; float4x4 Proj; - float2 Pixels; + float FoV; int Lights; float SSAORadius; + float pad; float4x4 View; } struct FrustrumPoints { - float3 v0; - float3 v1; - float3 v2; - float3 v3; - float3 v4; - float3 v5; + float3 NUL; + float3 NUR; + float3 NDL; + float3 NDR; + + float3 FUL; + float3 FUR; + float3 FDL; + float3 FDR; }; Texture2D DiffuseGlow : register(t0); diff --git a/Code/OysterGraphics/Shader/Passes/Light/LightCalc.hlsli b/Code/OysterGraphics/Shader/Passes/Light/LightCalc.hlsli index 81fa2fa1..36606f01 100644 --- a/Code/OysterGraphics/Shader/Passes/Light/LightCalc.hlsli +++ b/Code/OysterGraphics/Shader/Passes/Light/LightCalc.hlsli @@ -4,10 +4,18 @@ DiffSpec LightCalc(PointLight pl, float3 pos, int2 texCoord) { DiffSpec output; float4 normalSpec = NormalSpec[texCoord]; - float4 LPos = mul(View, float4(pl.Pos, 1)); - float3 lightVec = LPos.xyz - pos.xyz; + float4 LPos = float4(pl.Pos, 1); + float3 lightVec = LPos.xyz - pos; float d = length(lightVec); + lightVec = lightVec/d; + + if(d > pl.Radius) + { + output.Diffuse = float3(0,0,0); + output.Specular = float3(0,0,0); + return output; + } float diffFactor = max(dot(lightVec, normalSpec.xyz), 0.0f); float3 v = reflect(-lightVec, normalSpec.xyz); @@ -15,21 +23,13 @@ DiffSpec LightCalc(PointLight pl, float3 pos, int2 texCoord) //Check att later float att = max( 0, 1 - (d / pl.Radius)); //fix Ilum calcs instead of PhongBlinn - output.Diffuse = pl.Bright * att * diffFactor * pl.Color; + output.Diffuse = pl.Bright * att * diffFactor * pl.Color; output.Specular = pl.Bright * att * specFactor * pl.Color; if(diffFactor == 0) output.Specular * 0; - if(d > pl.Radius) - { - output.Diffuse = float3(0,0,0); - output.Specular = float3(0,0,0); - } + float SpecCo = normalSpec.w < 1 ? 0.0f : 1.0f; + output.Specular = output.Specular * SpecCo; return output; -} - -bool intersects(FrustrumPoints box, int Index) -{ - return true; } \ 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 ddaed99e..78d7975b 100644 --- a/Code/OysterGraphics/Shader/Passes/Light/LightPass.hlsl +++ b/Code/OysterGraphics/Shader/Passes/Light/LightPass.hlsl @@ -8,20 +8,18 @@ //Calc Ambience Done //Write Glow -#define EXPAND 1024.0f -#define SHRINK 1.0f/EXPAND #define UINT_MAX 0xFFFFFFFF #define FLOAT_MAX 3.402823466e+38 #define BLOCKSIZE 16 #define NUMTHREADS BLOCKSIZE * BLOCKSIZE -#define MAXLIGHTS 100 +#define MAXLIGHTS 1024 +#define TEXTURESPREAD 1/255 // -- Shared Memory ------------------------------------------------- // -groupshared uint iMinDepth = UINT_MAX, - iMaxDepth = 0; -groupshared uint numVisiblePointLights = 0, +groupshared uint iMinDepth, iMaxDepth; +groupshared uint numVisiblePointLights, visiblePointlightIndex[MAXLIGHTS]; // ------------------------------------------------------------------ // @@ -29,77 +27,110 @@ groupshared uint numVisiblePointLights = 0, [numthreads(BLOCKSIZE, BLOCKSIZE, 1)] void main( uint3 DTid : SV_DispatchThreadID, uint3 GTid : SV_GroupThreadID, uint3 Gid : SV_GroupID, uint GI : SV_GroupIndex ) { - float2 UV = DTid.xy / Pixels; + float2 UV = DTid.xy / (float2)Diffuse.Length.xy; UV.x = UV.x * 2 - 1; UV.y = 1 - 2 * UV.y; float3 posN = float3(UV, DepthTexture[DTid.xy].x); + + float3 ViewPos = ToVpos(DTid.xy, UV); + + if(GI==0) + { + numVisiblePointLights = 0; + iMinDepth = 0x7F7FFFFF; + iMaxDepth = 0; + } + GroupMemoryBarrierWithGroupSync(); // store and load shared minDepth and maxDepth - float minDepth = 0.0f, maxDepth = 0.0f, - depth = posN.z; + float minDepth = 0.0f, maxDepth = 0.0f; { - uint uidepth = (uint)( depth * EXPAND); - InterlockedMin( iMinDepth, uidepth ); - InterlockedMax( iMaxDepth, uidepth ); + InterlockedMin( iMinDepth, asuint(ViewPos.z) ); + InterlockedMax( iMaxDepth, asuint(ViewPos.z) ); GroupMemoryBarrierWithGroupSync(); - minDepth = (float)( iMinDepth ) * SHRINK; - maxDepth = (float)( iMaxDepth ) * SHRINK; + minDepth = asfloat(iMinDepth); + maxDepth = asfloat(iMaxDepth); } // -- Switching to LightCulling ------------------------------------- // //define collision volume - float2 size = BLOCKSIZE / Pixels; - FrustrumPoints tile; - tile.v0 = float3(size * Gid,minDepth); - tile.v1 = float3(tile.v0.xy+size,maxDepth); - tile.v2 = float3(tile.v1.xy, minDepth); - tile.v3 = float3(tile.v0.x,tile.v1.y,minDepth); - tile.v4 = float3(tile.v1.x, tile.v0.y, minDepth); - tile.v5 = float3(tile.v0.xy, maxDepth); + float2 tilescale = float2(Diffuse.Length.xy) * rcp(float(2 * BLOCKSIZE)); + float2 tilebias = tilescale - float2(Gid.xy); + // Now work out composite projection matrix + // Relevant matrix columns for this tile frusta + float4 c1 = float4(Proj._11 * tilescale.x, 0.0f, tilebias.x, 0.0f); + float4 c2 = float4(0.0f, -Proj._22 * tilescale.y, tilebias.y, 0.0f); + float4 c4 = float4(0.0f, 0.0f, 1.0f, 1.0f); + // Derive frustum planes + float4 frustumPlanes[6]; + // Sides + frustumPlanes[0] = c4 - c1; + frustumPlanes[1] = c4 + c1; + frustumPlanes[2] = c4 - c2; + frustumPlanes[3] = c4 + c2; + // Near/far + frustumPlanes[4] = float4(0.0f, 0.0f, 1.0f, -minDepth); + frustumPlanes[5] = float4(0.0f, 0.0f, -1.0f, maxDepth); + + // Normalize frustum planes (near/far already normalized) + [unroll] + for (uint i = 0; i < 4; ++i) + { + frustumPlanes[i] *= rcp(length(frustumPlanes[i].xyz)); + } // culling the tile's near and far to minDepth & maxDepth ( with tolerance ) - uint numPass = (Lights + NUMTHREADS - 1) / NUMTHREADS; - numPass = min( numPass, MAXLIGHTS / NUMTHREADS ); + for(uint lightIndex = GI; lightIndex < Lights; lightIndex += NUMTHREADS) + { + PointLight pl = Points[lightIndex]; + + bool inFrustrum = true; + float d = dot(frustumPlanes[0], float4(pl.Pos, 1.0f)); + inFrustrum = inFrustrum && (d >= -pl.Radius); + d = dot(frustumPlanes[1], float4(pl.Pos, 1.0f)); + inFrustrum = inFrustrum && (d >= -pl.Radius); + d = dot(frustumPlanes[2], float4(pl.Pos, 1.0f)); + inFrustrum = inFrustrum && (d >= -pl.Radius); + d = dot(frustumPlanes[3], float4(pl.Pos, 1.0f)); + inFrustrum = inFrustrum && (d >= -pl.Radius); + d = dot(frustumPlanes[4], float4(pl.Pos, 1.0f)); + inFrustrum = inFrustrum && (d >= -pl.Radius); + d = dot(frustumPlanes[5], float4(pl.Pos, 1.0f)); + inFrustrum = inFrustrum && (d >= -pl.Radius); - for( uint passI = 0; passI < numPass; ++passI ) + [branch] + if(inFrustrum) { - uint lightIndex = (passI * NUMTHREADS) + GI; - lightIndex = min( lightIndex, Lights ); - - if( lightIndex < Lights ) - if( intersects(tile, lightIndex) ) - { - uint offset; - InterlockedAdd( numVisiblePointLights, 1, offset ); - visiblePointlightIndex[offset] = lightIndex; - } + uint offset; + InterlockedAdd( numVisiblePointLights, 1, offset ); + visiblePointlightIndex[offset] = lightIndex; } + } GroupMemoryBarrierWithGroupSync(); - float3 ViewPos = ToVpos(DTid.xy, UV); DiffSpec Shaded; Shaded.Diffuse = float3(0,0,0); Shaded.Specular = float3(0,0,0); - for(int i = 0; i < Lights; ++i) + for(int i = 0; i < numVisiblePointLights; ++i) { - DiffSpec light = LightCalc(Points[i], ViewPos, DTid.xy); + DiffSpec light = LightCalc(Points[visiblePointlightIndex[i]], ViewPos, DTid.xy); Shaded.Diffuse += light.Diffuse; Shaded.Specular += light.Specular; } - Diffuse[DTid.xy] = float4(Shaded.Diffuse * DiffuseGlow[DTid.xy].xyz,0); + Diffuse[DTid.xy] = float4(Shaded.Diffuse * DiffuseGlow[DTid.xy].xyz,1); Specular[DTid.xy] = float4(Shaded.Specular, 0); @@ -113,14 +144,15 @@ void main( uint3 DTid : SV_DispatchThreadID, uint3 GTid : SV_GroupThreadID, uin DiffBase = DiffBase / 4; float4 DepthBase = DepthTexture[DTid.xy]; - DepthBase = DepthTexture[DTid.xy + uint2(1,0)]; - DepthBase = DepthTexture[DTid.xy + uint2(0,1)]; - DepthBase = DepthTexture[DTid.xy + uint2(1,1)]; + DepthBase += DepthTexture[DTid.xy + uint2(1,0)]; + DepthBase += DepthTexture[DTid.xy + uint2(0,1)]; + DepthBase += DepthTexture[DTid.xy + uint2(1,1)]; DepthBase = DepthBase /4; - Ambient[DTid.xy/2] = float4(DiffBase.xyz, AmbValue); - Ambient[DTid.xy/2 + float2(Pixels.x/2, 0)] = GUI[DTid.xy]; - Ambient[DTid.xy/2 + float2(0, Pixels.y/2)] = float4(DiffBase.xyz * DiffBase.w ,DiffBase.w); - Ambient[DTid.xy/2 + Pixels/2] = float4(NormalSpec[DTid.xy].xyz * float3(1,1,-1),1); + Ambient[DTid.xy/2] = float4(DiffBase.xyz , AmbValue); + //Ambient[DTid.xy/2] = float4(DiffBase.xyz, 1); + Ambient[DTid.xy/2 + float2(Diffuse.Length.x/2, 0)] = GUI[DTid.xy]; + Ambient[DTid.xy/2 + float2(0, Diffuse.Length.y/2)] = float4(DiffBase.xyz * DiffBase.w ,DiffBase.w); + Ambient[DTid.xy/2 + Diffuse.Length.xy/2] = float4(numVisiblePointLights * (1.0f/Lights), 0, 0 ,1); } } \ No newline at end of file diff --git a/Code/OysterGraphics/Shader/Passes/Light/SSAO.hlsli b/Code/OysterGraphics/Shader/Passes/Light/SSAO.hlsli index c71cb4d5..10cb00f6 100644 --- a/Code/OysterGraphics/Shader/Passes/Light/SSAO.hlsli +++ b/Code/OysterGraphics/Shader/Passes/Light/SSAO.hlsli @@ -23,6 +23,7 @@ float GetSSAO(float3 pos, float2 uv, int2 texCoord2, uint2 rndID) float3 sampled = mul(tbn, SSAOKernel[i].xyz); sampled = sampled * Radius + pos; + //project sample to get uv.xy float4 ProjOffset = float4(sampled,1); ProjOffset = mul(Proj, ProjOffset); @@ -35,7 +36,7 @@ float GetSSAO(float3 pos, float2 uv, int2 texCoord2, uint2 rndID) // get depth from that point in screenspace uint2 texCoord; - texCoord = (uint2)(offset.xy * Pixels); + texCoord = (uint2)(offset.xy * Diffuse.Length.xy); float3 ViewPos = ToVpos(texCoord, UV); float sampleDepth = ViewPos.z; @@ -43,6 +44,8 @@ float GetSSAO(float3 pos, float2 uv, int2 texCoord2, uint2 rndID) //compare to depth from sample float rangeCheck = (abs(pos.z - sampleDepth) > Radius) ? 1.0f : 0.0f; occlusion += (sampleDepth <= sampled.z ? 1.0f : 0.0f) * rangeCheck; + //occlusion += rangeCheck; + } occlusion /= (float)(SSAOKernel.Length.x); occlusion = 1.0f - occlusion; diff --git a/Code/OysterGraphics/Shader/Passes/Post/PostPass.hlsl b/Code/OysterGraphics/Shader/Passes/Post/PostPass.hlsl index c3f7e69e..87c7c95a 100644 --- a/Code/OysterGraphics/Shader/Passes/Post/PostPass.hlsl +++ b/Code/OysterGraphics/Shader/Passes/Post/PostPass.hlsl @@ -27,7 +27,7 @@ void main( uint3 DTid : SV_DispatchThreadID ) SSAO = SSAO / 16; - float4 Light = Diffuse[DTid.xy] + saturate(Specular[DTid.xy]); + float4 Light = Diffuse[DTid.xy];// + saturate(Specular[DTid.xy]); float3 Amb = Ambient[DTid.xy/2].xyz * SSAO * Color; float4 Glow = Ambient[DTid.xy/2 + uint2(0,Output.Length.y/2)]; @@ -43,5 +43,6 @@ void main( uint3 DTid : SV_DispatchThreadID ) //Output[DTid.xy] = float4(Ambient[DTid.xy/2 + uint2(Output.Length*0.5f)].xyz,1); //Output[DTid.xy] = SSAO * float4(1,1,1,1); - //Output[DTid.xy] = Ambient[DTid.xy]; + Output[DTid.xy] = Ambient[DTid.xy]; + //Output[DTid.xy] = Diffuse[DTid.xy]; } \ No newline at end of file