Create a physically based material: the glTF 2.0 metallic-roughness
model, lit by the lights of the scene through the built-in light
uniforms, with the linear to sRGB conversion at the end of the fragment
shader. Every option maps to a glTF material property of the same name.
Which maps, texture coordinate sets and vertex attributes the material
uses is baked into the shader source as a block of #defines when the
material is created: a sampler without a texture bound would read
texture unit 0, so map presence cannot be decided per draw. Materials
with the same options (and so the same source) share one program in the
renderer. The factors are ordinary uniforms and can be changed at any
time (material.uniforms.roughnessFactor = 0.2); adding or removing a
map means creating a new material.
Create a physically based material: the glTF 2.0 metallic-roughness model, lit by the lights of the scene through the built-in light uniforms, with the linear to sRGB conversion at the end of the fragment shader. Every option maps to a glTF material property of the same name.
Which maps, texture coordinate sets and vertex attributes the material uses is baked into the shader source as a block of
#defines when the material is created: a sampler without a texture bound would read texture unit 0, so map presence cannot be decided per draw. Materials with the same options (and so the same source) share one program in the renderer. The factors are ordinary uniforms and can be changed at any time (material.uniforms.roughnessFactor = 0.2); adding or removing a map means creating a new material.