Skip to content
Snippets Groups Projects

Resolve "Voxel cone tracing"

Merged Ghost User requested to merge 82-voxel-cone-tracing into develop
4 files
+ 24
6
Compare changes
  • Side-by-side
  • Inline
Files
4
@@ -9,6 +9,7 @@
layout(location = 0) in vec3 passNormal;
layout(location = 1) in vec2 passUV;
layout(location = 2) in vec3 passPos;
layout(location = 3) in vec4 passTangent;
layout(location = 0) out vec3 outColor;
@@ -19,10 +20,22 @@ layout(set=0, binding=1) uniform texture2D shadowMap;
layout(set=0, binding=2) uniform sampler shadowMapSampler;
void main() {
vec3 N = normalize(passNormal);
vec3 albedoTexel = texture(sampler2D(albedoTexture, textureSampler), passUV).rgb;
vec3 normalTexel = texture(sampler2D(normalTexture, textureSampler), passUV).rgb;
vec3 specularTexel = texture(sampler2D(specularTexture, textureSampler), passUV).rgb;
vec3 albedo = albedoTexel;
vec3 T = normalize(passTangent.xyz);
vec3 N_geo = normalize(passNormal);
vec3 B = cross(N_geo, T) * passTangent.w;
mat3 TBN = mat3(T, B, N_geo);
normalTexel = normalTexel * 2 - 1;
vec3 N = TBN * normalTexel;
vec3 sun = lightInfo.sunStrength * lightInfo.sunColor * clamp(dot(N, lightInfo.L), 0, 1);
sun *= shadowTest(passPos, lightInfo, shadowMap, shadowMapSampler);
vec3 ambient = vec3(0.05);
vec3 albedo = texture(sampler2D(albedoTexture, textureSampler), passUV).rgb;
outColor = albedo * (sun + ambient);
outColor = albedo * (sun + ambient);
}
\ No newline at end of file
Loading