Fix texture base color brightness

This commit is contained in:
kijai 2026-07-01 02:16:02 +03:00
parent f3c8db510f
commit 80e9fc65b1

View File

@ -475,11 +475,14 @@ def save_glb(vertices, faces, filepath=None, metadata=None,
pbr = {
"metallicFactor": 0.0,
"roughnessFactor": 0.5,
"baseColorFactor": [0.22, 0.22, 0.22, 1.0],
"baseColorFactor": [0.22, 0.22, 0.22, 1.0], # neutral-gray fallback for bare geometry only
}
if texture_png_bytes is not None and has_uv:
pbr["baseColorTexture"] = {"index": add_image_texture(texture_byte_offset, len(texture_buffer)), "texCoord": 0}
if (texture_png_bytes is not None and has_uv) or "COLOR_0" in primitive_attributes:
pbr["baseColorFactor"] = [1.0, 1.0, 1.0, 1.0]
if mr_png_bytes is not None and has_uv:
mr_texture_index = add_image_texture(mr_byte_offset, len(mr_buffer))
pbr["metallicRoughnessTexture"] = {"index": mr_texture_index, "texCoord": 0}