Issues with overlaying materials

Grab your favourite IDE and tinker with the innards of game engines

Issues with overlaying materials

Postby atrblizzard on Mon Feb 11, 2013 11:20 pm

I'm trying to overlay a material onto a model entity, but I can't get the material to work at all. I'm using ForcedMaterialOverride under DrawModel but it seems there's no dice. The UnlitTwoTexture method would be suitable for me as well to achieve the results I need, although it won't read any proxy values from $texture2.
Is it possible to apply my own sine proxy values to my entity without the need to overlay a second entity for that?
That way I can enable it or disable it without issues.
atrblizzard
Member
Member
 
Joined: Sun Oct 17, 2010 12:24 pm

Re: Issues with overlaying materials

Postby Sandern on Sat Feb 16, 2013 10:11 am

Can you post your DrawModel function and show how you initialized your material?
Sandern
Regular
Regular
 
Joined: Thu Jun 30, 2005 1:08 pm
Location: Netherlands

Re: Issues with overlaying materials

Postby atrblizzard on Sun Feb 17, 2013 7:28 pm

It's from a tutorial but from what I understand, it's for overlaying a transparent material on top of the model's material.

Code: Select all
int C_ItemContainerAnimated::DrawModel( int flags, const RenderableInstance_t &instance )
{
   int retVal = BaseClass::DrawModel(flags, instance);

   if ( m_bGlowEnabled )
   {
      modelrender->ForcedMaterialOverride( materials->FindMaterial( "hud/lockhighlight_locked", TEXTURE_GROUP_CLIENT_EFFECTS ) );
      int retVal = BaseClass::DrawModel( STUDIO_RENDER | STUDIO_TRANSPARENCY, instance);
            modelrender->ForcedMaterialOverride(0);
      }

      return retVal;
}


It's also setting SetRenderMode(kRenderTransColor) from the server code along with these:

Code: Select all
void CItemContainerAnimated::EnableMaterialGlow(int r, int g, int b)
{
   SetRenderColorR(r);
   SetRenderColorG(g);
   SetRenderColorB(b);

   m_bGlowEnabled = true;
}


I doubt these are the necessary effects, not to mention they do not work at all for my case.
atrblizzard
Member
Member
 
Joined: Sun Oct 17, 2010 12:24 pm

Re: Issues with overlaying materials

Postby atrblizzard on Mon Feb 18, 2013 6:12 am


I've managed to get the desired effect using sine proxies to change the material's color for the fridge model by switching the model's skin from regular to highlighted but it's definitely not a effective solution to use for every entity.
atrblizzard
Member
Member
 
Joined: Sun Oct 17, 2010 12:24 pm

Return to Programming

Who is online

Users browsing this forum: No registered users