path tracing volumetric cloud fix

This commit is contained in:
Turánszki János
2026-02-11 17:26:35 +01:00
parent c2bcd5f879
commit b0cc4bdf58
5 changed files with 25 additions and 27 deletions
+3 -2
View File
@@ -141,15 +141,16 @@ void main(uint3 DTid : SV_DispatchThreadID, uint groupIndex : SV_GroupIndex)
if (exit_sky)
{
float3 envColor;
bool clouds_enabled = bounce > 0;
[branch]
if (IsStaticSky())
{
// We have envmap information in a texture:
envColor = GetStaticSkyColor(ray.Direction);
envColor = GetStaticSkyColor(ray.Direction, clouds_enabled);
}
else
{
envColor = GetDynamicSkyColor(ray.Direction);
envColor = GetDynamicSkyColor(ray.Direction, true, false, false, false, false, false, clouds_enabled);
}
result += max(0, energy * envColor);
break;
+2 -2
View File
@@ -155,9 +155,9 @@ float3 GetDynamicSkyColor(in float2 pixel, in float3 V, bool sun_enabled = true,
return sky;
}
float3 GetDynamicSkyColor(in float3 V, bool sun_enabled = true, bool dark_enabled = false, bool stationary = false)
float3 GetDynamicSkyColor(in float3 V, bool sun_enabled = true, bool dark_enabled = false, bool stationary = false, bool highQuality = false, bool perPixelNoise = false, bool receiveShadow = false, bool clouds_enabled = true)
{
return GetDynamicSkyColor(float2(0.0f, 0.0f), V, sun_enabled, dark_enabled, stationary, false, false, false, true);
return GetDynamicSkyColor(float2(0.0f, 0.0f), V, sun_enabled, dark_enabled, stationary, highQuality, perPixelNoise, receiveShadow, clouds_enabled);
}
float3 GetStaticSkyColor(in float3 V, bool clouds_enabled = true)
+5 -9
View File
@@ -851,25 +851,21 @@ namespace wi::graphics
int allocate()
{
locker.lock();
std::scoped_lock lck(locker);
if (!freelist.empty())
{
int index = freelist.back();
freelist.pop_back();
locker.unlock();
return index;
}
locker.unlock();
return -1;
}
void free(int index)
{
if (index >= 0)
{
locker.lock();
freelist.push_back(index);
locker.unlock();
}
if (index < 0)
return;
std::scoped_lock lck(locker);
freelist.push_back(index);
}
};
BindlessDescriptorHeap bindlessSampledImages;
+14 -13
View File
@@ -433,6 +433,20 @@ namespace wi
wi::renderer::DrawShadowmaps(visibility_main, cmd);
}
if (scene->weather.IsVolumetricClouds())
{
wi::renderer::Postprocess_VolumetricClouds(
volumetriccloudResources,
cmd,
*camera,
camera_previous,
camera_reflection,
false,
scene->weather.volumetricCloudsWeatherMapFirst.IsValid() ? &scene->weather.volumetricCloudsWeatherMapFirst.GetTexture() : nullptr,
scene->weather.volumetricCloudsWeatherMapSecond.IsValid() ? &scene->weather.volumetricCloudsWeatherMapSecond.GetTexture() : nullptr
);
}
});
if (scene->terrains.GetCount() > 0)
@@ -489,19 +503,6 @@ namespace wi
cmd
);
}
if (scene->weather.IsVolumetricClouds())
{
wi::renderer::Postprocess_VolumetricClouds(
volumetriccloudResources,
cmd,
*camera,
camera_previous,
camera_reflection,
false,
scene->weather.volumetricCloudsWeatherMapFirst.IsValid() ? &scene->weather.volumetricCloudsWeatherMapFirst.GetTexture() : nullptr,
scene->weather.volumetricCloudsWeatherMapSecond.IsValid() ? &scene->weather.volumetricCloudsWeatherMapSecond.GetTexture() : nullptr
);
}
RenderVolumetrics(cmd);
+1 -1
View File
@@ -9,7 +9,7 @@ namespace wi::version
// minor features, major updates, breaking compatibility changes
const int minor = 72;
// minor bug fixes, alterations, refactors, updates
const int revision = 33;
const int revision = 34;
const std::string version_string = std::to_string(major) + "." + std::to_string(minor) + "." + std::to_string(revision);