tearrain poping fix and facail animation

A forum to store posts deemed exceptionally wise and useful
Post Reply
omaremad
Competition winner
Posts: 1027
Joined: Fri Jul 15, 2005 11:30 pm
Location: Cairo,Egypt

tearrain poping fix and facail animation

Post by omaremad »

I found the solution to terrain poping and facial animation

LINEAR INTREPOLATION

ok for animating faces you can sync words with the animation like so

frame one could be a closed mouth
frame 2 could be the model of the head with the mouth modelled to say O

so the models themsleves dont contain animation the code morphs them

so you can tell it wich mesh to morph to each letter at speed "float interp"

the same can be applied to the terrain to make it LOD smoothly rather than pop

ill read some mesh buffer stuff and ill write irrlicht code for it

Code: Select all


		/* interpolate vertices */
		v_curr[0] = pframe1->scale[0] * pvert1->v[0] + pframe1->translate[0];
		v_curr[1] = pframe1->scale[1] * pvert1->v[1] + pframe1->translate[1];
		v_curr[2] = pframe1->scale[2] * pvert1->v[2] + pframe1->translate[2];
/*next*/
		v_next[0] = pframe2->scale[0] * pvert2->v[0] + pframe2->translate[0];
		v_next[1] = pframe2->scale[1] * pvert2->v[1] + pframe2->translate[1];
		v_next[2] = pframe2->scale[2] * pvert2->v[2] + pframe2->translate[2];
/*final result*/
		v[0] = v_curr[0] + interp * (v_next[0] - v_curr[0]);
		v[1] = v_curr[1] + interp * (v_next[1] - v_curr[1]);
		v[2] = v_curr[2] + interp * (v_next[2] - v_curr[2]);
krama757
Posts: 451
Joined: Sun Nov 06, 2005 12:07 am

Post by krama757 »

Aye, please do write the irrlicht code.

The popping effect is quite nasty after seeing it a lot. Though the same thing happens in WoW (kinda), there its not as easy to see.
Guest

Post by Guest »

you can always just override LOD distances so that you cannot see the popping so much anymore :)

the command is YourTerrainNode->overrideLODDistance(lodcount, range)

example:

TerrainNode->overrideLODDistance(1, 3000.0f);
TerrainNode->overrideLODDistance(2, 4000.0f);
TerrainNode->overrideLODDistance(3, 5000.0f);
TerrainNode->overrideLODDistance(4, 6000.0f);
omaremad_

Post by omaremad_ »

cool gfx styler thnx

maybe this could be used for facial animations
Guest

Post by Guest »

but be warned, this can slow down things a lot (lod 1 is the highest detailed, so if you use just that lod and not the others so much it can cause a heavy fps dropdown .. you have to find the balance)
Spintz
Posts: 1688
Joined: Thu Nov 04, 2004 3:25 pm

Post by Spintz »

LOD 0 is the highest detail ;)
Image
Guest

Post by Guest »

yeah sorry, my fault :)
eXodus
Posts: 320
Joined: Tue Jan 04, 2005 10:07 am
Location: Canada
Contact:

Post by eXodus »

Won't setting the terrain LOD to the highest value just result in having a standard model for the terrain?

Interpolation is the way to go on this one. As far as I know, whether it be linear or cosine, it's what has been used the most with terrain optimization.

You should have a look at Perlin Noise. I've written a 2D terrain generator in the past and worked great.
Spintz
Posts: 1688
Joined: Thu Nov 04, 2004 3:25 pm

Post by Spintz »

the best way is to linear interpolate the distance between a vertex of a higher LOD and the Y value of the midpoint of the line from the 2 vertices from the lower detail. Determining whether to "animate" this Y value is determine by screen space error. Setting the screen space error to 1 ( 1 pixel delta ) allows for the smoothest animation, combined with movement based calculations, as opposed to time based calculations. movement based calculations work better, because the Y is only interpolated if the camera is moving, which makes the change less noticeable.

Linear interpolation is easy; combining all of the above calculations is the difficult part, and making it fast.

Also, vertex buffers are really required, for a shader implementation to have a significant speed increase.
Image
krama757
Posts: 451
Joined: Sun Nov 06, 2005 12:07 am

Post by krama757 »

Spintz do you have this planned as an implementation into your engine?
Post Reply