Jump to content

Applying mateiral to a mesh instance


Code_Man

Recommended Posts

I would like to apply a material to specific instances of meshes in the game trough torquescript, but i dont know how to do this.

Its fine if it applies to the whole model instead of just a specific material in a collada node.


I also noticed that i seem to have to prepend the model name to a material when using collada models, this is a problem for me too since i reuse many materials for different models.

I only use collada for now, though if have to i could convert them to dts.


How could i go about this?

Link to comment
Share on other sites

Are you trying to apply lightmaps to the models? This is something I'm also interested in.


From what I know it is possible to swap materials per instance of a mesh through chosing a different skin. A skin is a material using the same namespace as the original material, maybe this feature could be extended for what you need, but this would need to happen on the fly.

Link to comment
Share on other sites

Are you trying to apply lightmaps to the models? This is something I'm also interested in.

Not really, at this stage atleast.

 

From what I know it is possible to swap materials per instance of a mesh through chosing a different skin. A skin is a material using the same namespace as the original material, maybe this feature could be extended for what you need, but this would need to happen on the fly.

Hmm, are the player models in uebergame using skins too for team colors?

If so i might perhaps be a able to figure it out on my own

Link to comment
Share on other sites

I setup my rock models to use skins, so any instance of a rock model can have any other rock material I have in the game, simply by changing the skin, you can try them out.

https://github.com/Duion/Uebergame/blob/master/art/textures/rock/materials.cs


The base material is "base_rock_main" and each skin replaces the "base" part of the name, so in the skin field of the shape you enter "plain_01" if you want to use the material "plain_01_rock_main" then the instance of the rock will change to that, this can also be changed on the fly through scripts like I do with some objects using team colors.

Link to comment
Share on other sites

  • 2 weeks later...

@DoyleWes

Anything that you can imagine, I use it on rocks, because they all use a seamless texture, so every other seamless texture will fit as well, limitations are objects with unique UV layout, since then other textures will no longer fit well and the other limitation is objects with multiple materials and of course some ways that do not allow changing skins like forest objects, but they have two materials also.


You could theoretically make anything into a skin so you can exchange anything with anything, but there are probably better ways through coding to do that.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...