Modifying the Vertex Buffers for Deformation Purposes

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
Post Reply
Helderash
Gnoblar
Posts: 15
Joined: Mon Jan 29, 2007 12:40 am

Modifying the Vertex Buffers for Deformation Purposes

Post by Helderash »

Hey folks!

I've been using Irrlicht for a current project, but Im finding my current task nigh on impossible to complete there, and am considering porting it across to Ogre3D. I just wanted to ensure that I'd have an easier time with Ogre.

I'm working on new methods of deformation under collision, and hence will need access to the vertex buffers of a 3D mesh. Essentially, after a number of calculations I'll end up with a displacement array of the following form:

disp = { x1, y1, z1, ...... , xn, yn, zn }.

x1, y1, and z1 relate to the displacements of the first vertex along the x-axis, the y-axis and the z-axes respectively. In other words I need to add these values to the co-ordinates of the corresponding vertex.

The trouble I had with Irrlicht is applying the displacements to the correct vertices. The ordering of the vertices in Irrlicht does not follow an ordering scheme I can easily discern (I couldn't find a method to map to it at least), and the only option I was presented with was manually filling the vertex buffer myself. However, as I'm dealing with mesh's on a scale of well over a thousand vertices this wasn't much of an option.

As Im sure NXOgre deals with similar things (deformation of mesh's) I thought Ogre 3D would have more capable tools for dealing with such situations. Does anyone have any idea of how Ogre deals with such things?

Thankyou for all the help, it is very much appreciated!
User avatar
Game_Ender
Ogre Magi
Posts: 1269
Joined: Wed May 25, 2005 2:31 am
Location: Rockville, MD, USA

Post by Game_Ender »

Not to burst any bubbles but have you seen this. Hopefully someone can speak about Ogre mesh vertex order.
Helderash
Gnoblar
Posts: 15
Joined: Mon Jan 29, 2007 12:40 am

Post by Helderash »

I have read the paper relating to the production of the game, and I'm doing something pretty different.

I'm currently working with Finite Element methods, an approach to deformation discussed in that paper but not used due to being too computationally expensive at time of writing (I believe). My professors are interested in manipulating the method in various ways to produce highly realistic deformations at an acceptable rate for the modern market, using a few innovative tricks they've been hiding up their sleeves.
User avatar
haffax
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4823
Joined: Fri Jun 18, 2004 1:40 pm
Location: Berlin, Germany
x 7
Contact:

Post by haffax »

I'm not sure what you're asking really. Yo can of course have a second buffer with your offsets next to a buffer with the positions. Ogre doesn't impose any restrictions itself on how you layout your vertex format. The problem is that I do not know what you mean with assigning these displacements to the vertices. Of course you have to know what displacement vector applies to what vertex. Ogre doesn't care about vertex order itself. The order is just as they are defined in the mesh. So as long as *you* know in what order vertices are, you can add a second buffer with your offsets and apply the offset in a shader or on the CPU, as you want.
team-pantheon programmer
creators of Rastullahs Lockenpracht
Helderash
Gnoblar
Posts: 15
Joined: Mon Jan 29, 2007 12:40 am

Post by Helderash »

Ah, that pretty much answers my question.. thankyou very much!

I'm rather new to the world of 3D programming, or 3D graphics at all really. You wouldn't happen to know if a 3D package such as Blender for example will allow me to specify my own vertex ordering would you?

The mathematics I'm currently using orders nodes (or vertices) along the x-axis, then the z-axis, then the y-axis (im working with cubes at the moment), so node 0 will be the top-front-left corner of my FEA mesh cube, and node 1 the next node alone the x-axis (in cube co-ordinates). I just needed to make sure I was applying the correct displacement to the correct vertex, as you mentioned. :)
User avatar
haffax
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4823
Joined: Fri Jun 18, 2004 1:40 pm
Location: Berlin, Germany
x 7
Contact:

Post by haffax »

No I don't know what order modelling tools store their vertices. Probably in the order they are created. But there is by no means a guarantee.
Ideally you sort the vertices yourself in the order you need them, along with the indices in the index buffer.
team-pantheon programmer
creators of Rastullahs Lockenpracht
Helderash
Gnoblar
Posts: 15
Joined: Mon Jan 29, 2007 12:40 am

Post by Helderash »

Okay, thankyou very much for the help! I'll play around with things a little and see what I can work out.
Post Reply