jit.gl.mesh index matrix example?

Jonas Margraf's icon

Jonas Margraf

12月 14 2013 | 2:52 午前

Hi everyone,

I'm trying to figure out how to use an index array to tell jit.gl.mesh which vertices of my vertex array to draw.

Could anybody share any working examples of how to go about creating such an index array?

I've been searching in the forums and beyond, but haven't been able to find any sort of patch that uses an index array or explains how to do it. Any help would be greatly appreciated!

Jonas

vcbcvfh67's icon

vcbcvfh67

12月 16 2013 | 8:49 午前

First of all, I have no idea what the answer to your question is. But I'm still going to try to help.

I’m trying to figure out how to use an index array to tell jit.gl.mesh which vertices of my vertex array to draw.

jit.gl.mesh requires a matrix to create a geometric surface, so keep that in mind.

If you're going to have a "normal-average-everyday" 3d model/animation then you should definitely model it in something like Blender or Maya and then load the model in with jit.gl.model.

However, you might want to do something more special when creating your 3D object, you could try generating the object with jit.gl.isosurf. Take a look at Day 5 at the following link: https://cycling74.com/wiki/index.php?title=Gen_Patch-A-Day

This patch explores the use of jit.gen to generate 3D matrices for use with jit.gl.isosurf.

Hopefully this helps!

|\|athan |)anziger .(om

Rob Ramirez's icon

Rob Ramirez

12月 16 2013 | 7:05 午後

Max Patch
Copy patch and select New From Clipboard in Max.

basic example:

Jonas Margraf's icon

Jonas Margraf

12月 16 2013 | 7:22 午後

Thanks Rob, this is what I was looking for.

Now, I'd like to tell jit.gl.mesh to only use those coordinates in the vertex array that have z = 0. Any idea how I would go about doing that?

My first idea was to iterate over the vertex array and test for z = 0, then put those coordinates that pass into another matrix which functions as the index array. Do you think that would work? I don't have access to Max right now, so I can't try it out at the moment...

Thanks for the help!

nesifao's icon

nesifao

1月 22 2015 | 11:39 午前

Hello!

I was looking to increase performances of my mesh generation in using the indexation vertices technics. I found your patch above usefull to see how it works but for me it won't increase performances because we don't use the shared vertices.

For me the correct example for indexation vertices will be something like this

Max Patch
Copy patch and select New From Clipboard in Max.

Can you please tell me if i'm right / wrong or if it is the same or if you make something internal to the gl.mesh object to find automatically the shared vertices and ignore them?

Thanks!

Rob Ramirez's icon

Rob Ramirez

1月 22 2015 | 6:54 午後

hi nesifao. no, there is no mechanism in gl.mesh that automatically ignores shared vertices. so yes, your example is a better demonstration of this feature.

Federico-AmazingMaxStuff's icon

Federico-AmazingMaxStuff

7月 13 2020 | 4:43 午後

Hey all,
how does this actually work when a 2D matrix is used to create the shape? Is also the index array a 2D matrix?

TFL's icon

TFL

9月 13 2024 | 11:55 午前

how does this actually work when a 2D matrix is used to create the shape? Is also the index array a 2D matrix?

Answering this 4 years old question for the future:

The index array is always 1D. So the vertex at coordinates 0 1 from a 3x3 matrix is at index 3.

Max Patch
Copy patch and select New From Clipboard in Max.