Home › Per The Book of Shaders, a SDF-based circle shap…
Per The Book of Shaders, a SDF-based circle shape in a fragment shader at point uv (centred at 0.5) uses which expression?
Asin(uv.x * 6.28) over the screen
Bsmoothstep(r, r + ε, length(uv − 0.5))
Ctexture2D(tex, uv) once per pixel
Dgl_FragCoord.x / 1080.0 only
Answer & Solution
Correct answer: B. smoothstep(r, r + ε, length(uv − 0.5))
Book of Shaders Shapes Ch.: distance = length(uv - 0.5); smoothstep gives anti-aliased disc edge. Building block for arbitrary 2D shapes.
Related questions
Per LearnOpenGL (compute shaders), the WORKGROUP for a GLSL compute shader is invoked via For UNIFORM BUFFER OBJECTS (UBO) and SHADER STORAGE BUFFER OBJECTS (SSBO), the key differePer LearnOpenGL (Normal Mapping), normals stored in a normal map are most commonly in whicPer LearnOpenGL (Lighting), the BLINN-PHONG specular highlight uses which vector instead oIn a fragment shader, BRANCHING on a uniform vs a varying / per-fragment value differs becPer Microsoft HLSL docs, a vertex shader output marked SV_POSITION corresponds to which GLPer LearnOpenGL, the CLIP space output (gl_Position) is converted to NDC by which operatioPer LearnOpenGL (Transformations), the standard order of matrix multiplication for a verte