Skip to content

Commit

Permalink
match DSR ghost shaders
Browse files Browse the repository at this point in the history
  • Loading branch information
AltimorTASDK committed Oct 16, 2023
1 parent 01b8f41 commit d5357ee
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
8 changes: 8 additions & 0 deletions source/FRPG_FlverPBL/FRPG_Common_ForwardPBL.fxh
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,20 @@ StructuredBuffer<s_lightParams> lightParamBuffer : register(t18);

float3 Srgb2linear(float3 c)
{
#ifdef WITH_GhostMap
return pow(max(float3(0, 0, 0), c), float3(2.2, 2.2, 2.2));
#else
return pow(abs(c), float3(2.2, 2.2, 2.2));
#endif
}

float3 Linear2srgb(float3 c)
{
#ifdef WITH_GhostMap
return pow(max(float3(0, 0, 0), c), float3(1 / 2.2, 1 / 2.2, 1 / 2.2));
#else
return pow(abs(c), float3(1 / 2.2, 1 / 2.2, 1 / 2.2));
#endif
}

float4 Srgb2linear(float4 c)
Expand Down
15 changes: 8 additions & 7 deletions source/FRPG_FlverPBL/FRPG_FS_HemEnv.fx
Original file line number Diff line number Diff line change
Expand Up @@ -225,13 +225,14 @@ GBUFFER_OUT FragmentMain(VTX_OUT In)

{//Ghost lights
#ifdef WITH_GhostMap
const float4 vecPnt = CalcGetGhostLightVec(In.VtxWld.xyz); //Calculate and obtain the direction and damping coefficient of ghost light
const float3 colPnt = gFC_GhostLightCol.rgb * vecPnt.w; //Attenuate point light source color
pointLightComponent += CalcGetGhostLightDifLightCol(Mtl.Normal, vecPnt.xyz, colPnt.rgb); //Diffuse

#ifdef WITH_SpecularMap
pointLightComponent += CalcGetGhostLightSpcLightCol(Mtl.Normal, gFC_SpcParam, vecPnt.xyz, colPnt.rgb); //Specular
#endif
float3 L = gFC_GhostLightPos.xyz - In.VtxWld.xyz;
float distL = length(L);

pointLightComponent += PointLightContribution(
Mtl.Normal, vertexNormal, L / distL, In.VecEye.xyz,
Mtl.DiffuseColor, Mtl.SpecularColor, specularF90,
Mtl.Roughness, gFC_GhostLightCol.rgb, distL,
gFC_GhostLightPos.w, gFC_GhostLightCol.w, 0);
#endif // WITH_GhostMap
}

Expand Down

0 comments on commit d5357ee

Please sign in to comment.