Re: [Algorithms] Extracting filtered height data from quadtree terrain.
Brought to you by:
vexxed72
From: Thatcher U. <tu...@tu...> - 2002-11-04 04:35:04
|
On Nov 03, 2002 at 08:52 -0800, Charles Bloom wrote: > > You can make the derivative continuous just by doing bilinear > but using a "hermite lerp" or "cosine lerp" instead of linear > lerp of the s,t parameters inside the four points. > > //! remap (0->1) to (0->1) but with derivative continuity > inline float fHermiteLerpParameter(const float t) > { > gAssert( t >= - EPSILON && t <= 1.f + EPSILON ); > return (3.f - 2.f*t)*t*t; > } > > //! even better continuity than Hermite lerp, but slower > inline float fCosLerpParameter(const float t) > { > gAssert( t >= - EPSILON && t <= 1.f + EPSILON ); > return 0.5f - 0.5f * cosf( t * PI ); > } That makes the derivative continuous by ramping it to 0 at the boundaries, correct? That would make slopes wavy -- might look/act weird for a heightfield. Anyway, bicubic interpolation using 4x4 control points is the deluxe solution here, but if the quadtree is adaptive, I'm not sure of a correct way to collect the control points. I'm sure there is one, I've just never had to do it personally. -- Thatcher Ulrich http://tulrich.com |