Soften SDF cloud edge extinction
This commit is contained in:
parent
e57dc3ece6
commit
6758519cd6
5 changed files with 15 additions and 8 deletions
|
|
@ -115,6 +115,8 @@ Current prototype traits:
|
|||
- stable world/Grid-space placement
|
||||
- distance-guided empty-space stepping
|
||||
- procedural erosion/noise inside each field
|
||||
- feathered interior density, without positive-distance absorbing shells around
|
||||
the ellipsoid boundary
|
||||
- Self-lit scattering and simple forward/back phase shaping
|
||||
- no skybox/paraboloid assumption
|
||||
- no sparse brick storage yet
|
||||
|
|
|
|||
|
|
@ -330,7 +330,7 @@ float cloudDensity(float3 p, int index, out float3 tint)
|
|||
cloudFieldInfo(index, center, radius, tint, densityScale);
|
||||
|
||||
float distanceToCloud = cloudFieldSdf(p, index);
|
||||
float boundary = 1.0 - smoothstep(-0.18, 0.72, distanceToCloud);
|
||||
float boundary = smoothstep(0.18, -0.54, distanceToCloud);
|
||||
if (boundary <= 0.0)
|
||||
{
|
||||
return 0.0;
|
||||
|
|
@ -340,10 +340,10 @@ float cloudDensity(float3 p, int index, out float3 tint)
|
|||
float3 wind = float3(0.035, -0.018, 0.011) * timeSeconds;
|
||||
float broad = fbm3(local * 1.45 + wind + index * 7.1) * 0.5 + 0.5;
|
||||
float fine = fbm3(local * 4.6 + wind.yzx * 2.0 + index * 11.3) * 0.5 + 0.5;
|
||||
float erosion = saturate(broad * 0.78 + fine * 0.32);
|
||||
float softCore = smoothstep(0.26, 0.76, erosion);
|
||||
float edgeVeil = smoothstep(0.72, -0.18, abs(distanceToCloud));
|
||||
return boundary * lerp(0.34, 1.0, softCore) * (0.72 + edgeVeil * 0.28) * densityScale;
|
||||
float erosion = saturate(broad * 0.72 + fine * 0.38);
|
||||
float softCore = smoothstep(0.42, 0.86, erosion);
|
||||
float featheredShell = boundary * boundary;
|
||||
return featheredShell * softCore * densityScale;
|
||||
}
|
||||
|
||||
float nearestCloudDistance(float3 p)
|
||||
|
|
@ -381,11 +381,11 @@ void sampleCloudMedium(float3 p, float3 rayDirection, out float density, out flo
|
|||
float3 ambientField = lerp(float3(0.02, 0.08, 0.10), tint * 0.22, heightGlow);
|
||||
float silver = forwardPhase * 0.72 + backPhase * 0.24;
|
||||
scattering += fieldDensity * (ambientField + lightColor * (0.18 + silver));
|
||||
density += fieldDensity;
|
||||
density += fieldDensity * 0.62;
|
||||
}
|
||||
}
|
||||
|
||||
density = saturate(density);
|
||||
density = min(density, 1.0);
|
||||
}
|
||||
|
||||
void integrateCloudFields(float3 rayOrigin, float3 rayDirection, float maxTravel, out float3 cloudScattering, out float cloudTransmittance)
|
||||
|
|
@ -415,7 +415,7 @@ void integrateCloudFields(float3 rayOrigin, float3 rayDirection, float maxTravel
|
|||
|
||||
if (density > 0.001)
|
||||
{
|
||||
float extinction = density * 1.35;
|
||||
float extinction = density * 0.58;
|
||||
float segmentTransmittance = exp(-extinction * stepLength);
|
||||
cloudScattering += cloudTransmittance * scattering * (1.0 - segmentTransmittance) / max(extinction, 0.001);
|
||||
cloudTransmittance *= segmentTransmittance;
|
||||
|
|
|
|||
|
|
@ -10,3 +10,4 @@
|
|||
{"area":"research/volumetrics","lesson":"Do not treat slide decks or presenter notes as transcripts. yt-dlp subtitle pulls for Dreams and GPUOpen sparse SDF materially changed the distilled lesson: Dreams preserved the evaluator/field into a painterly splat renderer after SDF, brick, hybrid transparency, and froxel-lighting attempts failed; Brixelizer is primarily an update/integration system with caps and debug tracing, not just an SDF sampler.","source":"research/volumetrics/transcript-addendum.md","ts":"2026-05-08"}
|
||||
{"area":"research/volumetrics","lesson":"Sea of Thieves clouds provide a stylized counterexample to dense cloud raymarching: Rare used authored opaque polygonal cloud geometry, low-res blurred color/depth compositing, approximate world-position reconstruction, noise/distortion, synchronized wrapped wind offsets, and pressure zones so clouds could be readable world/event objects like skulls, ships, and storms. For Aquarium, symbolic weather/field omens may want geometry/field silhouettes plus cloudy compositing before volumetric traversal.","source":"research/volumetrics/transcript-addendum.md","ts":"2026-05-08"}
|
||||
{"area":"renderer/sdf-fields","lesson":"Documented the SDF field renderer plan and started a local SDF cloud prototype. Aquarium/Aetheria clouds are local world media that may be above, below, around, or enclosing the camera, so the core cloud architecture must not rely on skybox, hemisphere, paraboloid, or far-only assumptions. First implementation integrates four bounded analytic SDF cloud media along the camera ray before surface composition.","files":["docs/sdf-field-renderer-plan.md","docs/hlsl-renderer.md","src/Aquarium.Engine/Render/Shaders/Aquarium.hlsl","state/map.yaml","state/memory.json","state/scratch.md"],"verification":["dotnet build Aquarium.Engine.slnx",".\\scripts\\dev-reload.ps1 -Headless -RetainSlots 4"],"ts":"2026-05-08"}
|
||||
{"area":"renderer/sdf-fields","lesson":"The first SDF cloud transfer function made nearer ellipsoid edges occlude farther clouds because the SDF boundary produced a positive-distance absorbing veil and too much extinction. Cloud SDFs should provide sculptural containment and empty-space skipping, while density should be eroded interior occupancy with feathered boundaries and low extinction until a real volume pass owns the transfer function.","files":["src/Aquarium.Engine/Render/Shaders/Aquarium.hlsl","docs/hlsl-renderer.md","state/memory.json","state/scratch.md"],"verification":["dotnet build Aquarium.Engine.slnx",".\\scripts\\dev-reload.ps1 -Headless -RetainSlots 4"],"ts":"2026-05-08"}
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@
|
|||
"For research decks with recordings, pull subtitles/transcripts before distilling. The Dreams transcript changed the lesson: preserve the evaluator/field that serves the image, not the elegant SDF/brick/froxel experiment that drifted away from the art direction.",
|
||||
"Sea of Thieves clouds are the stylized counterexample: authored opaque cloud geometry filtered through low-res blurred color/depth compositing can beat dense raymarching when clouds are symbolic world objects or gameplay signage. Consider tool-time SDF baking for per-vertex cloud lighting, not runtime volume traversal by reflex.",
|
||||
"The SDF field renderer plan is docs/sdf-field-renderer-plan.md: solids and clouds should share one field grammar, with distance, density, material, medium, bounds, and debug views.",
|
||||
"SDF cloud distance should shape and accelerate the medium, not create a positive-distance absorbing shell. Prototype ellipsoid edges occluded farther clouds until density was changed to eroded interior occupancy with lower extinction.",
|
||||
"Bruneton-style atmospheric scattering is the later sky/planet solution, not the first Grid fog pass. Use LUTs, explicit texture mappings, and unit-tested physical terms when Aquarium reaches ground-to-space atmosphere.",
|
||||
"GigaVoxels-style ray-guided sparse bricks are only for large sparse field/world storage. Do not turn early fog into a monolithic persistent volume cache."
|
||||
],
|
||||
|
|
|
|||
|
|
@ -21,3 +21,6 @@ prototype integrated along the camera ray before surface composition.
|
|||
- Current cloud prototype is deliberately not the final volume pass. Next
|
||||
renderer steps: debug views, field instance contract, then explicit local
|
||||
volume/froxel pass.
|
||||
- First artifact found: near ellipsoid edges can occlude farther clouds if the
|
||||
SDF boundary emits a positive-distance absorbing veil. Keep density inside the
|
||||
sculpted container, eroded, feathered, and low-extinction.
|
||||
|
|
|
|||
Loading…
Reference in a new issue