Global Tint

This commit is contained in:
lanariel 2014-02-20 15:15:54 +01:00
parent 8f3eb586c6
commit a3c4099111
8 changed files with 20 additions and 7 deletions

View File

@ -89,7 +89,9 @@ bool GameState::Init( SharedStateContent &shared )
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, 0.1f, 1000.0f );
Graphics::API::SetProjection( this->privData->camera.GetProjectionMatrix() ); Graphics::API::SetProjection( this->privData->camera.GetProjectionMatrix() );
gfxOp.AmbientValue = 1.0f; gfxOp.AmbientValue = 0.5f;
gfxOp.GlobalGlowTint = Math::Float3(2,1,1);
gfxOp.GlobalTint = Math::Float3(1,1,1);
Graphics::API::SetOptions(gfxOp); Graphics::API::SetOptions(gfxOp);
//tell server ready //tell server ready

View File

@ -62,6 +62,9 @@ namespace Oyster
struct PostData struct PostData
{ {
float Amb; float Amb;
Math::Float3 Tint;
Math::Float3 GlowTint;
float PAD;
}; };
struct Text2D struct Text2D

View File

@ -123,6 +123,8 @@ namespace Oyster
Definitions::PostData pd; Definitions::PostData pd;
pd.Amb = option.AmbientValue; pd.Amb = option.AmbientValue;
pd.Tint = option.GlobalTint;
pd.GlowTint = option.GlobalGlowTint;
void* data = Render::Resources::Post::Data.Map(); void* data = Render::Resources::Post::Data.Map();
memcpy(data,&pd,sizeof(Definitions::PostData)); memcpy(data,&pd,sizeof(Definitions::PostData));

View File

@ -30,6 +30,9 @@ namespace Oyster
//between 0-1 //between 0-1
float AmbientValue; float AmbientValue;
Math::Float3 GlobalTint;
Math::Float3 GlobalGlowTint;
Math::Float2 Resolution; Math::Float2 Resolution;
//Bytes on the GPU //Bytes on the GPU

View File

@ -41,8 +41,8 @@ PixelOut main(VertexOut input)
{ {
PixelOut output; PixelOut output;
float4 DiffGlow = Diffuse.Sample(S1, input.UV); float4 DiffGlow = Diffuse.Sample(S1, input.UV);
float3 tint = Color*(1-DiffGlow) + GlowColor * DiffGlow; float3 tint = Color*(1-DiffGlow.w) + GlowColor * DiffGlow.w;
tint = tint / 2; tint = Color*(1-DiffGlow.w) + GlowColor * DiffGlow.w;
output.DiffuseGlow = DiffGlow * float4(tint,1); output.DiffuseGlow = DiffGlow * float4(tint,1);
//NORMALIZE //NORMALIZE

View File

@ -47,7 +47,7 @@ void main( uint3 DTid : SV_DispatchThreadID, uint3 GTid : SV_GroupThreadID )
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 + float2(Pixels.x/2, 0)] = GUI[DTid.xy];
Ambient[DTid.xy/2 + float2(0, Pixels.y/2)] = float4(DiffBase.xyz * DiffBase.w * 10 /* * (2-DepthBase) */,1); Ambient[DTid.xy/2 + float2(0, Pixels.y/2)] = float4(DiffBase.xyz * DiffBase.w /* * (2-DepthBase) */,DiffBase.w);
Ambient[DTid.xy/2 + Pixels/2] = float4(NormalSpec[DTid.xy].xyz * float3(1,1,-1),1); Ambient[DTid.xy/2 + Pixels/2] = float4(NormalSpec[DTid.xy].xyz * float3(1,1,-1),1);
} }

View File

@ -1,7 +1,7 @@
#include "Defines.hlsli" #include "Defines.hlsli"
#include "PosManipulation.hlsli" #include "PosManipulation.hlsli"
static float Radius = 10; static float Radius = 1;
float GetSSAO(float3 pos, float2 uv, int2 texCoord2, uint2 rndID) float GetSSAO(float3 pos, float2 uv, int2 texCoord2, uint2 rndID)
{ {

View File

@ -9,6 +9,8 @@ SamplerState S1 : register(s0);
cbuffer Size : register(b0) cbuffer Size : register(b0)
{ {
float AmbFactor; float AmbFactor;
float3 Color;
float3 GlowColor;
} }
[numthreads(16, 16, 1)] [numthreads(16, 16, 1)]
@ -26,9 +28,10 @@ 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; float3 Amb = Ambient[DTid.xy/2].xyz * SSAO * Color;
float3 Glow = Ambient[DTid.xy/2 + uint2(0,Output.Length.y/2)].xyz; float4 Glow = Ambient[DTid.xy/2 + uint2(0,Output.Length.y/2)];
Glow = float4(Glow.xyz * GlowColor, 1);
float4 GUI; float4 GUI;
uint2 index = DTid.xy/2 + uint2((uint)Output.Length.x/(uint)2,0); uint2 index = DTid.xy/2 + uint2((uint)Output.Length.x/(uint)2,0);