Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I am new to OpenGL, I am able to render a model object (a human model) that is using .obj and .mtl file in iOS.

Now I want to make a modification to the loaded model. For example, I want to change the height, or change the shoulder width, stomach size, et cetera.

Is this possible ? If so, how do I go about it?

share|improve this question
    
it's possible but since I'm not sure about how I don't post an answer. the main idea is just like loading a mesh just instead of file your object is stored in memory. these are called "dynamic meshes" –  Ali.S Feb 2 '12 at 10:48
    
also this question might help you :gamedev.stackexchange.com/questions/13808/… –  Ali.S Feb 2 '12 at 10:50
    
I don't mean to be a jackass, but isn't this the whole point of programmable pipeline in v2+? –  slf Feb 2 '12 at 15:26
2  
Vertex/pixel shaders cannot directly persist any changes they make, so unless you use features newer than 2.0 (geometry shaders, stream output) you can't necessarily use shaders for all kinds of modification that the OP may desire. –  Josh Petrie Feb 2 '12 at 15:56
    
@Pritam - how are you storing the model's geometry and sending it ot the GPU? VBOs? –  Josh Petrie Feb 2 '12 at 15:56

2 Answers 2

up vote 1 down vote accepted

Now I want to make a modification to the loaded model. For example, I want to change the height, or change the shoulder width, stomach size, et cetera.

Is this possible ? If so, how do I go about it?

Yes, it is possible.

The "How" depends a lot on what exactly you're after. Altering height can be done simply by applying a scaling transform matrix before rendering. The other things you mentioned require more work, and there are several ways to go about it.

One way would be to make several versions of the mesh and interpolate between the desired features (like stomach size). Interpolating between two meshes is straightforward, but if you have several features you want to alter (like stomach size and hip width), it gets a bit more complicated. One way to solve this is to somehow "paint" weights to the vertices (through, for example, vertex colors in modelling programs) and use those when interpolating, in order to avoid the change of one thing affecting some other thing.

Or maybe you just want to apply some kind of "space modifier" to the mesh, where you just specify that "within this area, scale things outwards" or some such.

It all.. depends. =)

share|improve this answer

If it is a model you make yourself you could add bones to it and adjust their transform (probably the scale in your case) in the gamelogic. I think this would be best if done using Jari's method assigning weights through vertex colors.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.