Jump to content
  • Advertisement
Sign in to follow this  
EternityZA

blender: exporting vertex material

This topic is 2977 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

Hey. My python blender export script can export the materialIndex(colour) of a face just fine but i would like to get the materialIndex of the vertices instead. Is this possible? Thnx in Advance

Share this post


Link to post
Share on other sites
Advertisement
I'm pretty sure that the material index is stored in the face data structure, so you need to look up the face you care about and use that. Keep in mind that vertices can be shared between faces.

Cheers,

Bob

Share this post


Link to post
Share on other sites
Thnx. Ok so the vertex itself cannot have a colour? i mean what if i wanted to create a face that blends between two colours. wouldnt i somehow have to asighn those different colours to the vertices of the face. Or am i just confused.

Share this post


Link to post
Share on other sites
Quote:
Original post by EternityZA
Thnx. Ok so the vertex itself cannot have a colour? i mean what if i wanted to create a face that blends between two colours. wouldnt i somehow have to asighn those different colours to the vertices of the face. Or am i just confused.


Exactly, you do it to the face vertices, or in other words, the indices contained in the face data structure.

Share this post


Link to post
Share on other sites
Sorry im stil a bit lost. How would i do that? the vertices in the face data structure does not seem to contain any material information. unless im missing it.

Share this post


Link to post
Share on other sites
Look Here, mat gives you the face material index, so you get the material as follows:


material = mesh.materials[face.mat]


face.verts gives you references to the vertices and uv texturing coordinates for each vertex.

Note that verts are of type MVert a wrapper or reference object around the actual vertex coordinates.


Here is a link to the whole API documentation.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!