forked from LeenkxTeam/LNXSDK
		
	Update leenkx/Shaders/std/shadows.glsl
This commit is contained in:
		| @ -88,7 +88,7 @@ float lpToDepth(vec3 lp, const vec2 lightProj) { | ||||
| } | ||||
|  | ||||
| #ifndef _ShadowMapAtlas | ||||
| float PCFCube(samplerCubeShadow shadowMapCube, vec3 lp, vec3 ml, float bias, vec2 lightProj, vec3 n) { | ||||
| vec3 PCFCube(samplerCubeShadow shadowMapCube, samplerCube shadowMapCubeTransparent, vec3 lp, vec3 ml, float bias, vec2 lightProj, vec3 n, bool transparent) { | ||||
|     const float s = shadowmapCubePcfSize; | ||||
|     float compare = lpToDepth(lp, lightProj) - bias * 1.5; | ||||
|     ml = ml + n * bias * 20; | ||||
| @ -96,26 +96,31 @@ float PCFCube(samplerCubeShadow shadowMapCube, vec3 lp, vec3 ml, float bias, vec | ||||
|     ml.y = -ml.y; | ||||
|     #endif | ||||
|      | ||||
|     float result = 0.0; | ||||
|     // Simple PCF for non-atlas mode, using samplerCubeShadow format | ||||
|     result = texture(shadowMapCube, vec4(ml, compare)); | ||||
|     result += texture(shadowMapCube, vec4(ml + vec3(s, s, s), compare)); | ||||
|     result += texture(shadowMapCube, vec4(ml + vec3(-s, s, s), compare)); | ||||
|     result += texture(shadowMapCube, vec4(ml + vec3(s, -s, s), compare)); | ||||
|     result += texture(shadowMapCube, vec4(ml + vec3(s, s, -s), compare)); | ||||
|     result += texture(shadowMapCube, vec4(ml + vec3(-s, -s, s), compare)); | ||||
|     result += texture(shadowMapCube, vec4(ml + vec3(s, -s, -s), compare)); | ||||
|     result += texture(shadowMapCube, vec4(ml + vec3(-s, s, -s), compare)); | ||||
|     result += texture(shadowMapCube, vec4(ml + vec3(-s, -s, -s), compare)); | ||||
|     result /= 9.0; | ||||
|     float shadowFactor = 0.0; | ||||
|     shadowFactor = texture(shadowMapCube, vec4(ml, compare)); | ||||
|     shadowFactor += texture(shadowMapCube, vec4(ml + vec3(s, s, s), compare)); | ||||
|     shadowFactor += texture(shadowMapCube, vec4(ml + vec3(-s, s, s), compare)); | ||||
|     shadowFactor += texture(shadowMapCube, vec4(ml + vec3(s, -s, s), compare)); | ||||
|     shadowFactor += texture(shadowMapCube, vec4(ml + vec3(s, s, -s), compare)); | ||||
|     shadowFactor += texture(shadowMapCube, vec4(ml + vec3(-s, -s, s), compare)); | ||||
|     shadowFactor += texture(shadowMapCube, vec4(ml + vec3(s, -s, -s), compare)); | ||||
|     shadowFactor += texture(shadowMapCube, vec4(ml + vec3(-s, s, -s), compare)); | ||||
|     shadowFactor += texture(shadowMapCube, vec4(ml + vec3(-s, -s, -s), compare)); | ||||
|     shadowFactor /= 9.0; | ||||
|      | ||||
|     vec3 result = vec3(shadowFactor); | ||||
|      | ||||
|     if (transparent == false) { | ||||
|         vec4 shadowmap_transparent = texture(shadowMapCubeTransparent, ml); | ||||
|         if (shadowmap_transparent.a < compare) | ||||
|             result *= shadowmap_transparent.rgb; | ||||
|     } | ||||
|  | ||||
|     return result; | ||||
| } | ||||
| #endif | ||||
|  | ||||
| #ifdef _ShadowMapAtlas | ||||
|  | ||||
|  | ||||
| vec3 PCFCube(samplerCubeShadow shadowMapCube, samplerCube shadowMapCubeTransparent, const vec3 lp, vec3 ml, const float bias, const vec2 lightProj, const vec3 n, const bool transparent) { | ||||
| 	const float s = shadowmapCubePcfSize; // TODO: incorrect... | ||||
| 	float compare = lpToDepth(lp, lightProj) - bias * 1.5; | ||||
|  | ||||
		Reference in New Issue
	
	Block a user