Mesh and vertex buffer

Q and A about functionality and how to solve a special task for your application.

Moderator: Support

VincentPix
Posts: 44
Joined: 06 Nov 2014, 15:07

Mesh and vertex buffer

Post by VincentPix » 08 Oct 2015, 15:31

Hello

Is it possible to create a mesh from scratch ? (position of vertices / indices / normal / UV)

And/or modify one ? (e.g. moving the vertices of a rectangle / giving new positions)

Could be really useful for a lot of cool stuff : "shape surface like" object, texture displacement,...

Thanks

User avatar
lerou
Posts: 337
Joined: 06 Sep 2013, 07:14
Location: Hamburg, Germany

Re: Mesh and vertex buffer

Post by lerou » 08 Oct 2015, 15:41

yes and no. You can modify stuff in the Vertex Shader. You can't create/modify meshes before rendering.

VincentPix
Posts: 44
Joined: 06 Nov 2014, 15:07

Re: Mesh and vertex buffer

Post by VincentPix » 08 Oct 2015, 15:53

Hi Lerou

thank you

I already use the vertex buffer but always with math functions : sin to create waves in the z axis, stuff like that.

but I can't find how to move the xy positions of the vertices of a rectangle to specific positions.

I imagine there is may be a way to calculate a transform matrix from 4 positions and multiply this matrix in the vertex shader. ???

User avatar
lerou
Posts: 337
Joined: 06 Sep 2013, 07:14
Location: Hamburg, Germany

Re: Mesh and vertex buffer

Post by lerou » 08 Oct 2015, 16:01

Sure, doing that all the time. Check out some of the Glare plugins in the Store :)

VincentPix
Posts: 44
Joined: 06 Nov 2014, 15:07

Re: Mesh and vertex buffer

Post by VincentPix » 08 Oct 2015, 16:20

Know your plugins : really cool !

thank you

TVM Cracklings
Posts: 33
Joined: 30 Sep 2015, 10:49

Re: Mesh and vertex buffer

Post by TVM Cracklings » 09 Oct 2015, 07:01

Right now in Ventuz there's no way to access the FBO afaik. Though normally you wouldn't want to modify the models directly anyway.

Instead, like lerou said, the normal approach would be to load your mesh, and transform it in the vertex shader using matrices. That's what modern GPUs are designed for. You let the shaders do the actual computing, and everything else makes sure that the computing is under control, i.e. load mesh, compile shaders, populate the FBO, and then feed the GPU pipelines with the FBO, where the computing actually starts to happen.

In case a mesh should be modified, artists are in charge of that. They will use their tools to create a new mesh and all you have to do is to hand the new mesh over to your shaders.

User avatar
lerou
Posts: 337
Joined: 06 Sep 2013, 07:14
Location: Hamburg, Germany

Re: Mesh and vertex buffer

Post by lerou » 09 Oct 2015, 10:39

TVM Cracklings wrote:That's what modern GPUs are designed for.
That's what old GPUs were designed for ;) Modern GPUs offer compute shaders and are designed for you to generate and modify geometry. That's the dream! However in Ventuz I'd already be happy if I could generate geometry or textures from a script, because I need that all the time for effects. Not for models though, that's really a designer's job :)

TVM Cracklings
Posts: 33
Joined: 30 Sep 2015, 10:49

Re: Mesh and vertex buffer

Post by TVM Cracklings » 09 Oct 2015, 16:17

lerou wrote:That's what old GPUs were designed for ;) Modern GPUs offer compute shaders and are designed for you to generate and modify geometry.
Excuse me, I was thinking about DX7 when talking about "modern gpu" :lol:

To make the point clear, you were absolutely right. I was just trying to keep it as simple as possible, and I think for beginners (I'm no expert either btw.), VS+PS would probably be enough to play around for a while, till they eventually bump into the limit of this DX9 pipeline, and think, "well, I wish I could do this in my shader..." Only then can they really appreciate the coolness of those new features, and understand why they were implemented on the hardware level the way they are.

At least that's what happened to me anyway.

More on topic: I was actually thinking about a GPU based particle system in Ventuz the other day, and ... yeah. Wasn't thinking properly when I wrote about the model, I'd take that back :oops: Would indeed be nice if we could interact with the mesh loader in some way.

P.s., Does anybody have any insight as to whether a more up-to-date version of custom shader compiler will be supported in Ventuz5?

User avatar
lerou
Posts: 337
Joined: 06 Sep 2013, 07:14
Location: Hamburg, Germany

Re: Mesh and vertex buffer

Post by lerou » 09 Oct 2015, 16:21

There's already a great particle system for Ventuz ;)

VincentPix
Posts: 44
Joined: 06 Nov 2014, 15:07

Re: Mesh and vertex buffer

Post by VincentPix » 15 Oct 2015, 14:59

Hi there

Happy of this cool discussion.

I'm actually struggling to find the right way to manage this "GPU spread".
I thought to an array of float4x4 but can't figure if the shader allow that. ?

I've already find a way to edit live the 4 vertices of a simple rectangle (a dynamic shape surface).
I have to find the way for a more complex grid (tesselation 16x16) to have correct UV mapping. I think I will look for an "homography transformation matrix". Does that exist ?

thanks

Lerou said
However in Ventuz I'd already be happy if I could generate geometry or textures from a script, because I need that all the time for effects. Not for models though, that's really a designer's job :)
Like++

Post Reply