mirror of
https://mirror.ghproxy.com/https://github.com/dexyfex/CodeWalker
synced 2026-05-15 01:15:11 +08:00
HD lights rendering in interiors
This commit is contained in:
@@ -1,9 +1,6 @@
|
||||
#include "LightPS.hlsli"
|
||||
|
||||
|
||||
//currently unused - TODO: implement individual HD lights here
|
||||
|
||||
|
||||
Texture2D DepthTex : register(t0);
|
||||
Texture2D DiffuseTex : register(t2);
|
||||
Texture2D NormalTex : register(t3);
|
||||
@@ -14,11 +11,10 @@ struct VS_Output
|
||||
{
|
||||
float4 Pos : SV_POSITION;
|
||||
float4 Screen : TEXCOORD0;
|
||||
uint IID : SV_INSTANCEID;
|
||||
};
|
||||
|
||||
|
||||
PS_OUTPUT main(VS_Output input)
|
||||
float4 main(VS_Output input) : SV_TARGET
|
||||
{
|
||||
uint3 ssloc = uint3(input.Pos.xy, 0); //pixel location
|
||||
float depth = DepthTex.Load(ssloc).r;
|
||||
@@ -29,39 +25,14 @@ PS_OUTPUT main(VS_Output input)
|
||||
float4 specular = SpecularTex.Load(ssloc);
|
||||
float4 irradiance = IrradianceTex.Load(ssloc);
|
||||
|
||||
|
||||
PS_OUTPUT output;
|
||||
output.Depth = input.Pos.z;
|
||||
|
||||
switch (RenderMode)
|
||||
{
|
||||
case 5: output.Colour = float4(diffuse.rgb, 1); return output;
|
||||
case 6: output.Colour = float4(normal.rgb, 1); return output;
|
||||
case 7: output.Colour = float4(specular.rgb, 1); return output;
|
||||
}
|
||||
|
||||
|
||||
float4 spos = float4(input.Screen.xy/input.Screen.w, depth, 1);
|
||||
float4 cpos = mul(spos, ViewProjInv);
|
||||
float3 camRel = cpos.xyz * (1/cpos.w);
|
||||
float3 norm = normal.xyz * 2 - 1;
|
||||
|
||||
|
||||
if (LightType == 0) //directional light
|
||||
{
|
||||
float3 c = DeferredDirectionalLight(camRel, norm, diffuse, specular, irradiance);
|
||||
|
||||
PS_OUTPUT output;
|
||||
output.Colour = float4(c, 1);
|
||||
output.Depth = depth;
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
float4 lcol = DeferredLODLight(camRel, norm, diffuse, specular, irradiance, input.IID);
|
||||
float4 lcol = DeferredLight(camRel, norm, diffuse, specular, irradiance);
|
||||
if (lcol.a <= 0) discard;
|
||||
|
||||
output.Colour = lcol;
|
||||
return output;
|
||||
return lcol;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user