Granite/divergent_lod.frag at master · Themaister/Granite · GitHub
source link: https://github.com/Themaister/Granite/blob/master/tests/assets/shaders/divergent_lod.frag
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Granite/divergent_lod.frag at master · Themaister/Granite · GitHubPermalink
23 lines (20 sloc) 514 Bytes
#version 450
layout(location = 0) in vec2 vUV; layout(location = 0) out vec4 FragColor; layout(set = 0, binding = 1) uniform sampler2D uSampler; layout(set = 0, binding = 0, std140) uniform Weights { vec4 weights[4]; };
void main() { vec3 tex = vec3(0.0); float lod = -10.0; vec2 uv = vUV; if (weights[int(gl_FragCoord.x) + 2 * int(gl_FragCoord.y)].x > 0.0) { tex = texture(uSampler, uv).rgb; lod = textureQueryLod(uSampler, uv).y; }
FragColor = vec4(tex, lod); }
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK