Re: Transparency

New Message Reply Date view Thread view Subject view Author view

Angus Dorbie uid (angus++at++division.demon.co.uk)
Mon, 21 Nov 1994 23:34:31 +0000


> In my simulation a need to render a multigen model twice: first
> like an opaque object and then like a transparent object in the same scene.
>
> I've built this model with a material alpha of 0.4 and I have loaded this
> object twice under two different group nodes: the idea was to use
> a pre node draw callback to disable transparency [pfTransparency(PFTR_OFF)]
> when traversing the node that I want to render opaque and a post node
> draw callback to restore Transparency to the default value
> [pfTransparency(PFTR_ON)];
>
> The result was that both the objects are Transparent.
>
> Where is my mistake??
>
> There is some general procedure in Performer to manipulate the transparency
> of multigen Model?

The geostate information for the multigen geometry will have transparency
enabled and will be drawn as such unless this state is overriden. To force your
opaque geometry try:

pfTransparency(PFTR_OFF);
pfOverride(PFSTATE_TRANSPARENCY, PF_ON);

in your pre draw to the node you want to appear opaque. Remember to call

pfOverride(PFSTATE_TRANSPARENCY, PF_OFF);

in your post draw callback to restore normal operation.
The other node will be drawn as per it's geostate.

You may want to push the state in pre draw and pop it in post draw. (Anyone
care to comment on whether this is _really_ required?)

Because the required opaque node has a transparent geostate it will be sorted
with other transparent geometry (if you sort your database) and so _may_ be
occluded by foreground transparency. To avoid this you will have to apply an
opaque geostate to the opaque geometry (which also means you won't need
callbacks). You can make a geostate opaque by calling:

pfGStateMode(gstate_ptr, PFSTATE_TRANSPARENCY, PFTR_OFF);

if you can get your hands on the geostate for a known multigen model.

You will have to ensure that your geometry is re-loaded for each copy, not just
referenced again. I don't think a clone will work instead since that isn't
supposed to re-create leaf information.

-- 
________________________________________________
 Angus Dorbie                 Division Ltd,
 Software Engineer            19 Apex Court,
 Tel: (01454)615554           Woodlands,
 Fax: (01454)615532           Bristol BS12 4JT,
 angus++at++division.demon.co.uk   UK
________________________________________________

New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:50:40 PDT

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