armory/Shaders/matid_to_depth/matid_to_depth.frag.glsl

13 lines
274 B
Plaintext
Raw Normal View History

2017-03-28 14:30:51 +02:00
// Transfer material IDs to depth buffer
#version 450
uniform sampler2D tex;
in vec2 texCoord;
void main() {
2017-08-22 13:27:17 +02:00
const float fstep = 1.0 / 16777216.0; // 24bit
// const float fstep = 1.0 / 65536.0; // 16bit
2017-03-28 14:30:51 +02:00
gl_FragDepth = texture(tex, texCoord).r * fstep; // materialID
}