Project

General

Profile

« Previous | Next » 

Revision 001fb991

Added by Leszek Koltunski almost 6 years ago

Largely fix the non-postprocessed OIT. Still, one problem remains: back-facing surfaces seem to disappear (visible in 'Cubes')

View differences:

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