Skip to content
Snippets Groups Projects
Commit f0854698 authored by Alexander Gauggel's avatar Alexander Gauggel
Browse files

[#82] Fix reflection cone angle

parent e9c8097c
No related branches found
No related tags found
1 merge request!70Resolve "Voxel cone tracing"
Pipeline #25922 passed
...@@ -46,8 +46,8 @@ vec3 cookTorrance(vec3 f0, float r, vec3 N, vec3 V, vec3 L){ ...@@ -46,8 +46,8 @@ vec3 cookTorrance(vec3 f0, float r, vec3 N, vec3 V, vec3 L){
return (F * D * G) / max(4 * NoV * NoL, 0.000001); return (F * D * G) / max(4 * NoV * NoL, 0.000001);
} }
float roughnessToConeAngle(float r){ float roughnessToConeAngleDegree(float r){
return mix(degreeToRadian(20), degreeToRadian(90), r); return mix(degreeToRadian(3), degreeToRadian(60), r);
} }
// from: "Next Generation Post Processing in Call Of Duty Advanced Warfare" slide page 123 // from: "Next Generation Post Processing in Call Of Duty Advanced Warfare" slide page 123
...@@ -99,7 +99,7 @@ void main() { ...@@ -99,7 +99,7 @@ void main() {
vec3 diffuseTrace = diffuseVoxelTraceHemisphere(toSurface, passPos, voxelTexture, voxelSampler, voxelInfo); vec3 diffuseTrace = diffuseVoxelTraceHemisphere(toSurface, passPos, voxelTexture, voxelSampler, voxelInfo);
vec3 R = reflect(-V, N); vec3 R = reflect(-V, N);
float reflectionConeAngle = degreeToRadian(roughnessToConeAngle(r)); float reflectionConeAngle = roughnessToConeAngleDegree(r);
vec3 offsetTraceStart = passPos + N_geo * 0.1f; vec3 offsetTraceStart = passPos + N_geo * 0.1f;
offsetTraceStart += R * interleavedGradientNoise(gl_FragCoord.xy) * 0.5; offsetTraceStart += R * interleavedGradientNoise(gl_FragCoord.xy) * 0.5;
vec3 specularTrace = voxelConeTrace(R, offsetTraceStart, reflectionConeAngle, voxelTexture, voxelSampler, voxelInfo); vec3 specularTrace = voxelConeTrace(R, offsetTraceStart, reflectionConeAngle, voxelTexture, voxelSampler, voxelInfo);
......
...@@ -149,7 +149,7 @@ vec3 voxelConeTrace(vec3 direction, vec3 startPosition, float coneAngleRadian, t ...@@ -149,7 +149,7 @@ vec3 voxelConeTrace(vec3 direction, vec3 startPosition, float coneAngleRadian, t
color += (1 - a) * voxelSample.rgb; color += (1 - a) * voxelSample.rgb;
a += (1 - a) * voxelSample.a; a += (1 - a) * voxelSample.a;
float minStepSize = 0.5f; float minStepSize = 1.5f;
d += max(coneDiameter, minStepSize); d += max(coneDiameter, minStepSize);
samplePos = startPosition + d * direction; samplePos = startPosition + d * direction;
sampleUV = worldToVoxelCoordinates(samplePos, voxelInfo); sampleUV = worldToVoxelCoordinates(samplePos, voxelInfo);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment