Atlas fix #6

Merged
kkbp-dev merged 3 commits from AnalogKnight/KKBP_Importer:pr-837-branch into master 2026-01-10 14:03:05 +00:00
Contributor

It works well on the current few textures. I haven't included all texture types yet because I'm not entirely sure what they're for.

The exported light and dark textures still seem to be overlaid with textures like detail; this might need to be avoided if you want to separate them?
Also, this seems to be a default behavior, rather than a switch?

It works well on the current few textures. I haven't included all texture types yet because I'm not entirely sure what they're for. The exported light and dark textures still seem to be overlaid with textures like detail; this might need to be avoided if you want to separate them? Also, this seems to be a default behavior, rather than a switch?
Author
Contributor

I modified .gitignore, which is unrelated to this fix. However, I believe that copilot prompt files should be excluded if contributors use copilot to assist with development.

I modified .gitignore, which is unrelated to this fix. However, I believe that copilot prompt files should be excluded if contributors use copilot to assist with development.
Owner

Thanks! I'll check this out.
Though you're correct, I hadn't thought of that... In the V8 version of kkbp, the detail could be separated from the main textures because the materials hadn't been finalized yet, but in V9 the detail is always baked into the texture. At the moment, I'm not sure if there's an easy way to separate them...

Thanks! I'll check this out. Though you're correct, I hadn't thought of that... In the V8 version of kkbp, the detail could be separated from the main textures because the materials hadn't been finalized yet, but in V9 the detail is always baked into the texture. At the moment, I'm not sure if there's an easy way to separate them...
Author
Contributor

I think perhaps we don't need to consider separating them, but can directly obtain the original textures from the folder exported by the exporter?

I think perhaps we don't need to consider separating them, but can directly obtain the original textures from the folder exported by the exporter?
Owner

I tried it and it works!

I think perhaps we don't need to consider separating them, but can directly obtain the original textures from the folder exported by the exporter?

I would think not because you have to saturate the original textures. The textures you want are likely the MT_CT.png textures, which are not saturated. The texture files in the "pre_light" and "pre_dark" folders are already saturated, but they have the detail baked in. The MT_CT textures would have to be saturated, then loaded into the _light.png image node and I think that would work.

I tried it and it works! > I think perhaps we don't need to consider separating them, but can directly obtain the original textures from the folder exported by the exporter? I would think not because you have to saturate the original textures. The textures you want are likely the MT_CT.png textures, which are not saturated. The texture files in the "pre_light" and "pre_dark" folders are already saturated, but they have the detail baked in. The MT_CT textures would have to be saturated, then loaded into the _light.png image node and I think that would work.
Author
Contributor

Sorry, I don't know much about this.
When the plugin saturates a texture, do we actually separate the original texture into light and dark?
If I understand correctly, the light and dark textures are used for the surfaces exposed to light and shadow surfaces, respectively, right?
If this is the case, we may no longer need light and dark textures, as third-party application shaders can handle these perfectly well. Separating light and dark materials might also increase management costs.

Sorry, I don't know much about this. When the plugin saturates a texture, do we actually separate the original texture into light and dark? If I understand correctly, the light and dark textures are used for the surfaces exposed to light and shadow surfaces, respectively, right? If this is the case, we may no longer need light and dark textures, as third-party application shaders can handle these perfectly well. Separating light and dark materials might also increase management costs.
First-time contributor

If you want to avoid certain textures (e.g. detail maps) being baked into the light/dark textures, you can explicitly exclude them in the ExportLightDark function in the exporter, as shown below.

The reason for introducing light/dark textures is that some cards rely on some third-party shaders which the previous approach could not reliably support. This approach provides a fallback in those cases.

For users who don’t require very fine-grained material control, the light/dark texture workflow is usually sufficient. For developers, it offers a relatively straightforward way to avoid a broad class of “incorrect color” issues caused by shader incompatibilities.

That said, the previous rendering approach was also very flexible and worked well in its own context. For advanced users, custom shaders are often preferred anyway — since all raw images are still preserved, it’s entirely possible to import the model into Blender, adjust the armature, and apply fully custom shaders afterward.

If you want to avoid certain textures (e.g. detail maps) being baked into the light/dark textures, you can explicitly exclude them in the ExportLightDark function in the exporter, as shown below. The reason for introducing light/dark textures is that some cards rely on some third-party shaders which the previous approach could not reliably support. This approach provides a fallback in those cases. For users who don’t require very fine-grained material control, the light/dark texture workflow is usually sufficient. For developers, it offers a relatively straightforward way to avoid a broad class of “incorrect color” issues caused by shader incompatibilities. That said, the previous rendering approach was also very flexible and worked well in its own context. For advanced users, custom shaders are often preferred anyway — since all raw images are still preserved, it’s entirely possible to import the model into Blender, adjust the armature, and apply fully custom shaders afterward.
Author
Contributor

Thank you for providing clarification.

Just to make sure I’m understanding correctly: are you saying that the material baking happens inside the exporter rather than in the Blender plugin itself? On my side, the folders generated by the exporter appear to contain only the original color textures, without any additional textures baked into them.

Is there something I might be misunderstanding?
image

Thank you for providing clarification. Just to make sure I’m understanding correctly: are you saying that the material baking happens inside the exporter rather than in the Blender plugin itself? On my side, the folders generated by the exporter appear to contain only the original color textures, without any additional textures baked into them. Is there something I might be misunderstanding? ![image](/attachments/06ac0d61-659e-4b54-bc71-707a58430d75)
141 KiB
First-time contributor

Baked textures are in the "pre_light" and “pre_dark" folders
屏幕截图 2025-12-22 231610

Baked textures are in the "pre_light" and “pre_dark" folders ![屏幕截图 2025-12-22 231610](/attachments/4cfb40aa-ffa2-4c00-9f9e-2c164fed8691)
Owner

So to summarize...

  • In KKBP 8.0, the exporter will export unsaturated textures as MT_CT. These textures do not have the detail mask baked in. You need to saturate these textures, or the color will look different when compared to the game. In KKBP 8.0, the saturation operation was done in the blender plugin. Then, the detail mask was applied on top of the saturated texture.
  • In KKBP 9.0, the exporter uses a brand new method that will export saturated textures to the pre_light and pre_dark folders. These textures are already saturated so the blender plugin does not saturate them. The blender plugin does not apply the detail mask either, since the detail mask is already baked in.
    • You can modify the exporter plugin like Sonogami_Rinne showed earlier, to remove the detail mask from the saturated texture.

I think for your use case, it might be better to add the lines that Sonogami_Rinne showed earlier to the exporter project, and compile a new exporter .dll file for yourself. This way, you'll be able to get the saturated image without the detail mask baked in. Then you'll be able to use this new PR to get the saturated atlas without the detail mask. Then apply the detail mask atlas on top of the saturated atlas once you get the model in Unreal.

Also, can you enable the setting to let me edit the PR? I'd like to update it to move it to the new atlas dropdown menu

So to summarize... * In KKBP 8.0, the exporter will export unsaturated textures as MT_CT. These textures do not have the detail mask baked in. You need to saturate these textures, or the color will look different when compared to the game. In KKBP 8.0, the saturation operation was done in the blender plugin. Then, the detail mask was applied on top of the saturated texture. * In KKBP 9.0, the exporter uses a brand new method that will export saturated textures to the pre_light and pre_dark folders. These textures are already saturated so the blender plugin does not saturate them. The blender plugin does not apply the detail mask either, since the detail mask is already baked in. * You can modify the exporter plugin like Sonogami_Rinne showed earlier, to remove the detail mask from the saturated texture. I think for your use case, it might be better to add the lines that Sonogami_Rinne showed earlier to the exporter project, and compile a new exporter .dll file for yourself. This way, you'll be able to get the saturated image without the detail mask baked in. Then you'll be able to use this new PR to get the saturated atlas without the detail mask. Then apply the detail mask atlas on top of the saturated atlas once you get the model in Unreal. Also, can you enable the setting to let me edit the PR? I'd like to update it to move it to the new atlas dropdown menu
Author
Contributor

No problem, I think I've enabled it.

I'll look into what you're saying; I've never touched the exporter before. Thanks.

No problem, I think I've enabled it. I'll look into what you're saying; I've never touched the exporter before. Thanks.
Owner

@AnalogKnight
Hmm... I'm not familiar with how forgejo works, but it looks like I still can't edit the PR. Also, when I try to click the button to update the branch, it doesn't work...

Could you click the button that makes the branch up to date with the base branch? Then I'll merge your PR and make the edits afterwards.

@AnalogKnight Hmm... I'm not familiar with how forgejo works, but it looks like I still can't edit the PR. Also, when I try to click the button to update the branch, it doesn't work... Could you click the button that makes the branch up to date with the base branch? Then I'll merge your PR and make the edits afterwards.
AnalogKnight changed title from WIP: Atlas fix to Atlas fix 2026-01-10 13:45:47 +00:00
Author
Contributor

Of course, it should be done.

Of course, it should be done.
kkbp-dev merged commit cba4547d14 into master 2026-01-10 14:03:05 +00:00
Owner

Alright, it's merged. Thanks for this feature! Sorry for taking so long with this.

Alright, it's merged. Thanks for this feature! Sorry for taking so long with this.
AnalogKnight deleted branch pr-837-branch 2026-01-14 00:22:35 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
kkbp-dev/KKBP_Importer!6
No description provided.