-
Notifications
You must be signed in to change notification settings - Fork 159
Description
Describe the bug
$detailscale doesn't function on SDK_VertexLitGeneric when $phong and $bumpmap are enabled at once.
Steps to reproduce
Steps to reproduce the behavior:
- Have a
SDK_VertexLitGenericmaterial with$detailscale,$phong, and$bumpmapat the same time $detailscalewill no longer function
Expected behavior
$detailscale should be compatible with these parameters, as it is functional with stock VertexLitGeneric.
Media
These are two screenshots from Nukedrabbit95 on the Map Labs Discord server showing a barrel using all of the above parameters. The first screenshot shows VertexLitGeneric and the second screenshot shows SDK_VertexLitGeneric.
Additional context
This seems to be caused by this Mapbase code in the phong shader which uses the 4th constant instead of the detail scale:
#ifdef MAPBASE
// The original code makes it seem like we have the opportunity to support both $bumptransform and $detail at the same time,
// and that may or may not have been Valve's intention, but we'd need to add another texcoord for this and it's already
// a limitation with the non-skin shader anyway.
if ( bHasBump )
{
pShader->SetVertexShaderTextureTransform( VERTEX_SHADER_SHADER_SPECIFIC_CONST_4, info.m_nBumpTransform );
}
else
#else
if( bHasBump )
{
pShader->SetVertexShaderTextureTransform( VERTEX_SHADER_SHADER_SPECIFIC_CONST_2, info.m_nBumpTransform );
}
#endif
if ( hasDetailTexture )
{
if ( IS_PARAM_DEFINED( info.m_nDetailTextureTransform ) )
pShader->SetVertexShaderTextureScaledTransform( VERTEX_SHADER_SHADER_SPECIFIC_CONST_4,
info.m_nDetailTextureTransform,
info.m_nDetailScale );
else
pShader->SetVertexShaderTextureScaledTransform( VERTEX_SHADER_SHADER_SPECIFIC_CONST_4,
info.m_nBaseTextureTransform,
info.m_nDetailScale );
}This Mapbase code is my code. I remember typing it a very long time ago. I do not remember why I typed it at all. What was I talking about? Why couldn't it have stayed as VERTEX_SHADER_SHADER_SPECIFIC_CONST_2? Was $bumptransform not functional before when using it? If so, why did I make it remove the detail texture transform functionality? Was I convinced that $bumpmap and $detail were never meant to be used together on phong materials? Is this connected to something on the non-skin shader? What is going on here?

