transparency. The issue is that we are rendering to a 0..1 clamped sRGB buffer with unpremultiplied alpha, where the correct thing to do would be to render to an unclamped linear premultiplied alpha buffer. Then we would just make fire purely emissive without affecting the alpha channel at all, but that doesn't work here. So for now, draw fire and smoke separately using different shaders and blend modes, like it used to before the smoke programs were rewritten (see rB0372b642).
18 lines
314 B
GLSL
18 lines
314 B
GLSL
|
|
varying vec3 coords;
|
|
|
|
uniform sampler3D flame_texture;
|
|
uniform sampler1D spectrum_texture;
|
|
|
|
void main()
|
|
{
|
|
float flame = texture3D(flame_texture, coords).r;
|
|
vec4 emission = texture1D(spectrum_texture, flame);
|
|
|
|
vec4 color;
|
|
color.rgb = emission.a * emission.rgb;
|
|
color.a = emission.a;
|
|
|
|
gl_FragColor = color;
|
|
}
|