-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fog with ARB_fragment_shader_interlock: quick and dirty prototype
a prototype of #817
- Loading branch information
1 parent
c495e84
commit b856815
Showing
7 changed files
with
81 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#version 430 | ||
out vec4 fragColor; | ||
in vec2 texCoords; | ||
|
||
uniform float zNear; | ||
uniform float zFar; | ||
|
||
layout(binding = 5) uniform sampler2D depthBuffer; | ||
|
||
float zFromDepth(float depthBufferValue) { | ||
return zNear*zFar/(depthBufferValue*(zNear - zFar) + zFar); | ||
} | ||
|
||
void main() { | ||
fragColor.r = zFromDepth(texture(depthBuffer, texCoords).r); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#version 430 | ||
|
||
layout (location=0) in vec2 inTexCoords; | ||
|
||
out vec2 texCoords; | ||
|
||
void main() { | ||
texCoords = inTexCoords; | ||
gl_Position = vec4(inTexCoords*2 - vec2(1, 1), 0, 1); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters