-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Part-level material switching #8
Merged
drewcassidy
merged 24 commits into
KSPModdingLibs:master
from
al2me6:materialReplacement
Aug 9, 2024
Merged
Part-level material switching #8
drewcassidy
merged 24 commits into
KSPModdingLibs:master
from
al2me6:materialReplacement
Aug 9, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
al2me6
force-pushed
the
materialReplacement
branch
from
July 22, 2024 03:34
4e3ac58
to
c49a82d
Compare
So that normal map loading works properly when a shader is not set and the existing shader has a custom normal map property name.
al2me6
force-pushed
the
materialReplacement
branch
from
July 24, 2024 03:05
179c729
to
5fc8eef
Compare
al2me6
force-pushed
the
materialReplacement
branch
from
July 24, 2024 03:52
5fc8eef
to
6d2ade7
Compare
al2me6
force-pushed
the
materialReplacement
branch
from
July 25, 2024 03:49
ad91790
to
2f9f0a6
Compare
al2me6
force-pushed
the
materialReplacement
branch
from
July 27, 2024 00:09
df60954
to
ac9e9f3
Compare
For uniformity in dependent mods that use this material def system.
al2me6
force-pushed
the
materialReplacement
branch
from
July 27, 2024 20:18
43e6cab
to
093c542
Compare
Apparently this does not do what it seems to and should never be used.
al2me6
force-pushed
the
materialReplacement
branch
from
August 4, 2024 03:15
4fa77b7
to
5d76876
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a (vastly simplified) replacement for TU's shader replacement functionality.
A new top-level
SHABBY_MATERIAL_DEF
node is introduced. It specifies a replacement shader and any number of shader properties to be modified and contains the following items:name
(required): a unique identifier for this material.displayName
(optional): a human-facing name. Not used in Shabby but may be accessed by other mods depending on this mod. Defaults toname
if not specified.updateExisting
(optional): whether to apply changes to the existing material, or to create a new material from scratch. Defaults totrue
.shader
(optional in update-existing mode, otherwise required): name of the shader to apply. May be a stock shader or one loaded by Shabby.preserveRenderQueue
(optional): whether the existing render queue of the material should be preserved when its shader is replaced. Defaults tofalse
, which will reset the render queue to the shader's default._Property = value
:KEYWORD {}
: the value is a boolean (true
orfalse
).FLOAT {}
COLOR {}
: the value is either a float color (r, g, b
orr, g, b, a
normalized to[0, 1]
), an HTML hex color (#rgb
,#rrggbb
,#rgba
, or#rrggbbaa
), or a named Unity color.VECTOR {}
: the value is a Vector4. All four components must be specified.TEXTURE {}
: the value is a GameData-relative path to a texture file, sans extension.There is also a new configuration under the existing
SHABBY
top-level node,ICON_SHADER
, with the string-valued keysshader
andiconShader
. It specifies that the shader with the given name is to be substituted when used in an icon prefab. Without this configuration, all custom shaders will be replaced by stock code withKSP/ScreenSpaceMask
in icon prefabs and thus editor part icons.Material replacements are applied in
PART
s using theSHABBY_MATERIAL_REPLACE
node. It contains the following items:materialDef
(required): the unique identifier of the material definition to apply.targetMaterial
key with a string value, specifying that the existing material with that name is to be replaced. This is the recommended workflow.targetTransform
key with a string value, specifying that all meshes under that transform (recursively) are to have their materials replaced.ignoreMesh
keys with string values, specifying that the mesh with the given name is to be ignored even if it matches one of the target conditions. This applies to the mesh itself only, not any of its children.Multiple material replacement nodes may be defined in the part, but they should apply to distinct meshes. The behavior in case of overlap is unspecified.
All of the above configurations may be modified by ModuleManager.
The material replacement is performed once per part, during prefab compilation. The result is indistinguishable from the model
mu
natively containing the replaced material. In particular, this is compatible with existing texture switching mods such as B9PartSwitch.An example configuration:
Fixes #7.