Skip to content

[WIP] Implement support for Modulate shader with $mod2x and DecalModulate shader in material builder#197

Closed
Copilot wants to merge 1 commit intoreleasefrom
copilot/fix-196
Closed

[WIP] Implement support for Modulate shader with $mod2x and DecalModulate shader in material builder#197
Copilot wants to merge 1 commit intoreleasefrom
copilot/fix-196

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Aug 1, 2025

Thanks for assigning this issue to me. I'm starting to work on it and will keep this PR's description up to date as I form a plan and make progress.

Original issue description:

Currently, mod2x decals get materials that don't do anything special (e.g. they use the normal material path).

To properly support these:

  • Change the texture color space to "non-color" to preserve 50% gray as 50% gray.
  • Add the color to itself (double it) so 50% gray becomes flat white.
  • Use the Transparent BSDF.

This results in a much nicer looking blood stain without a gray rectangle around it.

This is similar to the way $detailblendmode 0 is currently handled, which correctly does the mod2x operation on a base texture. This would add support to the shaders doing that operation, meaning that there is no base texture but instead the Blender must do the final blending. The material builder should probably have a separate path which detects if the shader is one of these and builds a material with it's own logic (similar to the water handling currently IIRC). The DecalModulate shader is always assumed to use mod2x, while the Modulate shader should only result in the new mod2x material if used with the $mod2x parameter. Additionally, if a Modulate shader without the mod2x parameter is encountered, the resulting material should function as described in the wiki below.

More details about the supported VMT shaders and what kind of parameters need to be checked are here:
https://developer.valvesoftware.com/wiki/Modulate
https://developer.valvesoftware.com/wiki/Decals#DecalModulate

Details about the transparent BSDF in Blender:
https://docs.blender.org/manual/en/latest/render/shader_nodes/shader/transparent.html

Fixes #196.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI requested a review from lasa01 August 1, 2025 20:58
@lasa01 lasa01 closed this Aug 1, 2025
@lasa01 lasa01 deleted the copilot/fix-196 branch August 1, 2025 21:05
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.

Implement support for Modulate shader with $mod2x and DecalModulate shader in material builder

2 participants