Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Order independent transparency (#1418)
* skip second framebuffer & dynamic attachment ids * draft OIT implementation * combine shaders * rename and simply colorbuffer attachment * reduce SSAO buffer size and reuse HDR_color * add some convenience * fix typos * fix error for nonstandard prerenderers * cleanup * fix transparency with transparency = false i.e. scatter, text, etc * remove alpha from weight sum * switch back to Float32 for position buffer * reuse HDR color buffer for FXAA * add note on buffer reuse * cleanup some comments * fix discoloration * remove warning * use that opaque alpha = 0 * add OIT test * add transparency * avoid reading and writing to the same colorbuffer * reduce position buffer size * fix 3d contour * Update runtests.jl * Update runtests.jl * add docs for transparency and OIT Co-authored-by: Simon <sdanisch@protonmail.com>
- Loading branch information
1 parent
8bab354
commit 8e8b09a
Showing
33 changed files
with
628 additions
and
183 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
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,25 @@ | ||
{{GLSL_VERSION}} | ||
|
||
// Based on https://jcgt.org/published/0002/02/09/ | ||
// See https://github.com/JuliaPlots/Makie.jl/issues/1390 | ||
|
||
in vec2 frag_uv; | ||
|
||
// contains sum_i C_i * weight(depth_i, alpha_i) | ||
uniform sampler2D sum_color; | ||
// contains pod_i (1 - alpha_i) | ||
uniform sampler2D prod_alpha; | ||
|
||
out vec4 fragment_color; | ||
|
||
void main(void) | ||
{ | ||
vec4 summed_color_weight = texture(sum_color, frag_uv); | ||
float transmittance = texture(prod_alpha, frag_uv).r; | ||
|
||
vec3 weighted_transparent = summed_color_weight.rgb / max(summed_color_weight.a, 0.00001); | ||
vec3 full_weighted_transparent = weighted_transparent * (1 - transmittance); | ||
|
||
fragment_color.rgb = full_weighted_transparent; | ||
fragment_color.a = transmittance; | ||
} |
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
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
Oops, something went wrong.