Z
Zaid
Guest
GMS2 IDE v2.2.1.375
GMS2 Runtime v2.2.1.291
Preface:
I have been briefly learning how 3D works within GMS2 and am trying to write a simple 3D game by scratch so I understand all of the ins-and-outs. No 3rd party extensions and 3rd party scripts are only allowed if I fully understand them. Just clarifying to avoid recommendations of extensions to download to do the same thing much quicker. I'm trying to take the long route.
Setup:
I am currently in the process of writing a Wavefront model loader (.obj/.mtl) so I can import external models into my game. Loading the .obj works fine. It saves the loaded model as a vertex buffer. Loading .mtl files, on the other hand, only works partially as of yet. For those who don't already know; an .mtl file is a Wavefront materials file which defines the textures, colors, etc of surfaces on the vertex buffer loaded from an associated .obj file. Currently only the material color and alpha values are loaded from the .mtl file and actually applied to the model vertex buffer.
Problem:
Since multiple different textures are defined within an .mtl file and used on the vertex buffer at different points... obviously this needs to be reflected in the model. Currently I am only aware of using 'vertex_submit(vbuff, pr_trianglelist, -1)' to actually render the model onto the screen. The problem arises from the fact that this function only allows for 1 texture to be applied to the entirety of the vertex buffer but as we already know, the .mtl file calls for multiple textures.
Question:
How would you recommend mapping multiple texture files onto a single model?
Are any of my ideas below on the right path? Why can I map colors to vertices in a vertex buffer but not textures?
Current ideas for possible solutions:
(A) Write a script to automatically map the multiple textures onto a single texture to use to wrap around the entire vertex buffer.
(B) Divide the model into multiple different vertex buffers based on texture used (or lack therefor of) and 'vertex_submit()' them all separately.
(C) Manually draw each vertex (Somehow. Unsure how this would be accomplished as of yet.) changing to the appropriate material/texture as needed.
Thanks in advance for any help! All suggestions, hints, pointers, tips, links to docs, etc are very appreciated!
GMS2 Runtime v2.2.1.291
Preface:
I have been briefly learning how 3D works within GMS2 and am trying to write a simple 3D game by scratch so I understand all of the ins-and-outs. No 3rd party extensions and 3rd party scripts are only allowed if I fully understand them. Just clarifying to avoid recommendations of extensions to download to do the same thing much quicker. I'm trying to take the long route.
Setup:
I am currently in the process of writing a Wavefront model loader (.obj/.mtl) so I can import external models into my game. Loading the .obj works fine. It saves the loaded model as a vertex buffer. Loading .mtl files, on the other hand, only works partially as of yet. For those who don't already know; an .mtl file is a Wavefront materials file which defines the textures, colors, etc of surfaces on the vertex buffer loaded from an associated .obj file. Currently only the material color and alpha values are loaded from the .mtl file and actually applied to the model vertex buffer.
Problem:
Since multiple different textures are defined within an .mtl file and used on the vertex buffer at different points... obviously this needs to be reflected in the model. Currently I am only aware of using 'vertex_submit(vbuff, pr_trianglelist, -1)' to actually render the model onto the screen. The problem arises from the fact that this function only allows for 1 texture to be applied to the entirety of the vertex buffer but as we already know, the .mtl file calls for multiple textures.
Question:
How would you recommend mapping multiple texture files onto a single model?
Are any of my ideas below on the right path? Why can I map colors to vertices in a vertex buffer but not textures?
Current ideas for possible solutions:
(A) Write a script to automatically map the multiple textures onto a single texture to use to wrap around the entire vertex buffer.
(B) Divide the model into multiple different vertex buffers based on texture used (or lack therefor of) and 'vertex_submit()' them all separately.
(C) Manually draw each vertex (Somehow. Unsure how this would be accomplished as of yet.) changing to the appropriate material/texture as needed.
Thanks in advance for any help! All suggestions, hints, pointers, tips, links to docs, etc are very appreciated!