Revision 001fb991
Added by Leszek Koltunski over 7 years ago
| src/main/java/org/distorted/library/main/DistortedOutputSurface.java | ||
|---|---|---|
| 388 | 388 |
// Otherwise, render to a buffer and on each change of Postprocessing Bucket, apply the postprocessing |
| 389 | 389 |
// to a whole buffer (lastQueue.postprocess) and merge it (this.oitBuild). |
| 390 | 390 |
|
| 391 |
/* |
|
| 392 |
int renderChildren1(long time, int numChildren, ArrayList<DistortedNode> children, int fbo, boolean oit) |
|
| 393 |
{
|
|
| 394 |
oitClear(this); |
|
| 395 |
setAsOutputFBO(time,fbo); |
|
| 396 |
mChildren.get(0).drawOIT(time, this); |
|
| 397 |
GLES31.glMemoryBarrier(GLES31.GL_SHADER_STORAGE_BARRIER_BIT | GLES31.GL_ATOMIC_COUNTER_BARRIER_BIT); |
|
| 398 |
oitRender(time, fbo); |
|
| 399 |
|
|
| 400 |
return 0; |
|
| 401 |
} |
|
| 402 |
*/ |
|
| 403 |
|
|
| 404 | 391 |
int renderChildren(long time, int numChildren, ArrayList<DistortedNode> children, int fbo, boolean oit) |
| 405 | 392 |
{
|
| 406 | 393 |
int quality=0, internalQuality = 0, numRenders = 0, bucketChange = 0; |
| src/main/res/raw/main_fragment_shader.glsl | ||
|---|---|---|
| 126 | 126 |
} |
| 127 | 127 |
#endif |
| 128 | 128 |
|
| 129 |
vec4 converted = vec4(color.rgb * (1.0 + 7.0*v_Normal.z) * 0.125, color.a); |
|
| 130 |
|
|
| 129 | 131 |
#ifdef OIT |
| 130 |
if( color.a > 0.95 )
|
|
| 132 |
if( converted.a > 0.95 )
|
|
| 131 | 133 |
{
|
| 132 |
fragColor= vec4(color.rgb * (1.0 + 7.0*v_Normal.z) * 0.125, color.a);
|
|
| 134 |
fragColor= converted;
|
|
| 133 | 135 |
} |
| 134 | 136 |
else |
| 135 | 137 |
{
|
| 136 |
if( color.a > 0.0 )
|
|
| 138 |
if( converted.a > 0.0 )
|
|
| 137 | 139 |
{
|
| 138 | 140 |
const float S= 2147483647.0; // max signed int. Could probably be max unsigned int but this is enough. |
| 139 |
insert(v_Pixel, uint(S*(1.0-gl_FragCoord.z)/2.0), convert(color) ); |
|
| 141 |
vec2 pixel = vec2(gl_FragCoord.xy); |
|
| 142 |
insert(pixel, uint(S*(1.0-gl_FragCoord.z)/2.0), convert(converted) ); |
|
| 140 | 143 |
} |
| 141 | 144 |
discard; |
| 142 | 145 |
} |
| 143 | 146 |
#else |
| 144 |
fragColor = vec4(color.rgb * (1.0 + 7.0*v_Normal.z) * 0.125, color.a);
|
|
| 147 |
fragColor = converted;
|
|
| 145 | 148 |
#endif |
| 146 | 149 |
} |
Also available in: Unified diff
Largely fix the non-postprocessed OIT. Still, one problem remains: back-facing surfaces seem to disappear (visible in 'Cubes')