armory/Shaders/matid_to_depth/matid_to_depth.frag.glsl
2017-08-22 13:27:17 +02:00

17 lines
320 B
GLSL

// Transfer material IDs to depth buffer
#version 450
#ifdef GL_ES
precision mediump float;
#endif
uniform sampler2D tex;
in vec2 texCoord;
void main() {
const float fstep = 1.0 / 16777216.0; // 24bit
// const float fstep = 1.0 / 65536.0; // 16bit
gl_FragDepth = texture(tex, texCoord).r * fstep; // materialID
}