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:
Orkun ÇAKILKAYA 2026-09-29 18:52:42 +03:00
parent d2e1f804ce
commit f79390838a
27 changed files with 221 additions and 114 deletions

View file

@ -836,6 +836,7 @@ export state Render3dState {
tb_key: string = ""
tb_version: int = 0
tb_shadow_ok: bool = false # the shadow came from its bake this map
gltf_pure: int = 0 # a 1x1 white a factor multiplies exactly (gltf_factors)
tt_dir: string = "" # terrain_tiles_to: where a map's tiles are written ("" keeps the whole copies)
tt_key: string = ""
tt_file: pointer = null # the tiles' file, open for reading (terrain_tiles.ludic)