gazebosim / gazebosim/gz-rendering

Transparency for custom shader materials not working

Open
#633 1 comment 0 reactions 0 assignees View on GitHub
bug help wanted
Dominant language
C++
Stars
81
Forks
90
Avg merge
1d 13h
Merged PRs (30d)
10

Description

## Environment
* OS Version: macOS Big Sur 11.6.2
* Source build, main branch, commit ff16689f
* If this is a GUI or sensor rendering bug, describe your GPU and rendering system
- Rendering plugin: [ogre2].
- Generally, mention all circumstances that might affect rendering capabilities:
- [x] running on real hardware
- [x] GPU is concurrently used for other tasks
- [x] desktop acceleration
- Rendering system info:
```bash
system_profiler SPDisplaysDataType
2022-05-26 12:09:53.871 system_profiler[93720:261323859] Device PreExisted [00000001000009b6] AMD Radeon Pro W5700X
Graphics/Displays:

AMD Radeon Pro W5700X:

Chipset Model: AMD Radeon Pro W5700X
Type: GPU
Bus: PCIe
Slot: Slot-1
PCIe Lane Width: x16
VRAM (Total): 16 GB
Vendor: AMD (0x1002)
Device ID: 0x7310
Revision ID: 0x0000
ROM Revision: 113-D1860W-213
VBIOS Version: 113-D186A2XT-019
Option ROM Version: 113-D186A2XT-019
EFI Driver Version: 01.01.200
Metal Family: Supported, Metal GPUFamily macOS 2
Displays:
Cinema HD:
Display Type: LCD
Resolution: 2560 x 1600
UI Looks like: 2560 x 1600
Framebuffer Depth: 30-Bit Color (ARGB2101010)
Display Serial Number: CY628129UG1
Main Display: Yes
Mirror: Off
Online: Yes
Rotation: Supported
Automatically Adjust Brightness: Yes
Connection Type: DVI or HDMI
Adapter Firmware Version: 2.21
```

## Description

#### Expected behaviour:

Objects should be partially visible beneath/behind objects rendered with custom shader materials when that object has the `` SDF element set, or the fragment shader for that object has an final alpha value < 1.0

#### Actual behaviour:

The object using the custom shader is opaque.

## Steps to reproduce

1. Run the OSRF waves example: https://app.gazebosim.org/OpenRobotics/fuel/models/Waves
2. Add another partially submerged object to the world

## Output

![osrf_waves_no_transparency](https://user-images.githubusercontent.com/24916364/170477812-03ea6496-c17d-482a-a239-7f89d64772d3.png)

The submerged portion of the red sphere is completely obscured by the sea surface.

**Edit** @iche033 btw I'm happy to help put a PR together for this, or help with testing, but could do with a few pointers on where to look. I can see where the Hlms::BlendBlock is being set, but don't quite follow how the properties are propagated to the HllmLowLevel materials used for backwards compatibility with the Ogre(1) material system.

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with the OSRF Waves example and an added partially submerged object. Start by tracing where Hlms::BlendBlock is set and how transparency reaches the HllmLowLevel materials used for Ogre(1) compatibility. Done means a custom shader material with the transparency SDF element or a fragment alpha below 1.0 renders partially transparent, including the submerged sphere.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
computer-graphics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.