# About transparent and alpha

**URL:** <https://forums.sketchup.com/t/about-transparent-and-alpha/117587>\
**Category:** SketchUp SDK\
**Created:** [February 27, 2020, 2:50am UTC](https://forums.sketchup.com/t/about-transparent-and-alpha/117587 "2020-02-27T02:50:37Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![nmgm1997](https://avatars.discourse-cdn.com/v4/letter/n/e9a140/32.png) [@nmgm1997](https://forums.sketchup.com/u/nmgm1997)\
**Post date:** [February 27, 2020, 2:50am UTC](https://forums.sketchup.com/t/about-transparent-and-alpha/117587/1 "2020-02-27T02:50:37Z")

</div>

I want to export skp format file into osg format file , I think if transparent is used the alpha will be used , but I notice there are two api that one judges whether use transparent and another judges whether use alpha .  
I’m confused.  
I want to learn more about this.  
Thank you .  
(I’m learning ,if I’m mistake , just tell me)

---

<div class="post-metadata">

**Author:** ![DanRathbun](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/danrathbun/32/500_2.png) [@DanRathbun](https://forums.sketchup.com/u/DanRathbun)\
**Post date:** [February 27, 2020, 3:03am UTC](https://forums.sketchup.com/t/about-transparent-and-alpha/117587/2 "2020-02-27T03:03:15Z")

</div>

> **A few questions ...**
>
> > [@nmgm1997](#):
> >
> > I think if transparent is used the alpha will be used …
> 
> This applies to color usually, … but I’m guessing here as you have provided no context for this statement.
> 
> > [@nmgm1997](#):
> >
> > … but I notice there are two api that one judges whether use transparent and another judges whether use alpha.
> 
> Links to these two API ? Are these Trimble SketchUp APIs ? … or [OpenSceneGraph.org](http://www.openscenegraph.org/) APIs ?
> 
> > [@nmgm1997](#):
> >
> > I want to export **skp** format file into **osg** format file …
> 
> It may be easier to export to OBJ format and use the [osgconv](http://www.openscenegraph.org/index.php/documentation/user-guides/55-osgconv) command line utility.
> 
> **ADD** : There are also OpenSceneGraph plugins for DXF, PLY, FBX and 3DS (and either native export of these formats from SketchUp, or a plugin in the case of PLY.)

---

<div class="post-metadata">

**Author:** ![nmgm1997](https://avatars.discourse-cdn.com/v4/letter/n/e9a140/32.png) [@nmgm1997](https://forums.sketchup.com/u/nmgm1997)\
**Post date:** [February 27, 2020, 3:57am UTC](https://forums.sketchup.com/t/about-transparent-and-alpha/117587/5 "2020-02-27T03:57:55Z")

</div>

Thank you .  
To be honest, I’m not sure whether transparent need alpha always, I’m sorry.  
The API are SUMaterialIsDrawnTransparent and SUMaterialGetUseOpacity.  
I afraid that the SUMaterialIsDrawnTransparent return true and SUMaterialGetUseOpacity return false.  
I do this because I was asked to make a osg plugin that export skp into osg, leader think if use obj the result is not very good,but thanks for your advice.  
Thanks for your help.

---

<div class="post-metadata">

**Author:** ![DanRathbun](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/danrathbun/32/500_2.png) [@DanRathbun](https://forums.sketchup.com/u/DanRathbun)\
**Post date:** [February 27, 2020, 6:41am UTC](https://forums.sketchup.com/t/about-transparent-and-alpha/117587/6 "2020-02-27T06:41:10Z")

</div>

> [@nmgm1997](#):
>
> The _API_ are `SUMaterialIsDrawnTransparent` and `SUMaterialGetUseOpacity`.

Okay, those are **functions** of the SketchUp C API.  
They return the boolean value of transparency flags for a material object.

> [@nmgm1997](#):
>
> I afraid that the [`SUMaterialIsDrawnTransparent`](https://extensions.sketchup.com/developers/sketchup_c_api/sketchup/material_8h.html#a92490478dc92f5ba92ccaed67a02e40e) return **`true`**  
> … and the [`SUMaterialGetUseOpacity`](https://extensions.sketchup.com/developers/sketchup_c_api/sketchup/material_8h.html#a5ec103e21860b9646b06cb0e4f310349) return **`false`**.

That sounds weird to me. @thomthom, what’s the difference between these 2 boolean flags ?

@nmgm1997, What happens if you send **`true`** to [`SUMaterialSetUseOpacity`](https://extensions.sketchup.com/developers/sketchup_c_api/sketchup/material_8h.html#ae487b6ed2d13724a3733161d81a10ea0) and then set some amount of transparency ( _say `0.5`_ ) with [`SUMaterialSetOpacity`](https://extensions.sketchup.com/developers/sketchup_c_api/sketchup/material_8h.html#adeee8d09c0d3ecef805717bf407bb37d) ?

---

<div class="post-metadata">

**Author:** ![tt\_su](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/tt_su/32/17_2.png) [@tt\_su](https://forums.sketchup.com/u/tt_su)\
**Post date:** [February 27, 2020, 10:09am UTC](https://forums.sketchup.com/t/about-transparent-and-alpha/117587/7 "2020-02-27T10:09:47Z")

</div>

Good question, the documentation `SUMaterialIsDrawnTransparent` isn’t doing anything more than parroting the function name.

I found this in the source code:

```auto
// If the material has a texture with alpha information, then
// draw it transparent

// Otherwise, look at the transparency for the entire material.

// No transparency here.

```

So if the material has a texture with transparency this should return `true`. If the material has non-opaque alpha value then this should return `true`.

`SUMaterialGetUseOpacity` checks internal boolean flag. From what I can tell it relates to the opacity of the Material itself - ignoring the texture.

If `SUMaterialIsDrawnTransparent` returns `true` and `SUMaterialGetUseOpacity` returns `false` I could expect that it’s a material where the material alpha is solid, but the texture has transparent pixels.

---

<div class="post-metadata">

**Author:** ![RaPIT](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/rapit/32/165214_2.png) [@RaPIT](https://forums.sketchup.com/u/RaPIT)\
**Post date:** [February 27, 2020, 10:13am UTC](https://forums.sketchup.com/t/about-transparent-and-alpha/117587/8 "2020-02-27T10:13:13Z")

</div>

Can the above explanation be included in the SDK documentation?  
_(for future generations)_

---

<div class="post-metadata">

**Author:** ![john\_drivenupthewall](https://avatars.discourse-cdn.com/v4/letter/j/c67d28/32.png) [@john\_drivenupthewall](https://forums.sketchup.com/u/john_drivenupthewall)\
**Post date:** [February 27, 2020, 10:20am UTC](https://forums.sketchup.com/t/about-transparent-and-alpha/117587/9 "2020-02-27T10:20:54Z")

</div>

does’t RGBA texture set one and the opacity slider set the other?

john

---

<div class="post-metadata">

**Author:** ![DanRathbun](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/danrathbun/32/500_2.png) [@DanRathbun](https://forums.sketchup.com/u/DanRathbun)\
**Post date:** [February 27, 2020, 7:17pm UTC](https://forums.sketchup.com/t/about-transparent-and-alpha/117587/10 "2020-02-27T19:17:21Z")

</div>

> [@RaPIT](#):
>
> Can the above explanation be included in the SDK documentation?

I just filed an issue (and quoted Thomas’ above comments) …

> <https://github.com/SketchUp/api-issue-tracker/issues/440>
>
> \### C API Documentation Issue
> 
> Please document the difference between \[\`SUMate…rialIsDrawnTransparent\`\](https://extensions.sketchup.com/developers/sketchup\_c\_api/sketchup/material\_8h.html#a92490478dc92f5ba92ccaed67a02e40e) vs \[\`SUMaterialGetUseOpacity\`\](https://extensions.sketchup.com/developers/sketchup\_c\_api/sketchup/material\_8h.html#a5ec103e21860b9646b06cb0e4f310349).
> 
> Also check documentation for the following functions, ... perhaps making note for each that they do not apply to texture image alpha channel but to the material rendering itself.
> 
> \* \[\`SUMaterialSetUseOpacity\`\](https://extensions.sketchup.com/developers/sketchup\_c\_api/sketchup/material\_8h.html#ae487b6ed2d13724a3733161d81a10ea0)
> \* \[\`SUMaterialSetOpacity\`\](https://extensions.sketchup.com/developers/sketchup\_c\_api/sketchup/material\_8h.html#adeee8d09c0d3ecef805717bf407bb37d)
> \* \[\`SUMaterialGetOpacity\`\](https://extensions.sketchup.com/developers/sketchup\_c\_api/sketchup/material\_8h.html#a5343ba0d4eacae7adede471995bb1275)
> 
> REF public forum topic:
> https://forums.sketchup.com/t/about-transparent-and-alpha/117587
> 
> ... where \[Thomas said\](https://forums.sketchup.com/t/about-transparent-and-alpha/117587/7):
> 
> \> Good question, the documentation SUMaterialIsDrawnTransparent isn’t doing anything more than parroting the function name.
> \> 
> \> I found this in the source code:
> \> 
> \> \`\`\`c
> \> // If the material has a texture with alpha information, then
> \> // draw it transparent
> \> 
> \> // Otherwise, look at the transparency for the entire material.
> \> 
> \> // No transparency here.
> \> \`\`\`
> \> So if the material has a texture with transparency this should return true. If the material has non-opaque alpha value then this should return true.
> \> 
> \> SUMaterialGetUseOpacity checks internal boolean flag. From what I can tell it relates to the opacity of the Material itself - ignoring the texture.
> \> 
> \> If SUMaterialIsDrawnTransparent returns true and SUMaterialGetUseOpacity returns false I could expect that it’s a material where the material alpha is solid, but the texture has transparent pixels.
> \> 
> 
> \----

---

<div class="post-metadata">

**Author:** ![nmgm1997](https://avatars.discourse-cdn.com/v4/letter/n/e9a140/32.png) [@nmgm1997](https://forums.sketchup.com/u/nmgm1997)\
**Post date:** [February 28, 2020, 6:01am UTC](https://forums.sketchup.com/t/about-transparent-and-alpha/117587/11 "2020-02-28T06:01:02Z")

</div>

Thanks for you help.

---

<div class="post-metadata">

**Author:** ![nmgm1997](https://avatars.discourse-cdn.com/v4/letter/n/e9a140/32.png) [@nmgm1997](https://forums.sketchup.com/u/nmgm1997)\
**Post date:** [February 28, 2020, 6:02am UTC](https://forums.sketchup.com/t/about-transparent-and-alpha/117587/12 "2020-02-28T06:02:02Z")

</div>

Thank you.
