From: Simon Mills (simon++at++wgs.estec.esa.nl)
Date: 06/15/2000 00:50:21
Devrim Erdem wrote:
>
> Hi,
>
> In my effor to fade out some models, I have been using
> pfMaterial::setColorMode with pfMaterial::setAlpha. After my first call
> to setColorMode and setAlpha, there is a change in the colors of the
> materials. I believe that this is because of the PFMTL_CMODE_OFF, as
> this setting will ignore the original color of the geometry. This ends
> up that I will not be able to keep the original color of the geometry
> and set the alpha only.
>
> Remembering that adjusting the A value of each vertex didn't work well (
> some polygons were left unchanged ), I wonder if there is another way to
> fade out the model without artifacts.
If it helps, I also implemented this but I altered all pfGeoSet alpha
values under the given node. I did this rather than change the
pfMaterial alpha values because materials may be shared with other
geometry and that would have adverse effects. I also had to take care in
the case that the geometry already had some transparent materials so I
had to combine any material alpha with my overall fade factor. Oh yes,
and it had to work on most hardware i.e. not iR specific so I couldn't
use multisample masks.
In detail this is what I did:
- For alpha < 1 set up draw call backs to enable/disbale alpha blending.
- For alpha = 0 set draw mask so it's not drawn at all
- Traverse from node and for each pfGeode iterate through it's
pfGeoSets. For each pfGeoSet get the alpha of any attached pfMaterial
and then set the pfGeoSet's colour array alpha values to the material
alpha multiplied by the overall fade alpha. I should really be using
pfFlux's to be frame accurate but that wasn't important for me. I also
assume the original alpha values of the pfGeoSet's are 1.0, i.e.
transparency is only present in the materials.
- For alpha < 1 set the pfGeoSet's draw bin to be the transparent bin
otherwise unset it. This is the trick to avoid the most serious
artifacts.
- If you're using GL display lists (which are optimised on iR) force GL
display list recompilation (otherwise you won't see any change).
For me it's working fine but it's not been heaviliy tested.
Regards, Simon
________________________________________________________________________
Simon Mills
Silicon Worlds S.A.
c/o Modelling & Simulation Section (TOS-EMM) Tel: +31 (0)71 565 3725
European Space Agency (ESA/ESTEC) Fax: +31 (0)71 565 5419
Postbus 299, 2200AG Noordwijk e-mail: simon++at++wgs.estec.esa.nl
The Netherlands http://www.estec.esa.nl/wmwww/EMM
________________________________________________________________________
This archive was generated by hypermail 2b29 : Thu Jun 15 2000 - 00:50:54 PDT