Skip to content
Snippets Groups Projects

Resolve "Voxel cone tracing"

Merged Ghost User requested to merge 82-voxel-cone-tracing into develop
2 files
+ 36
5
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -32,6 +32,13 @@ layout(set=0, binding=6) uniform VoxelInfoBuffer{
VoxelInfo voxelInfo;
};
layout(set=0, binding=7) uniform VolumetricSettings {
vec3 scatteringCoefficient;
float volumetricAmbientLight;
vec3 absorptionCoefficient;
};
vec3 cookTorrance(vec3 f0, float r, vec3 N, vec3 V, vec3 L){
vec3 H = normalize(L + V);
@@ -78,10 +85,7 @@ vec3 volumetricLighting(vec3 colorIn, vec3 V, vec3 pos, float d){
int sampleCount = 48;
float stepSize = d / sampleCount;
vec3 scatteringCoefficient = vec3(0.005);
vec3 absorptionCoefficient = vec3(0.01);
vec3 extinctionCoefficient = scatteringCoefficient + absorptionCoefficient;
vec3 ambientLight = vec3(0.2);
float noiseScale = 0.1;
pos += V * noiseScale * interleavedGradientNoise(gl_FragCoord.xy);
@@ -92,7 +96,7 @@ vec3 volumetricLighting(vec3 colorIn, vec3 V, vec3 pos, float d){
vec3 light = lightInfo.sunColor * lightInfo.sunStrength;
float shadow = shadowTest(samplePoint, lightInfo, shadowMap, shadowMapSampler, vec2(0));
light *= shadow;
light += ambientLight;
light += volumetricAmbientLight;
color += phase * light * scatteringCoefficient * stepSize;
color *= exp(-stepSize * extinctionCoefficient);
Loading