Skip to content

mkmaterial: Blender-related improvements - #965

Open
snacchus wants to merge 3 commits into
DragonMinded:previewfrom
snacchus:mkmaterial-blender-missing-features
Open

mkmaterial: Blender-related improvements#965
snacchus wants to merge 3 commits into
DragonMinded:previewfrom
snacchus:mkmaterial-blender-missing-features

Conversation

@snacchus

@snacchus snacchus commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

This PR adds the following new properties to mkmaterial:

  • blender.mode.raw: Similar to combiner.*.raw, in that it allows to specify the exact blender formula (1-cycle or 2-cycle)
  • Several properties that control the BLEND_COLOR and FOG_COLOR RDP registers:
    • blender.reg.blend.rgb: Corresponds to the RGB portion of the BLEND_COLOR register. Note that the alpha portion is not settable through a similar property, because this is already covered by rm.alpha_compare.
    • blender.reg.fog.rgb: Corresponds to the RGB portion of the FOG_COLOR register.
    • blender.reg.fog.alpha: Corresponds to the alpha portion of the FOG_COLOR register. This property must not be set if blender.mode is set to multiply_const, because the constant value also takes up the fog alpha.

To make it possible to set RGB and alpha portions of RDP registers independently, some new API has been added at the rdpq-level:

  • rdpq_set_blend_color_rgb
  • rdpq_set_blend_color_alpha
  • rdpq_set_fog_color_rgb
  • rdpq_set_fog_color_alpha

These functions are implemented by tracking the current register contents in DMEM (of the rdpq overlay).

@Dragorn421 Dragorn421 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! Thanks!

Regarding the weirdness around blender.mode.const and blender.reg.fog.alpha both referring to the same value in fine (which it seems you handled correctly by erroring if both are set), one thing to note is that blender.mode.const currently has no effect (doesn't get exported into the material)
It may be a good opportunity to either get rid of blender.mode.const or actually implement it too

Comment thread tools/mkmaterial/mkmaterial.h Outdated
Comment thread src/rdpq/rsp_rdpq.S
@snacchus

snacchus commented Aug 2, 2026

Copy link
Copy Markdown
Contributor Author

@Dragorn421 blender.mode.const did indeed have no effect thus far, but I actually fixed that too in this PR. See Blender::get_fog_alpha

@snacchus
snacchus force-pushed the mkmaterial-blender-missing-features branch from 9ab258f to dc127d6 Compare August 2, 2026 16:30
@snacchus
snacchus marked this pull request as ready for review August 2, 2026 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants