cliptexture wobble

New Message Reply Date view Thread view Subject view Author view

From: ihawkes2++at++csc.com.au
Date: 10/11/2000 22:11:29


Hi,
I am having some problems curing a cliptexture of wobble/jello problems
(Performer 2.2.8; Irix 6.5.8f on an Onyx2).

Earlier in the project, we had similar problems with a 19 level
cliptexture, and these were resolved by reducing the number of effective
levels in the usual manner prescribed for fixing jello.

We have now moved to a 26 level cliptexture, and the problem is back with a
vengeance. It seems to be more severe than before, and reducing the number
of effective levels does not seem to make any improvement (I went all the
way back to 12 effective levels without improvement).

The wobble seems to be confined to clipped polygons and the texels within a
clipped polygon shake coherently with respect to eachother.

On the assumption that this was a tex coord precision problem, I then tried
the method of translating the tex coords closer to the origin by a multiple
of the good area and moving the clip centre accordingly. I found some
sample code in
/usr/share/Performer/src/lib/libpfdb/libpfspherepatch/pfspherepatch.C (you
may wish to update the sample reference in the IRClipmapBugs.html document
because I couldn't find any precision fixes in the pfct.C reference!). I
adapted the sample code to use a texture matrix as follows in a pre-cull
callback:

        mpct->getCenter(&s, &t, &r);
        int goodAreaSize = 1<<(_numEffectiveLevels+Offset-1);
        newS = ((s-(goodAreaSize>>1))&(goodAreaSize-1))+(goodAreaSize>>1);
        newT = ((t-(goodAreaSize>>1))&(goodAreaSize-1))+(goodAreaSize>>1);
        newS = PF_MIN2(newS, s);
        newT = PF_MIN2(newT, t);

       ct->applyCenter(newS, newT, r);

       // Translate all the tex coords...
       double fudgeS = (double)(newS - s) / virtSize;
       double fudgeT = (double)(newT - t) / virtSize;

       // texMatrix has previously been established as the texture matrix
       // for the cliptextured geostate
       texMatrix->makeTrans(fudgeS, fudgeT, 0.0f);

This seems to work insofar as it translates the tex coords & clipcentre and I end up with an image that is still sensible.
However, it unfortunately doesn't seem to improve the wobble problem at
all. I believe the translation code is OK, since if I comment out the
applyCenter call, or the texMatrix->makeTrans call independently then I
lose the hi-res image as you would expect.

So, my questions are ...

1) Examples of wobbly tex coords (before translation) include the area
around (0.917722, 0.266216) and also (perhaps less severely) around
(0.095587, 0.362692). Would you expect precision problems at these values?

2) Any ideas why neither reducing the num effective levels, nor translating
the texcoords seems to improve things? Is it possible that the polygons
involved are just too big?

3) Assuming that translating tex coords is the way to go, how should I
incorporate it into my cliptexture strategy which tiles the cliptexture,
and uses pre-cull node callbacks to set the virtual cliptexture params for
each tile. Should I use the largest (_numEffectiveLevels+Offset) of all the
tile callbacks in order to calculate the goodAreaSize and then do the
translation and the applyCenter a frame later in the pre-cull (since it
doesn't work postcull)?

Any help would be most appreciated!

Thanks,
Ian Hawkes


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Thu Oct 12 2000 - 00:51:08 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.