render3d: a glTF material's factors are drawn - base colour, roughness, metallic and emission
gltf_factors reads pbrMetallicRoughness.baseColorFactor, metallicFactor, roughnessFactor and the emissiveFactor into the primitive (pr.fac), and prim_factors hands them to every program that draws its textures (actors, the scatter's meshes and levels, the impostor bake) as 1 - factor, so a program never given them - or a material that gives none (pr.fac null) - multiplies by 1 and draws as before. An untextured material with a colour (or a metal/roughness) samples a pure white for it, so the factor is exactly what it draws: horse_cornea is its own colour, not the 200 grey every untextured part had. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
d2e1f804ce
commit
f79390838a
27 changed files with 221 additions and 114 deletions
|
|
@ -6,9 +6,10 @@ in float v_seed;
|
|||
layout(location = 0) out vec4 o_albedo;
|
||||
layout(location = 1) out vec4 o_normal;
|
||||
uniform sampler2D u_diff;
|
||||
uniform vec4 u_fac_base_inv; // a glTF material's base colour factor, as 1 - factor
|
||||
uniform sampler2D u_arm;
|
||||
void main() {
|
||||
vec4 d = texture(u_diff, v_uv);
|
||||
vec4 d = texture(u_diff, v_uv) * (vec4(1.0) - u_fac_base_inv);
|
||||
if (d.a < 0.5) discard; // cut-out cards (needles, blades, leaves) bake with their shape
|
||||
vec3 N = normalize(v_nrm);
|
||||
if (!gl_FrontFacing) N = -N;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue