Sign in to follow this  

Dynamically changing textures on a mesh

Recommended Posts

If I have a mesh, of a person for example, and it has a number of textures for things like pants, shirt, shoes, etc..., and I want to dynamically change the textures during game play based on the "type" of person (shopkeep, farmer, etc...) - what is the best way to do this? It seems very complicated to keep track of which materials have which textures associated. The only key seems to be the file name of the texture when you originally load the mesh. Regards

Share this post

Link to post
Share on other sites
How about describing the models using a file-format(Such as XML) and linking materials and textures together?

For instance, you have a farmer outfit, which have non-reflective materials(Obviously, since a shiney metal cotton shirt seems wrong to me). Instead of storing all this information in your model, your model only contains basic clothing, such as underwear.

So, you first describe your textures and materials:

<clothing name="farmer top" type="top">
<texture file="farmer-top.png" />
<diffuse color="value" />
<yadda yadda />

<rinse and repeat>

Next, you describe your farmer using the same idea:

<actor name="farmer">
<model name="some model" />
<top name="farmer top" />
<pants name="farmer pants" />
<... />

You then load these files, process them, and apply the proper textures during rendering. Voila, you got yourself custom modelled actors using the same base models.


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this