all_textures resize uses the first material's light resolution for all materials #74
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
kkbp-dev/KKBP_Importer#74
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
While testing atlas generation in
all_texturesmode, I noticed that texture resizing uses the first detected light texture resolution as the target resolution for all materials in the mesh.This becomes problematic when a mesh contains materials with different light texture resolutions.
Example
Current behavior
The resize target is determined by the first material with a light texture found in the object.
For example:
As a result, the resize target depends on the first material found in the object rather than the material currently being processed.
Cause
The resize target is determined from the first light texture found in the object and is then reused for every material processed during atlas generation.
Current code location:
Inside
Combiner.execute(), in the material processing loop, immediately before:Current implementation:
The resize target is calculated before entering the material processing loop and is then reused for all materials.
As a result:
target_resolutionis determined only once.For example:
If the Body material is encountered first, all normal/detail-related textures will be resized to 4096×4096.
If the Eyeline material is encountered first, all normal/detail-related textures will be resized to 128×128.
This means the resize target depends on which material appears first in
object.material_slots, rather than the light texture resolution belonging to the material currently being processed.The resize operation itself works correctly; the issue is that the wrong target resolution is selected before the resize occurs.
Proposed fix
The resize target should be determined from the material currently being processed instead of reusing a resolution selected from another material.
Current implementation:
Suggested change:
Remove the lookup above and determine
target_resolutionimmediately before the resize operation using the material currently being processed:This allows each material to use its own light texture resolution when resizing normal/detail-related textures.