shadowmage45 / TexturesUnlimited

KSP Shader, Texture, and Modeling Utilities
GNU General Public License v3.0
29 stars 17 forks source link

Support for Float-Based Metallic/Smoothness #11

Closed Electrocutor closed 7 years ago

Electrocutor commented 7 years ago

On the SSTU/PBR/Metallic shader, could you add two properties '_Metallic' and '_Smoothness' as floats that default to 1.0 and are used as multiplier to the _MetallicGlossMap?

This would allow us to just use the default "white" _MetallicGlossMap alongside setting a specific metallicy and smoothness without needing to provide and load a single 1x1 pixel texture.

Example:

TEXTURE // gold { shader = SSTU/PBR/Metallic texture = _MainTex,

PROPERTY
{
    name = _Color
    color = 1.0,0.84,0.0
}
PROPERTY
{
    name = _Metallic
    float = 0.8
}
PROPERTY
{
    name = _Smoothness
    float = 0.9
}

} TEXTURE // silver { shader = SSTU/PBR/Metallic texture = _MainTex,

PROPERTY
{
    name = _Color
    color = 0.75,0.75,0.75
}
PROPERTY
{
    name = _Metallic
    float = 0.8
}
PROPERTY
{
    name = _Smoothness
    float = 0.9
}

}

shadowmage45 commented 7 years ago

Sounds good. Will work on getting these added for the next release. I was trying to keep the shader setups as simple as possible (for performance considerations)... but sometimes there is a thing as 'too simple' (and I don't think there is much of a cost for shader uniforms).

Electrocutor commented 7 years ago

I expect that blending between maps costs a decent bit, but I can't imagine a single float multiplier should affect much.

shadowmage45 commented 7 years ago

A MUL instruction is far cheaper than a texture-sample, bordering on 'free' on modern hardware. About as cheap as an instruction gets.