gz-rendering icon indicating copy to clipboard operation
gz-rendering copied to clipboard

Transparency for custom shader materials not working

Open srmainwaring opened this issue 3 years ago • 1 comments

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:
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 <transparency> 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

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.

srmainwaring avatar May 26 '22 11:05 srmainwaring

Related to https://github.com/gazebosim/gz-rendering/issues/846

azeey avatar May 31 '24 22:05 azeey