Forum Groups
  All forums
    Help & Feedback
      Questions
      Work in progress
      Finished Art
      Non-Max related
    Community
      Offtopic
      News
    Hardware
    Photography


Featured Threads
  inspiration alert!!!
(36 replies)
  Indespensible MaxScripts, Plugins and 3rd Party Tools
(37 replies)
  The allmighty FREE Resources Thread !
(17 replies)
  spam alert!!!
(4886 replies)
  Maxforums member photo gallery index
(114 replies)
  Maxforums Member Tutorials
(89 replies)
  three cheers to maxforums...
(240 replies)
  101 Things you didnt know in Max...
(198 replies)
  A Face tutorial from MDB101 :D
(95 replies)
  Maxforums.org Members Gallery
(516 replies)
  SON OF POST YOURSELF
(637 replies)
  Dub's Maxscript Tutorial Index
(119 replies)

Maxunderground news unavailable

Sorting Face indexes according to a multi-material.
show user profile  Seyren
Alright, i'm having an issue i don't really know how to solve...

I'm coding my own exporter for a game engine i'm working on, and this is how the engine reads the textures from a multi-material mesh.

From Face 1 to 10 -> Use Texture 1
From Face 11 to 20 > Use Texture 2

Now the problem i have is that when i'm seting up a multi material, the face index is not sorted this way, leading up to:

From face 1 to 3 -> Use Texture 1
From Face 4 to 8 -> Use Texture 2
From Face 9 to 11 -> Use Texture 1

And so on, it repeats a lot of times, and this would not be practical for the engine if the mesh is too complex.

So my question is, is there any way to sort the vertex index or the face index in order to make all the faces from X to X have a corresponding material? I know it's kind of hard to ask for something like this, but i was wondering if a script or any feature would do this.

Thanks in advance :P
read 415 times
4/14/2016 7:34:04 PM (last edit: 4/14/2016 7:34:04 PM)
show user profile  Garp
Face indexing is dictated by the order in which the faces are created, not the material assignments.
You'd have to implement a secondary index and do the mapping through an array.




read 412 times
4/14/2016 8:41:05 PM (last edit: 4/14/2016 8:41:05 PM)
show user profile  Seyren
Do you think there could be an algorythim to recreate the mesh based of the material FACE ID's? that way it could solve the problem, a little bit costly maybe...
read 401 times
4/15/2016 1:27:56 AM (last edit: 4/15/2016 1:27:56 AM)
show user profile  Garp
I don't know what format you're exporting to but if the game engine determines the face indices by the ordering of their definitions, you just have to sort an array of indices by materialIDs. Once sorted, you would read the face definitions in the new order and export that.
Note that the definitions themselves do not change. Also don't forget to use the same ordering for whatever UV map(s) you're exporting, since there's a one-to-one correspondance between mesh faces and texture faces.




read 399 times
4/15/2016 1:58:24 AM (last edit: 4/15/2016 2:00:01 AM)
#Maxforums IRC
Open chat window


Support Maxforums.org