mirror of
https://bitbucket.org/CPMADevs/cnq3
synced 2025-02-23 20:31:25 +00:00
fixed crp_volLight 0 effectively disabling r_dynamicLight
This commit is contained in:
parent
c85ad330b3
commit
b076ff8e8a
2 changed files with 12 additions and 5 deletions
|
@ -41,6 +41,7 @@ struct DenoiseRC
|
||||||
{
|
{
|
||||||
vec3_t lightPosition;
|
vec3_t lightPosition;
|
||||||
uint32_t textureIndex;
|
uint32_t textureIndex;
|
||||||
|
uint32_t vshadowValid;
|
||||||
uint32_t vshadowTextureIndex;
|
uint32_t vshadowTextureIndex;
|
||||||
uint32_t vshadowSamplerIndex;
|
uint32_t vshadowSamplerIndex;
|
||||||
float vshadowWorldScale;
|
float vshadowWorldScale;
|
||||||
|
@ -129,6 +130,7 @@ void DynamicLights::DrawPointLight(const dlight_t& light)
|
||||||
DenoiseRC rc = {};
|
DenoiseRC rc = {};
|
||||||
VectorCopy(light.origin, rc.lightPosition);
|
VectorCopy(light.origin, rc.lightPosition);
|
||||||
rc.textureIndex = GetTextureIndexSRV(crp.sunlightTexture);
|
rc.textureIndex = GetTextureIndexSRV(crp.sunlightTexture);
|
||||||
|
rc.vshadowValid = crp_volLight->integer != 0 ? 1 : 0;
|
||||||
rc.vshadowTextureIndex = GetTextureIndexSRV(crp.volumetricLight.pointShadowTexture);
|
rc.vshadowTextureIndex = GetTextureIndexSRV(crp.volumetricLight.pointShadowTexture);
|
||||||
rc.vshadowSamplerIndex = GetSamplerIndex(TW_CLAMP_TO_EDGE, TextureFilter::Linear);
|
rc.vshadowSamplerIndex = GetSamplerIndex(TW_CLAMP_TO_EDGE, TextureFilter::Linear);
|
||||||
rc.vshadowWorldScale = crp.volumetricLight.pointShadowVolumeScale;
|
rc.vshadowWorldScale = crp.volumetricLight.pointShadowVolumeScale;
|
||||||
|
|
|
@ -30,6 +30,7 @@ cbuffer RootConstants
|
||||||
{
|
{
|
||||||
float3 lightPosition;
|
float3 lightPosition;
|
||||||
uint textureIndex;
|
uint textureIndex;
|
||||||
|
uint vshadowValid;
|
||||||
uint vshadowTextureIndex;
|
uint vshadowTextureIndex;
|
||||||
uint vshadowSamplerIndex;
|
uint vshadowSamplerIndex;
|
||||||
float vshadowWorldScale;
|
float vshadowWorldScale;
|
||||||
|
@ -40,8 +41,6 @@ float4 ps(VOut input) : SV_Target
|
||||||
SceneView scene = GetSceneView();
|
SceneView scene = GetSceneView();
|
||||||
Texture2D shadingPositionTexture = ResourceDescriptorHeap[scene.shadingPositionTextureIndex];
|
Texture2D shadingPositionTexture = ResourceDescriptorHeap[scene.shadingPositionTextureIndex];
|
||||||
Texture2D texture0 = ResourceDescriptorHeap[textureIndex];
|
Texture2D texture0 = ResourceDescriptorHeap[textureIndex];
|
||||||
Texture3D<float> vshadowTexture = ResourceDescriptorHeap[vshadowTextureIndex];
|
|
||||||
SamplerState vshadowSampler = SamplerDescriptorHeap[vshadowSamplerIndex];
|
|
||||||
int2 textureMax = GetTextureSize(texture0) - int2(1, 1);
|
int2 textureMax = GetTextureSize(texture0) - int2(1, 1);
|
||||||
|
|
||||||
int2 tcFrag = int2(input.position.xy);
|
int2 tcFrag = int2(input.position.xy);
|
||||||
|
@ -94,9 +93,15 @@ float4 ps(VOut input) : SV_Target
|
||||||
accum /= weightSum;
|
accum /= weightSum;
|
||||||
}
|
}
|
||||||
|
|
||||||
float3 vshadowTC = AABoxWorldSpaceToTC(positionFrag, lightPosition, GetTextureSize(vshadowTexture), vshadowWorldScale);
|
// only apply the volumetric shadow map when volumetric lighting is enabled
|
||||||
float transmittance = vshadowTexture.SampleLevel(vshadowSampler, vshadowTC, 0);
|
if(vshadowValid != 0u)
|
||||||
accum *= transmittance;
|
{
|
||||||
|
Texture3D<float> vshadowTexture = ResourceDescriptorHeap[vshadowTextureIndex];
|
||||||
|
SamplerState vshadowSampler = SamplerDescriptorHeap[vshadowSamplerIndex];
|
||||||
|
float3 vshadowTC = AABoxWorldSpaceToTC(positionFrag, lightPosition, GetTextureSize(vshadowTexture), vshadowWorldScale);
|
||||||
|
float transmittance = vshadowTexture.SampleLevel(vshadowSampler, vshadowTC, 0);
|
||||||
|
accum *= transmittance;
|
||||||
|
}
|
||||||
|
|
||||||
float4 result = float4(accum, 0);
|
float4 result = float4(accum, 0);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue