A new method proposal: DrawMeshBufferInstances

Discuss about anything related to the Irrlicht Engine, or read announcements about any significant features or usage changes.
The_Glitch
Competition winner
Posts: 523
Joined: Tue Jan 15, 2013 6:36 pm

Re: A new method proposal: DrawMeshBufferInstances

Post by The_Glitch »

Thanks for the newest features Irrlichts Dev's. Gonna check this out later.
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Re: A new method proposal: DrawMeshBufferInstances

Post by Mel »

Hmm... curious indeed. I think i start to get how it works. So, on the shader, it is like it was provided a single, "fat" vertex, but that vertex format is actually built out of two separate vertex buffers, that are just combined on the fly and provided to the vertex processor following the index buffer, which is still tied to the first vertex buffer but reused as many times as necesary by the second... I don't know if it is genius or just plainly idiot to make instancing like that :lol:

Wasn't it simpler to provide an array of matrices and render the meshes like that? or perhaps, make use of that mechanism underneath, but provide a "front end" that isolated the double vertex buffer usage from the user? When one thinks of Instancing, thinks just of replicating meshes not... odd obscure vertex buffer building mechanisms.
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
Granyte
Posts: 850
Joined: Tue Jan 25, 2011 11:07 pm
Contact:

Re: A new method proposal: DrawMeshBufferInstances

Post by Granyte »

Well the the advantage of exposing the akward underlyng vertexbuffer mechanic is that it allow building of specific per instance data for more advanced user to perfom something like this
https://www.youtube.com/watch?v=wbNGoUSjY6I

in this i send per star temperature in the instance buffer i also intend to pass more data to make variable and more special stars in one pass in the future

in the example there is a simple interphase that allow you to use only think about where you wanna put your meshes this interphase even provide an empty scenenode for you to move each instance individualy you can even use irrlicht animators without worrying about anything
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Re: A new method proposal: DrawMeshBufferInstances

Post by Mel »

Of course, that is the advantage of being able to pass per instance data. I guess they chose flexibility over simplicity.

And DX and GL work the same in this matter?

Is it possible to swap the meshbuffer used for the mesh to choose one which varies the detail at will? For instance, i have simple meshbuffers of the 3 LODs of a tree, and i want to keep the same instance buffers, but swap the tree meshbuffer based on distance (i render batches of trees with each instance buffer) would it be still possible or would i have to do other stuff?

Mmm... i think this question is already answered in the instancing example...
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
Granyte
Posts: 850
Joined: Tue Jan 25, 2011 11:07 pm
Contact:

Re: A new method proposal: DrawMeshBufferInstances

Post by Granyte »

You would have to build your own lod grouping code and render each lod group it's not impossible but i don't think the exemple currently does it

i intend to build such a thing for my game


Yes when i built the instancing i chose to make it as flexible as possible and then build a simple to use example that manages everything on top
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Re: A new method proposal: DrawMeshBufferInstances

Post by Mel »

No, the example doesn't do it, but it does something important, which is to give the ability to swap meshes, i have yet to check if i can make any use of it or not, but in the mean time...
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
Post Reply