mirror of
https://github.com/X0nk/Bliss-Shader.git
synced 2025-06-22 08:42:50 +08:00
tweak indirect SSS to be a little bright like it used to be. Tweak sampling for shadow filtering, ssao, rtao, ssgi, and specular reflections.
This commit is contained in:
@ -34,40 +34,46 @@ mat4 BuildTranslationMatrix(const in vec3 delta) {
|
||||
vec4(delta, 1.0));
|
||||
}
|
||||
|
||||
|
||||
vec3 LightDir = vec3(0.0, 1.0, 0.0);
|
||||
|
||||
// vec3 LightDir = vec3(sin(frameTimeCounter*10), 0.2, -cos(frameTimeCounter*10));
|
||||
uniform vec3 CamPos;
|
||||
|
||||
// vec3 LightDir = vec3(1.0, 0.5, 1.0);
|
||||
|
||||
float rate = frameTimeCounter;
|
||||
vec3 LightDir = vec3(sin(rate), 0.3, cos(rate));
|
||||
// vec3 LightDir = vec3(cos(rate),sin(rate),cos(rate));
|
||||
|
||||
const float shadowIntervalSize = 2.0f;
|
||||
vec3 GetShadowIntervalOffset() {
|
||||
return fract(CamPos / shadowIntervalSize) * shadowIntervalSize - vec3(3,0,1);
|
||||
}
|
||||
|
||||
mat4 BuildShadowViewMatrix(const in vec3 localLightDir) {
|
||||
//#ifndef WORLD_END
|
||||
// return shadowModelView;
|
||||
//#else
|
||||
const vec3 worldUp = vec3(0, 0, -1);
|
||||
const vec3 worldUp = vec3(1, 0, 0);
|
||||
|
||||
vec3 zaxis = localLightDir;
|
||||
vec3 xaxis = normalize(cross(worldUp, zaxis));
|
||||
vec3 yaxis = normalize(cross(zaxis, xaxis));
|
||||
vec3 zaxis = localLightDir;
|
||||
|
||||
mat4 shadowModelViewEx = mat4(1.0);
|
||||
shadowModelViewEx[0].xyz = vec3(xaxis.x, yaxis.x, zaxis.x);
|
||||
shadowModelViewEx[1].xyz = vec3(xaxis.y, yaxis.y, zaxis.y);
|
||||
shadowModelViewEx[2].xyz = vec3(xaxis.z, yaxis.z, zaxis.z);
|
||||
// float check = localLightDir.y;
|
||||
// if(check < 0.0) zaxis.y = -zaxis.y;
|
||||
|
||||
vec3 intervalOffset = GetShadowIntervalOffset();
|
||||
mat4 translation = BuildTranslationMatrix(intervalOffset);
|
||||
|
||||
return shadowModelViewEx * translation ;
|
||||
//#endif
|
||||
vec3 xaxis = normalize(cross(worldUp, zaxis));
|
||||
vec3 yaxis = normalize(cross(zaxis, xaxis));
|
||||
|
||||
mat4 shadowModelViewEx = mat4(1.0);
|
||||
shadowModelViewEx[0].xyz = vec3(xaxis.x, yaxis.x, zaxis.x);
|
||||
shadowModelViewEx[1].xyz = vec3(xaxis.y, yaxis.y, zaxis.y);
|
||||
shadowModelViewEx[2].xyz = vec3(xaxis.z, yaxis.z, zaxis.z);
|
||||
|
||||
vec3 intervalOffset = GetShadowIntervalOffset();
|
||||
mat4 translation = BuildTranslationMatrix(intervalOffset);
|
||||
|
||||
return shadowModelViewEx * translation;
|
||||
}
|
||||
|
||||
mat4 BuildShadowProjectionMatrix() {
|
||||
float maxDist = min(shadowDistance, far);
|
||||
return BuildOrthoProjectionMatrix(maxDist, maxDist, -far, far);
|
||||
}
|
||||
|
||||
// mat4 Custom_ViewMatrix = BuildShadowViewMatrix(LightDir);
|
||||
// mat4 Custom_ProjectionMatrix = BuildShadowProjectionMatrix();
|
||||
*/
|
Reference in New Issue
Block a user