Voxel refract and shadows for sun lamp
This commit is contained in:
parent
219e1e8ede
commit
27a79cb290
|
@ -7,6 +7,9 @@ precision mediump float;
|
|||
#include "../compiled.glsl"
|
||||
#include "../std/brdf.glsl"
|
||||
#include "../std/math.glsl"
|
||||
#ifdef _VoxelGIDirect
|
||||
#include "../std/conetrace.glsl"
|
||||
#endif
|
||||
#ifndef _NoShadows
|
||||
#ifdef _PCSS
|
||||
#include "../std/shadows_pcss.glsl"
|
||||
|
@ -22,6 +25,10 @@ precision mediump float;
|
|||
#endif
|
||||
#include "../std/gbuffer.glsl"
|
||||
|
||||
#ifdef _VoxelGIDirect
|
||||
//!uniform sampler3D voxels;
|
||||
#endif
|
||||
|
||||
uniform sampler2D gbufferD;
|
||||
uniform sampler2D gbuffer0;
|
||||
uniform sampler2D gbuffer1;
|
||||
|
@ -100,14 +107,22 @@ void main() {
|
|||
}
|
||||
#endif
|
||||
|
||||
float dotNL = dot(n, l);
|
||||
|
||||
#ifdef _VoxelGIShadow // #else
|
||||
#ifdef _VoxelGICam
|
||||
vec3 voxpos = (p - eyeSnap) / voxelgiHalfExtents;
|
||||
#else
|
||||
vec3 voxpos = p / voxelgiHalfExtents;
|
||||
#endif
|
||||
if (dotNL > 0.0) visibility = max(0, 1.0 - traceShadow(voxpos, l, 0.1, 10.0));
|
||||
#endif
|
||||
|
||||
// Per-light
|
||||
// vec3 l = lightDir; // lightType == 0 // Sun
|
||||
vec3 h = normalize(v + l);
|
||||
float dotNH = dot(n, h);
|
||||
float dotVH = dot(v, h);
|
||||
float dotNL = dot(n, l);
|
||||
// float dotLV = dot(l, v);
|
||||
// float dotLH = dot(l, h);
|
||||
|
||||
#ifdef _OrenNayar
|
||||
float facdif = min((1.0 - metrough.x) * 3.0, 1.0);
|
||||
|
@ -153,4 +168,13 @@ void main() {
|
|||
#endif
|
||||
|
||||
fragColor.rgb *= visibility;
|
||||
|
||||
#ifdef _VoxelGIRefract
|
||||
#ifdef _VoxelGICam
|
||||
vec3 voxposr = (p - eyeSnap) / voxelgiHalfExtents;
|
||||
#else
|
||||
vec3 voxposr = p / voxelgiHalfExtents;
|
||||
#endif
|
||||
fragColor.rgb = mix(traceRefraction(voxposr, n, -v, metrough.y), fragColor.rgb, g1.a);
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue