Open japsuu opened 1 week ago
This would also allow us to get rid of the setDefaultTextures
parameter in the Material
constructor:
public Material(AssetRef<Shader> shader, string name, bool setDefaultTextures = true) : base(name)
{
...
if (setDefaultTextures)
SetDefaultTextures();
}
public void SetDefaultTextures()
{
SetAlbedoDefault();
SetNormalDefault();
SetSurfaceDefault();
SetEmissionDefault();
}
public void SetAlbedoDefault() => SetTexture(MAIN_TEX, DefaultAlbedoTex);
public void SetNormalDefault() => SetTexture(NORMAL_TEX, DefaultNormalTex);
public void SetSurfaceDefault() => SetTexture(SURFACE_TEX, DefaultSurfaceTex);
public void SetEmissionDefault() => SetTexture(EMISSION_TEX, DefaultEmissionTex);
Is your feature request related to a problem? Please describe. Not a problem per se, but you need to manually assign the default properties of a material after creating the material instance. This is clunky and unnecessary. For example, if the shader used by a material requires a texture, you might want to set it to a magenta texture by default.
Describe the solution you'd like I'd like to be able to define property defaults directly in the KSL (Korpi Shader Language) code:
Describe alternatives you've considered None
Additional context This feature would work similar to Unity's ShaderLab defaults: