Jump to content
  • Advertisement
Sign in to follow this  
JStryker

Dynamically changing textures on a mesh

This topic is 4822 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
Advertisement
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" />
<material>
<diffuse color="value" />
<yadda yadda />
</material>
</clothing>

<rinse and repeat>


Next, you describe your farmer using the same idea:

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


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.

Toolmaker

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!