gazebosim / gazebosim/gz-rendering

Transparency with glsl shader

Open
#846 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
81
Forks
90
Avg merge
1d 13h
Merged PRs (30d)
10

Description

Hi,

I asked the question first at [answers.gazebosim.org](https://answers.gazebosim.org/question/29041/transparency-with-custom-shader/) but as it gathers little views and no answer, I suppose it is too much of a niche question for that forum:

I'm trying to control transparency (of parts of a mesh) with a fragment shader.

As a first test, I tried to adapt the [deformable sphere example](https://app.gazebosim.org/iche033/fuel/models/deformable_sphere_no_shadows) by changing the alpha value in `deform_fs.glsl`:

i.e. change

```
fragColor = vec4(finalColor, 1);
```

into

```
fragColor = vec4(finalColor, 0.5);
```

But it remains opaque.

Defining another visual in the sdf without shaders but with element `0.5` does yield a transparent object. Adding the `` element to the visual with the shaders has no effect.

Is there a way to do this in the fragment shader?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.