About Store Forum Documentation Contact
Donations:
309$/mo



Post Reply 
Material change on mesh
Author Message
Brainache Offline
Member

Post: #1
Material change on mesh
Hey there...

If you have a mesh rendering multiple times, how can you change the material for a one instance of the mesh?

ie ... if you have a player mesh and render 100 players but want one to have a different skin...
11-06-2011 08:14 PM
Find all posts by this user Quote this message in a reply
Driklyn Offline
Member

Post: #2
RE: Material change on mesh
Second code snippet in this post: http://www.esenthel.com/community/showth...9#pid28419

There is also MaterialLock:

Code:
UInt Human::drawPrepare()
{
    MaterialLock = mat; // set overriding material

    UInt modes = super::drawPrepare(); // draw character
    MaterialLock = NULL; // clear material

    return modes;
}
11-06-2011 08:22 PM
Find all posts by this user Quote this message in a reply
Brainache Offline
Member

Post: #3
RE: Material change on mesh
ah... drawPrepare.. gotya.. thanks!
11-06-2011 08:24 PM
Find all posts by this user Quote this message in a reply
Harry Offline
Member

Post: #4
RE: Material change on mesh
Hi,

I'm facing similar problem but I don't want change material on only one mesh but edits it. For example when object is hit is't material glow is smoothly set to max value. Currently every object using the same mesh glows.



EDIT:

I used normal Material variable without using cache and I got what I want, so I want change my question.

Code:
Material material; T.material=*obj.material();

How good solution is it? Are there anothers better (I'm thinking here mainly about optimization) solutions?[/code]
(This post was last modified: 07-22-2012 01:02 PM by Harry.)
07-22-2012 01:02 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply