Alpha transparency bug

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Alpha transparency bug

nophead
If I make an object transparent with the % operator I can see other
objects inside it. If I use the alpha value in the color() function I
can not see other objects inside, but I can see internal details of
the object itself.

Reply | Threaded
Open this post in threaded view
|

Re: Alpha transparency bug

kintel
Administrator

On Sep 23, 2011, at 20:16 PM, nop head wrote:

> If I make an object transparent with the % operator I can see other
> objects inside it. If I use the alpha value in the color() function I
> can not see other objects inside, but I can see internal details of
> the object itself.

This is a known problem, from TODO.txt:
  - When specifying a transparency with the color() statement,
    the object is not sorted and will be rendered wrongly

The problem is that for non-opaque objects to be rendered correctly, they must be sorted in back-to-front order and rendered after all other geometry has been rendered. The problem lies in combining this with how OpenCSG works.

 -Marius


Reply | Threaded
Open this post in threaded view
|

Re: Alpha transparency bug

nophead
Another oddity is that cut edges of semi transparent objects seem to
come out green just like the cut edges of glass look green. Great if
you are modelling glass, but not if you are modelling acrylic.

On 27 September 2011 19:48, Marius Kintel <[hidden email]> wrote:

>
> On Sep 23, 2011, at 20:16 PM, nop head wrote:
>
>> If I make an object transparent with the % operator I can see other
>> objects inside it. If I use the alpha value in the color() function I
>> can not see other objects inside, but I can see internal details of
>> the object itself.
>
> This is a known problem, from TODO.txt:
>  - When specifying a transparency with the color() statement,
>    the object is not sorted and will be rendered wrongly
>
> The problem is that for non-opaque objects to be rendered correctly, they must be sorted in back-to-front order and rendered after all other geometry has been rendered. The problem lies in combining this with how OpenCSG works.
>
>  -Marius
>
> _______________________________________________
> OpenSCAD mailing list
> [hidden email]
> http://rocklinux.net/mailman/listinfo/openscad
>

Reply | Threaded
Open this post in threaded view
|

Re: Alpha transparency bug

nophead
In reply to this post by kintel
The % operator seems to give proper transparency (but it has other
side effects). Does it do the necessary sorting or am I just lucky?

Also why does this not work?

module transparent() {
        %child();
}


On 27 September 2011 19:48, Marius Kintel <[hidden email]> wrote:

>
> On Sep 23, 2011, at 20:16 PM, nop head wrote:
>
>> If I make an object transparent with the % operator I can see other
>> objects inside it. If I use the alpha value in the color() function I
>> can not see other objects inside, but I can see internal details of
>> the object itself.
>
> This is a known problem, from TODO.txt:
>  - When specifying a transparency with the color() statement,
>    the object is not sorted and will be rendered wrongly
>
> The problem is that for non-opaque objects to be rendered correctly, they must be sorted in back-to-front order and rendered after all other geometry has been rendered. The problem lies in combining this with how OpenCSG works.
>
>  -Marius
>
> _______________________________________________
> OpenSCAD mailing list
> [hidden email]
> http://rocklinux.net/mailman/listinfo/openscad
>

Reply | Threaded
Open this post in threaded view
|

Re: Alpha transparency bug

kintel
Administrator
On Sep 28, 2011, at 20:52 PM, nop head wrote:

> The % operator seems to give proper transparency (but it has other
> side effects). Does it do the necessary sorting or am I just lucky?
>
All objects rendered using the % operator are not taking part in CSG operations, so we can (and do) easily render them at the end which, due to z buffering, is equivalent to sorting relative to solid objects. If you use multiple % operators, their interdependent rendering might still be wrong.

> Also why does this not work?
>
> module transparent() {
>        %child();
> }
>
That looks like a bug. I'll look into it.

 -Marius


Reply | Threaded
Open this post in threaded view
|

Re: Alpha transparency bug

kintel
Administrator
In reply to this post by nophead
On Sep 28, 2011, at 20:52 PM, nop head wrote:

> Also why does this not work?
>
> module transparent() {
>        %child();
> }
>
This fails due to how the child() module is implemented. It's' not trivial to fix, but I've added a test case and a FIXME in the code for now.

 -Marius