half baked tiles

This commit is contained in:
lanariel 2014-02-27 09:04:12 +01:00
parent 53f0699b61
commit 3e72421cb5
14 changed files with 139 additions and 82 deletions

View File

@ -118,7 +118,7 @@ namespace DanBias
Graphics::API::Update( data.capFrame ); Graphics::API::Update( data.capFrame );
if(Render() != S_OK) if(Render() != S_OK)
return DanBiasClientReturn_Error; return DanBiasClientReturn_Error;
data.capFrame -= 0.03f; data.capFrame = 0.0f;
} }
if(data.networkClient.IsConnected()) if(data.networkClient.IsConnected())

View File

@ -73,9 +73,15 @@ bool GameState::Init( SharedStateContent &shared )
Graphics::API::Option gfxOp = Graphics::API::GetOption(); Graphics::API::Option gfxOp = Graphics::API::GetOption();
Float aspectRatio = gfxOp.Resolution.x / gfxOp.Resolution.y; 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() ); Graphics::API::SetProjection( this->privData->camera.GetProjectionMatrix() );
gfxOp.AmbientValue = 0.5f; gfxOp.AmbientValue = 0.3f;
gfxOp.GlobalGlowTint = Math::Float3(1,1,1); gfxOp.GlobalGlowTint = Math::Float3(1,1,1);
gfxOp.GlobalTint = Math::Float3(1,1,1); gfxOp.GlobalTint = Math::Float3(1,1,1);
Graphics::API::SetOptions(gfxOp); Graphics::API::SetOptions(gfxOp);

View File

@ -32,7 +32,7 @@ int WINAPI WinMain( HINSTANCE hinst, HINSTANCE prevInst, PSTR cmdLine, int cmdSh
GameServerAPI::GameSetGameMode(L"free-for-all"); GameServerAPI::GameSetGameMode(L"free-for-all");
GameServerAPI::GameSetGameName(L"DebugServer"); GameServerAPI::GameSetGameName(L"DebugServer");
GameServerAPI::GameSetGameTime(15); GameServerAPI::GameSetGameTime(15);
GameServerAPI::GameSetMapName(L"erik_250.bias"); GameServerAPI::GameSetMapName(L"manyLights.bias");
GameServerAPI::GameSetMaxClients(10); GameServerAPI::GameSetMaxClients(10);
if(GameServerAPI::GameStart(true)) if(GameServerAPI::GameStart(true))

View File

@ -78,7 +78,7 @@ inline ::LinearAlgebra::Vector4<ScalarType> operator * ( const ::LinearAlgebra::
{ {
return ::LinearAlgebra::Vector4<ScalarType>( (matrix.m11 * vector.x) + (matrix.m12 * vector.y) + (matrix.m13 * vector.z) + (matrix.m14 * vector.w), return ::LinearAlgebra::Vector4<ScalarType>( (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.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) ); (matrix.m41 * vector.x) + (matrix.m42 * vector.y) + (matrix.m43 * vector.z) + (matrix.m44 * vector.w) );
} }

View File

@ -35,9 +35,10 @@ namespace Oyster
{ {
Math::Float4x4 InvProj; Math::Float4x4 InvProj;
Math::Float4x4 Proj; Math::Float4x4 Proj;
Math::Float2 Pixels; float FoV;
int Lights; int Lights;
float SSAORadius; float SSAORadius;
float pad;
Oyster::Math::Float4x4 View; Oyster::Math::Float4x4 View;
}; };

View File

@ -20,6 +20,7 @@ namespace Oyster
std::vector<Definitions::Pointlight> Lights; std::vector<Definitions::Pointlight> Lights;
float deltaTime; float deltaTime;
int MostModel; int MostModel;
float FoV;
#ifdef _DEBUG #ifdef _DEBUG
Model::Model* cube; Model::Model* cube;
Model::Model* sphere; Model::Model* sphere;
@ -85,6 +86,7 @@ namespace Oyster
void API::SetProjection(const Math::Float4x4& projection) void API::SetProjection(const Math::Float4x4& projection)
{ {
Projection = projection; Projection = projection;
FoV = 2 * std::atanf(1/projection.m[1][1]);
} }
void API::SetView(const Math::Float4x4& view) void API::SetView(const Math::Float4x4& view)
@ -96,11 +98,11 @@ namespace Oyster
{ {
if(Lights.size()) 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 else
{ {
Render::DefaultRenderer::NewFrame(View, Projection, NULL, 0); Render::DefaultRenderer::NewFrame(View, Projection, NULL, 0, FoV);
} }
} }

View File

@ -14,7 +14,7 @@ namespace Oyster
{ {
Definitions::Pointlight pl; 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::ClearBackBuffer(Oyster::Math::Float4(0,0,0,0));
Preparations::Basic::ClearDepthStencil(Resources::Gui::depth); Preparations::Basic::ClearDepthStencil(Resources::Gui::depth);
@ -25,7 +25,7 @@ namespace Oyster
Definitions::LightConstants lc; Definitions::LightConstants lc;
lc.InvProj = Projection.GetInverse(); lc.InvProj = Projection.GetInverse();
lc.Pixels = Core::resolution; lc.FoV = Fov;
lc.Lights = numLights; lc.Lights = numLights;
lc.View = View; lc.View = View;
lc.Proj = Projection; lc.Proj = Projection;
@ -36,7 +36,15 @@ namespace Oyster
Resources::Light::LightConstantsData.Unmap(); Resources::Light::LightConstantsData.Unmap();
data = Resources::Light::PointLightsData.Map(); 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(); Resources::Light::PointLightsData.Unmap();
for(auto i = Render::Resources::RenderData.begin(); i != Render::Resources::RenderData.end(); i++ ) for(auto i = Render::Resources::RenderData.begin(); i != Render::Resources::RenderData.end(); i++ )

View File

@ -13,7 +13,7 @@ namespace Oyster
class DefaultRenderer class DefaultRenderer
{ {
public: 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 RenderScene(Model::Model* models, int count, Math::Matrix View, Math::Matrix Projection, float DeltaTime = 0);
static void EndFrame(); static void EndFrame();
}; };

View File

@ -24,7 +24,7 @@ namespace Oyster
static const int GBufferSize = 3; static const int GBufferSize = 3;
static const int LBufferSize = 3; static const int LBufferSize = 3;
static const int MaxLightSize = 100; static const int MaxLightSize = 1024;
//! GBuffers //! GBuffers
//! 0 = Diffuse + Glow //! 0 = Diffuse + Glow

View File

@ -19,20 +19,24 @@ cbuffer LightConstants : register(b0)
{ {
float4x4 InvProj; float4x4 InvProj;
float4x4 Proj; float4x4 Proj;
float2 Pixels; float FoV;
int Lights; int Lights;
float SSAORadius; float SSAORadius;
float pad;
float4x4 View; float4x4 View;
} }
struct FrustrumPoints struct FrustrumPoints
{ {
float3 v0; float3 NUL;
float3 v1; float3 NUR;
float3 v2; float3 NDL;
float3 v3; float3 NDR;
float3 v4;
float3 v5; float3 FUL;
float3 FUR;
float3 FDL;
float3 FDR;
}; };
Texture2D DiffuseGlow : register(t0); Texture2D DiffuseGlow : register(t0);

View File

@ -4,32 +4,32 @@ DiffSpec LightCalc(PointLight pl, float3 pos, int2 texCoord)
{ {
DiffSpec output; DiffSpec output;
float4 normalSpec = NormalSpec[texCoord]; float4 normalSpec = NormalSpec[texCoord];
float4 LPos = mul(View, float4(pl.Pos, 1)); float4 LPos = float4(pl.Pos, 1);
float3 lightVec = LPos.xyz - pos.xyz; float3 lightVec = LPos.xyz - pos;
float d = length(lightVec); float d = length(lightVec);
lightVec = lightVec/d; 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); float diffFactor = max(dot(lightVec, normalSpec.xyz), 0.0f);
float3 v = reflect(-lightVec, normalSpec.xyz); float3 v = reflect(-lightVec, normalSpec.xyz);
float specFactor = pow(max(dot(v,normalize(-pos)), 0.0f),normalSpec.w); float specFactor = pow(max(dot(v,normalize(-pos)), 0.0f),normalSpec.w);
//Check att later //Check att later
float att = max( 0, 1 - (d / pl.Radius)); float att = max( 0, 1 - (d / pl.Radius));
//fix Ilum calcs instead of PhongBlinn //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; output.Specular = pl.Bright * att * specFactor * pl.Color;
if(diffFactor == 0) if(diffFactor == 0)
output.Specular * 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; float SpecCo = normalSpec.w < 1 ? 0.0f : 1.0f;
output.Specular = output.Specular * SpecCo; output.Specular = output.Specular * SpecCo;
return output; return output;
} }
bool intersects(FrustrumPoints box, int Index)
{
return true;
}

View File

@ -8,20 +8,18 @@
//Calc Ambience Done //Calc Ambience Done
//Write Glow //Write Glow
#define EXPAND 1024.0f
#define SHRINK 1.0f/EXPAND
#define UINT_MAX 0xFFFFFFFF #define UINT_MAX 0xFFFFFFFF
#define FLOAT_MAX 3.402823466e+38 #define FLOAT_MAX 3.402823466e+38
#define BLOCKSIZE 16 #define BLOCKSIZE 16
#define NUMTHREADS BLOCKSIZE * BLOCKSIZE #define NUMTHREADS BLOCKSIZE * BLOCKSIZE
#define MAXLIGHTS 100 #define MAXLIGHTS 1024
#define TEXTURESPREAD 1/255
// -- Shared Memory ------------------------------------------------- // // -- Shared Memory ------------------------------------------------- //
groupshared uint iMinDepth = UINT_MAX, groupshared uint iMinDepth, iMaxDepth;
iMaxDepth = 0; groupshared uint numVisiblePointLights,
groupshared uint numVisiblePointLights = 0,
visiblePointlightIndex[MAXLIGHTS]; visiblePointlightIndex[MAXLIGHTS];
// ------------------------------------------------------------------ // // ------------------------------------------------------------------ //
@ -29,77 +27,110 @@ groupshared uint numVisiblePointLights = 0,
[numthreads(BLOCKSIZE, BLOCKSIZE, 1)] [numthreads(BLOCKSIZE, BLOCKSIZE, 1)]
void main( uint3 DTid : SV_DispatchThreadID, uint3 GTid : SV_GroupThreadID, uint3 Gid : SV_GroupID, uint GI : SV_GroupIndex ) 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.x = UV.x * 2 - 1;
UV.y = 1 - 2 * UV.y; UV.y = 1 - 2 * UV.y;
float3 posN = float3(UV, DepthTexture[DTid.xy].x); float3 posN = float3(UV, DepthTexture[DTid.xy].x);
// store and load shared minDepth and maxDepth float3 ViewPos = ToVpos(DTid.xy, UV);
float minDepth = 0.0f, maxDepth = 0.0f,
depth = posN.z; if(GI==0)
{ {
uint uidepth = (uint)( depth * EXPAND); numVisiblePointLights = 0;
InterlockedMin( iMinDepth, uidepth ); iMinDepth = 0x7F7FFFFF;
InterlockedMax( iMaxDepth, uidepth ); iMaxDepth = 0;
}
GroupMemoryBarrierWithGroupSync();
// store and load shared minDepth and maxDepth
float minDepth = 0.0f, maxDepth = 0.0f;
{
InterlockedMin( iMinDepth, asuint(ViewPos.z) );
InterlockedMax( iMaxDepth, asuint(ViewPos.z) );
GroupMemoryBarrierWithGroupSync(); GroupMemoryBarrierWithGroupSync();
minDepth = (float)( iMinDepth ) * SHRINK; minDepth = asfloat(iMinDepth);
maxDepth = (float)( iMaxDepth ) * SHRINK; maxDepth = asfloat(iMaxDepth);
} }
// -- Switching to LightCulling ------------------------------------- // // -- Switching to LightCulling ------------------------------------- //
//define collision volume //define collision volume
float2 size = BLOCKSIZE / Pixels; float2 tilescale = float2(Diffuse.Length.xy) * rcp(float(2 * BLOCKSIZE));
FrustrumPoints tile; float2 tilebias = tilescale - float2(Gid.xy);
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);
// 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 ) // culling the tile's near and far to minDepth & maxDepth ( with tolerance )
uint numPass = (Lights + NUMTHREADS - 1) / NUMTHREADS; for(uint lightIndex = GI; lightIndex < Lights; lightIndex += NUMTHREADS)
numPass = min( numPass, MAXLIGHTS / NUMTHREADS ); {
PointLight pl = Points[lightIndex];
for( uint passI = 0; passI < numPass; ++passI ) 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);
[branch]
if(inFrustrum)
{ {
uint lightIndex = (passI * NUMTHREADS) + GI; uint offset;
lightIndex = min( lightIndex, Lights ); InterlockedAdd( numVisiblePointLights, 1, offset );
visiblePointlightIndex[offset] = lightIndex;
if( lightIndex < Lights )
if( intersects(tile, lightIndex) )
{
uint offset;
InterlockedAdd( numVisiblePointLights, 1, offset );
visiblePointlightIndex[offset] = lightIndex;
}
} }
}
GroupMemoryBarrierWithGroupSync(); GroupMemoryBarrierWithGroupSync();
float3 ViewPos = ToVpos(DTid.xy, UV);
DiffSpec Shaded; DiffSpec Shaded;
Shaded.Diffuse = float3(0,0,0); Shaded.Diffuse = float3(0,0,0);
Shaded.Specular = 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.Diffuse += light.Diffuse;
Shaded.Specular += light.Specular; 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); 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; DiffBase = DiffBase / 4;
float4 DepthBase = DepthTexture[DTid.xy]; float4 DepthBase = DepthTexture[DTid.xy];
DepthBase = DepthTexture[DTid.xy + uint2(1,0)]; DepthBase += DepthTexture[DTid.xy + uint2(1,0)];
DepthBase = DepthTexture[DTid.xy + uint2(0,1)]; DepthBase += DepthTexture[DTid.xy + uint2(0,1)];
DepthBase = DepthTexture[DTid.xy + uint2(1,1)]; DepthBase += DepthTexture[DTid.xy + uint2(1,1)];
DepthBase = DepthBase /4; DepthBase = DepthBase /4;
Ambient[DTid.xy/2] = float4(DiffBase.xyz, AmbValue); Ambient[DTid.xy/2] = float4(DiffBase.xyz , AmbValue);
Ambient[DTid.xy/2 + float2(Pixels.x/2, 0)] = GUI[DTid.xy]; //Ambient[DTid.xy/2] = float4(DiffBase.xyz, 1);
Ambient[DTid.xy/2 + float2(0, Pixels.y/2)] = float4(DiffBase.xyz * DiffBase.w ,DiffBase.w); Ambient[DTid.xy/2 + float2(Diffuse.Length.x/2, 0)] = GUI[DTid.xy];
Ambient[DTid.xy/2 + Pixels/2] = float4(NormalSpec[DTid.xy].xyz * float3(1,1,-1),1); 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);
} }
} }

View File

@ -23,6 +23,7 @@ float GetSSAO(float3 pos, float2 uv, int2 texCoord2, uint2 rndID)
float3 sampled = mul(tbn, SSAOKernel[i].xyz); float3 sampled = mul(tbn, SSAOKernel[i].xyz);
sampled = sampled * Radius + pos; sampled = sampled * Radius + pos;
//project sample to get uv.xy //project sample to get uv.xy
float4 ProjOffset = float4(sampled,1); float4 ProjOffset = float4(sampled,1);
ProjOffset = mul(Proj, ProjOffset); 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 // get depth from that point in screenspace
uint2 texCoord; uint2 texCoord;
texCoord = (uint2)(offset.xy * Pixels); texCoord = (uint2)(offset.xy * Diffuse.Length.xy);
float3 ViewPos = ToVpos(texCoord, UV); float3 ViewPos = ToVpos(texCoord, UV);
float sampleDepth = ViewPos.z; float sampleDepth = ViewPos.z;
@ -43,6 +44,8 @@ float GetSSAO(float3 pos, float2 uv, int2 texCoord2, uint2 rndID)
//compare to depth from sample //compare to depth from sample
float rangeCheck = (abs(pos.z - sampleDepth) > Radius) ? 1.0f : 0.0f; float rangeCheck = (abs(pos.z - sampleDepth) > Radius) ? 1.0f : 0.0f;
occlusion += (sampleDepth <= sampled.z ? 1.0f : 0.0f) * rangeCheck; occlusion += (sampleDepth <= sampled.z ? 1.0f : 0.0f) * rangeCheck;
//occlusion += rangeCheck;
} }
occlusion /= (float)(SSAOKernel.Length.x); occlusion /= (float)(SSAOKernel.Length.x);
occlusion = 1.0f - occlusion; occlusion = 1.0f - occlusion;

View File

@ -27,7 +27,7 @@ void main( uint3 DTid : SV_DispatchThreadID )
SSAO = SSAO / 16; 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; float3 Amb = Ambient[DTid.xy/2].xyz * SSAO * Color;
float4 Glow = Ambient[DTid.xy/2 + uint2(0,Output.Length.y/2)]; 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] = float4(Ambient[DTid.xy/2 + uint2(Output.Length*0.5f)].xyz,1);
//Output[DTid.xy] = SSAO * float4(1,1,1,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];
} }