Vertex Color Morphing

What it says on the tin: a place to discuss proposed new features.
Post Reply
User avatar
ekt
Greenskin
Posts: 149
Joined: Thu Apr 01, 2004 5:55 pm
Contact:

Vertex Color Morphing

Post by ekt » Wed Sep 16, 2009 7:05 am

While a mesh is animating with morphing, it would be useful to be able to morph also color/alpha.
Today ogre manages only positional vertex buffer.
This would allow neat tricks like changing some mesh parts color or fading them during the animation. Artists could control this from their 3d app while designing the animation.

What do you think of it?
0 x

User avatar
madmarx
OGRE Expert User
OGRE Expert User
Posts: 1668
Joined: Mon Jan 21, 2008 10:26 pm

Re: Vertex Color Morphing

Post by madmarx » Thu Sep 17, 2009 8:37 pm

Maybe I am wrong but I thought this was already available through the Ogre::AnimableValue (OgreAnimable.h) + KeyFrame ?

Edit : well, I am wrong. Doing 1 animable for each vertex would be overkill !
0 x
Tutorials + Ogre searchable API + more for Ogre1.7 : http://sourceforge.net/projects/so3dtools/
Corresponding thread : http://www.ogre3d.org/forums/viewtopic. ... 93&start=0

User avatar
nedelman
Gnome
Posts: 315
Joined: Wed Feb 21, 2007 6:03 am
Location: San Francisco, California
Contact:

Re: Vertex Color Morphing

Post by nedelman » Thu Sep 24, 2009 10:43 pm

I'd like to see normal morphing as well. As it is, the same normals are always used which results in incorrect lighting.
0 x
http://www.ogremax.com - Ogre3D Scene Exporter for 3DS Max, Maya, and Softimage
http://www.linkedin.com/in/dereknedelman - My LinkedIn Profile

User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19261
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
Contact:

Re: Vertex Color Morphing

Post by sinbad » Tue Sep 29, 2009 4:49 pm

The reason is that the overhead for storing snapshots of all vertex properties is quite large, so we limited it to the position buffer - you should use skeletal animation for efficient animation of normals. You can't even interpolate normals 'properly' with morphing anyway, although you may be able to get away with a linear interpolate and renormalise in some limited cases. It may be something we can add as an option, but it comes up as a request extremely rarely.

Regarding vertex colours, a far more efficient way of doing this is to use a shader, or even simply a set scrolling texture coords referencing a texture which describes the colour animation. This is orders of magnitude faster than actually physically animating the vertex colours.
0 x

berger
Gnoblar
Posts: 9
Joined: Tue Apr 20, 2010 6:44 pm

Re: Vertex Color Morphing

Post by berger » Wed Apr 21, 2010 4:20 pm

Hello,
I have a question that relates to this thread. I am developing a facial animation program using blend shapes. The blend shapes are derived from high-resolution shape capture and CANNOT be approximated by bones. I want to use Ogre pose animation for this, but the gist I'm getting from the forums is that Ogre modifies only the vertex positions and does not update the vertex normals as the mesh deforms. If that is the case, I would like to try to manually update the normals, I suppose by computing triangle normals, adding those to the incident vertices and renormalizing. I realize this is computationally expensive but accurate normals are essential for rendering these meshes.

So two questions:

1) Is there is a way for Ogre to update the normals automatically?
2) If there is no way for Ogre to do it automatically, can you recommend an optimal strategy for doing it manually? Should this be done as a shading program?

Many thanks,
Michael
0 x

User avatar
lordsme
Gremlin
Posts: 167
Joined: Sun Mar 11, 2007 1:11 pm
Location: Turin, Italy
Contact:

Re: Vertex Color Morphing

Post by lordsme » Thu Apr 22, 2010 1:32 pm

1) Is there is a way for Ogre to update the normals automatically?
2) If there is no way for Ogre to do it automatically, can you recommend an optimal strategy for doing it manually? Should this be done as a shading program?
I have the same problem as Berger and the same questions... no idea?
0 x
My Portfolio
http://davidedigiannantonio.weebly.com

MESH - Mise-en-scene Helper
http://www.mesh-project.org/

ASALab @ Virtual Reality & Multimedia Park
http://www.vrmmp.it

User avatar
xavier
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 9481
Joined: Fri Feb 18, 2005 2:03 am
Location: Dublin, CA, US

Re: Vertex Color Morphing

Post by xavier » Sat Apr 24, 2010 7:35 am

The answer is #2. Sinbad already explained this all above.

How you deal with your normals is entirely up to you; regardless of the algorithm, doing this on the GPU is strongly recommended.
0 x
Do you need help? What have you tried?

Image

Angels can fly because they take themselves lightly.

berger
Gnoblar
Posts: 9
Joined: Tue Apr 20, 2010 6:44 pm

Re: Vertex Color Morphing

Post by berger » Sat Apr 24, 2010 1:34 pm

Then I guess I am looking for a way to update vertex normals using a shader. I'm not very experienced in shaders, so before I get into this I wanted to ask if what I want to do is feasible. My vertex shader would need access to the triangle list of the mesh, and refresh the triangle normals prior to updating the vertex normals. Is this possible or would I be wasting my time trying to figure out how to access triangles from a vertex program? Any suggestions or examples would be much appreciated.

If it is not feasible, I will have to recompute the normals in software and write the values to the hardware buffer.

On a further note, though I'm new to this forum, from what I've read I believe there *is* interest in having an option in Ogre to update vertex normals automatically during pose animation. I realize that blend shapes are not favored in games for performance reasons, but their use is on the rise (e.g. PS3's Heavenly Sword). And there are applications for Ogre other than games... such as the field of visual speech synthesis in which I work.

Thanks
0 x

User avatar
xavier
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 9481
Joined: Fri Feb 18, 2005 2:03 am
Location: Dublin, CA, US

Re: Vertex Color Morphing

Post by xavier » Sat Apr 24, 2010 5:18 pm

berger wrote: Is this possible or would I be wasting my time trying to figure out how to access triangles from a vertex program?
It depends on the shader model you are expecting to use. With SM3.0 you can access texture samplers in the vertex shader, and with SM4 and above you have more features available as well.
If it is not feasible, I will have to recompute the normals in software and write the values to the hardware buffer.
This certainly will have the broadest compatibility. You can easily multithread this task (TBB or OpenMP parallel-for is probably easiest) to take advantage of multicore hardware to help with this.
0 x
Do you need help? What have you tried?

Image

Angels can fly because they take themselves lightly.

berger
Gnoblar
Posts: 9
Joined: Tue Apr 20, 2010 6:44 pm

Re: Vertex Color Morphing

Post by berger » Sun Apr 25, 2010 3:08 pm

Thanks for that. I will try a software solution for now, and later try to do it faster on the GPU.

I am trying to do this using optimized Ogre methods such as EdgeData::updateFaceNormals(), which relies on OptimisedUtil::calculateFaceNormals(). Unfortunately this produces homogeneous Vector4 normals which are not normalized to unit length. I must then convert these to 3D vectors and normalize them before building the vertex normals out of them. Wish there was an easier (and faster) way to do this...
0 x

berger
Gnoblar
Posts: 9
Joined: Tue Apr 20, 2010 6:44 pm

Re: Vertex Color Morphing

Post by berger » Mon Apr 26, 2010 7:10 pm

I am now finding that during vertex animation it is impossible to obtain current vertex positions from the hardware buffer. So in order to calculate vertex normals, I have to replicate the process of calculating vertex positions in software. This is totally redundant. Is there no other way??? I had no idea this would be such a problem.

What about VertexAnimationTrack::setAssociatedVertexData(). The documentation says this allows me to set the "target" of the vertex animation. I'm not sure what that means but could it be of use?

Thanks for your help.
0 x

User avatar
Praetor
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 3335
Joined: Tue Jun 21, 2005 8:26 pm
Location: Rochester, New York, US
Contact:

Re: Vertex Color Morphing

Post by Praetor » Tue Apr 27, 2010 6:00 pm

The vertex animation itself stores its own separate buffers. The new vertex positions are not copied into the original buffer, which is why you don't see it changing. You need to grab the vertex buffer stored in the animation track.
0 x
Game Development, Engine Development, Porting
http://www.darkwindmedia.com

berger
Gnoblar
Posts: 9
Joined: Tue Apr 20, 2010 6:44 pm

Re: Vertex Color Morphing

Post by berger » Tue Apr 27, 2010 8:29 pm

Hmm, but how do I access that? When I call track->getAssociatedVertexData(), I get null.
0 x

User avatar
cin
Kobold
Posts: 36
Joined: Thu Sep 25, 2008 10:34 am
Location: Russia. Nakhodka.
Contact:

Re: Vertex NORMAL Morphing

Post by cin » Sun Jun 27, 2010 9:00 am

Vertex normal Morphing.
Low resolution object space normal maps. Interpolate in shader. This can be realized anyone? :?:
0 x

truckleasing
Gnoblar
Posts: 1
Joined: Sat Jul 17, 2010 4:28 pm

Re: Vertex Color Morphing

Post by truckleasing » Sat Jul 17, 2010 4:31 pm

I'm attempting to do this using optimized Ogre methods like EdgeData::updateFaceNormals() which relies on OptimisedUtil::calculateFaceNormals(). The result is a homogeneous Vector4 normals which are not normalized to unit length. To fix it I have to convert these to 3D vectors and normalize them before building the vertex normals out of them. Can anyone tell me if there's an easier or faster way to do this? Thanks.
0 x

Post Reply