Initial commit: Minecraft 光追着色器包(从零实现的 path tracing)
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
// MinecraftPT — Sky_End_FS
|
||||
// End dimension sky rendering pass.
|
||||
|
||||
#include "/Lib/Settings.glsl"
|
||||
#include "/Lib/BasicFunctions/LightingConstants.glsl"
|
||||
#include "/Lib/Utilities.glsl"
|
||||
#include "/Lib/IndividualFunctions/EndSky.glsl"
|
||||
|
||||
uniform sampler2D depthtex0;
|
||||
|
||||
layout(location = 0) out vec4 colorOut;
|
||||
|
||||
void main(){
|
||||
ivec2 texelCoord = ivec2(gl_FragCoord.xy);
|
||||
|
||||
float depth = texelFetch(depthtex0, texelCoord, 0).r;
|
||||
if (depth < 1.0){
|
||||
discard;
|
||||
}
|
||||
|
||||
vec4 viewPos = gbufferProjectionInverse * vec4(vec2(texelCoord) / screenSize * 2.0 - 1.0, 1.0, 1.0);
|
||||
vec3 viewDir = normalize(viewPos.xyz / viewPos.w);
|
||||
vec3 worldDir = normalize(mat3(gbufferModelViewInverse) * viewDir);
|
||||
|
||||
vec3 color = GetEndSky(worldDir, GetSunDirWorld());
|
||||
|
||||
colorOut = vec4(color, 1.0);
|
||||
}
|
||||
Reference in New Issue
Block a user