As a temporary workaround, I'm trying to fix my .dae models by modifying
their scenegraphs in the following way:

I created a node visitor that looks for Geodes whose blending in turned ON,
then for such  geodes I change the the blending function in the way I wrote
in my previous mail and also change the rendering_hint to TRANSPARENT_BIN.

Actually I'm not sure if this is 'safe' because I could change those
attributes and modes also for geometries that do not need this. Maybe I
could restrict these changes only to geodes that contain a png texture or
that satisfy other conditions, which?

How can I find out that a geode use a particular texture? I mean, for
example, is there a way to get the file name of the texture applied to a
geode?

Thanks.
Alessandro

On Sat, Nov 15, 2008 at 6:07 PM, alessandro terenzi <[EMAIL PROTECTED]>wrote:

> I tried to set TRANSPARENT_BIN rendering hint but this didn't solve the
> problem.
>
> But I noticed another difference instead.
>
> First I tried this:
>
> - created a box in 3dsmax with a png texture applied in the diffuse slot
> - exported using osgexp (keeping the original texture file, ie png)
> - osgconv to get a .dae model
> - osgviewer of the .dae model
>
> and transparency is correctly handled.
>
> Then I created a similiar model with the same texture with Sketchup,
> created a .dae and converted into .osg. I compared the 'correct' .osg with
> the .osg 'from' Sketchup and I noticed that there is a difference in the
> BlendFunc section, in particular:
>
> in the correct .osg file:
>
> BlendFunc {
>         source SRC_ALPHA
>         destination ONE_MINUS_SRC_ALPHA
>  }
>
> and in the not-working file:
>
> BlendFunc {
>          source CONSTANT_ALPHA
>          destination ONE_MINUS_CONSTANT_ALPHA
> }
> Changing these two lines make the transparency work as expected even in the
> model that comes from Sketchup.
>
> Accidently I also noticed that converting from .dae to .osg and back to
> .dae, result in the textures being completely transparent!
>
> Regards.
> Alessandro
>
> On Sat, Nov 15, 2008 at 1:22 PM, Jean-Sébastien Guay <
> [EMAIL PROTECTED]> wrote:
>
>> Hi Alessandro,
>>
>> If you change this:
>>
>>        rendering_hint DEFAULT_BIN
>>>
>>
>> to this:
>>
>>         rendering_hint TRANSPARENT_BIN
>>
>> and then load the file in osgviewer, does that work?
>>
>> The two things you need to get proper transparency is enabling GL_BLEND
>> and giving the TRANSPARENT_BIN rendering hint, so that the drawables are
>> depth sorted. The .osg file you had seemed to have only one of the two. This
>> may indicate a bug in the Collada loader.
>>
>> Hope this helps,
>>
>> J-S
>> --
>> ______________________________________________________
>> Jean-Sebastien Guay    [EMAIL PROTECTED]
>>                               http://www.cm-labs.com/
>>                        http://whitestar02.webhop.org/
>> _______________________________________________
>> osg-users mailing list
>> [email protected]
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to