mirror of
https://github.com/Facepunch/sbox-public.git
synced 2025-12-23 22:48:07 -05:00
Support instanced tint on Blendable and Material::From( i ) (#3449)
* Support instanced tint on Blendable and Material::From( i ) Blendable supports vertex tint color, but was initially intended for world geometry so there was no point in working with instance color, now works fine https://files.facepunch.com/sampavlovic/1b2611b1/sbox-dev_qkWlvBOXW8.png * Build shaders
This commit is contained in:
@@ -257,6 +257,9 @@ PS
|
||||
Material p = Material::Init( i );
|
||||
p.Albedo = vColor.rgb;
|
||||
|
||||
// We want to support per-instance tint color as well
|
||||
vTintColor *= i.vVertexColor.rgb;
|
||||
|
||||
if ( ShaderVersion >= 1 )
|
||||
{
|
||||
p.Normal = TransformNormal( DecodeHemiOctahedronNormal( vNormalTexel.rg ), i.vNormalWs, i.vTangentUWs, i.vTangentVWs );
|
||||
|
||||
@@ -143,7 +143,7 @@ Material Material::From(PixelInput i)
|
||||
float4 vColor = g_tColor.Sample(TextureFiltering, i.vTextureCoords.xy);
|
||||
float4 vNormalTs = g_tNormal.Sample(TextureFiltering, i.vTextureCoords.xy);
|
||||
float4 vRMA = g_tRma.Sample(TextureFiltering, i.vTextureCoords.xy);
|
||||
float3 vTintColor = g_flTintColor;
|
||||
float3 vTintColor = g_flTintColor * i.vVertexColor.rgb;
|
||||
float3 vEmission = float3(0.0f, 0.0f, 0.0f); // Default emission value
|
||||
|
||||
material.Albedo = vColor.rgb * vTintColor.rgb;
|
||||
|
||||
Reference in New Issue
Block a user