Advertisement Jump to content
Sign in to follow this  

Dynamically changing textures on a mesh

This topic is 4892 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!