# Easy mesh deformation available?

Hello

I am trying to find something to apply some random deformation to

my spheres to get something like asteroids.

In 3DMax there are some so called "Modifiers" (noise, displace, skew) that do that

kind of thing.

I tried to randomly shift around vertexes but this tends to

create holes at the sphere surface.

Thanks very much.

You should be able to modify the geometric information inside the Sphere. How are you doing it? Are you calling updateWorldData() and updateGeometricState() on the sphere after changing its internals?

I assume i call updateGeometricState() after manipulating the vertices, but this is not

the way it should be done at all, unless the vertice manipulating is being done

by some sophisitcated algorithm (with some sort of smoothing out the randomness when

moving around the vertices).

I am searching for something that can sqash and pull vertices of the sphere as whole.

Something like the bezier mesh but for spheres or any arbitrary mesh. A few random

control points should be randomly pushed around. Is that possible?

Someone posted some subdivision surfaces stuffâ€¦that might be something you want to look at, if I understand the concept of subdivision surfaces correctly.

If I understand correctly, you want to control some special deformations on your spheres with some parameters or control pointsâ€¦ If this is the case, I suggest you create your own algorithm to handle it instead of trying to fit another general-purpose algorithm to it. I think if you do it yourself, the result will be better and the performance superior.

I think the problem is (certainly the one I had when I tried this) was that the sphere is actually made from two 'bowls' or semi spheres.  So if you just randomly push all the verts around the ones round the equator are doubled up (the bottom layer of each bowl) so if you don't modify them by the same amount you get holes.

So basically you'd need to find out which vertices of each bowl match up and modify them by the same amount.  If this isn't the problem you're getting (only holes around the middle) then feel free to ignore me

why do you do all these modifications at runtime? wouldn't it be easier to create those asteroids in a dedicated modeler and then just load them into jme?

Because you might want hundreds of different shaped asteroids, and doing that manually would take ages.

Plus you'll never get two of the same shape!

will the user notice that?

Not if you generate them before hand.

I.e. Not in the main game loop.

sorry, i meant to ask: "will the users notice that there are hundreds of different shaped asteroids?"

please don't get me wron, i'm not trying to be a smartass. i was just trying to understand what your intent is.

i suppose that for me personally (as a user/gamer) about 20-30 different asteroids would be more than enough variation.

@sfera: Yes, but having 30 models still makes you have to design them (and apply textures, etc)  :|. I am all pro algorithmic solutions to automatic model generation (not being good at all at artistic modeling, and wanting to think I am good at algorithms  ).

So in my opinion, it is perfectly fair to want to generate asteroids on the fly.

Not just asteroids (spheres), deformation of any geometric shape would be nice.

Gentleman Hal said:

I think the problem is (certainly the one I had when I tried this) was that the sphere is actually made from two 'bowls' or semi spheres. So if you just randomly push all the verts around the ones round the equator are doubled up (the bottom layer of each bowl) so if you don't modify them by the same amount you get holes.

So basically you'd need to find out which vertices of each bowl match up and modify them by the same amount. If this isn't the problem you're getting (only holes around the middle) then feel free to ignore me :P

Given the above wouldn't it be easier to deform a box?

@duenez:

i think you got it wrong. he doesn't want to generate them on the fly:

Not if you generate them before hand.

I.e. Not in the main game loop.

i also love procedural content generation, but as far as i understood, he wants to generate asteroids to load them later. in such a case one probably would still want to make some adjustments (geometry, texture coords). in such cases the jme format isn't the best to work with (unless he also has a tool for doing such adjustments).

on the other side, i'm sure he could write a really good "asteroid generation algorithm/tool", but i'm not sure which path is the one of the less effort.

deformation of every geometric shape is possible. it just depends on what kind of results you are expecting. :P

Well, I guess generating 30 asteroids on the fly would be more reasonable than having 300 different models on disk that are hardly distinguishable from each other.

sfera said:

deformation of every geometric shape is possible. it just depends on what kind of results you are expecting. :P

Just a bit of noise would be good. Randomly reposition vertices according to a noise threshold.