Uploaded image for project: 'Qt 3D Studio'
  1. Qt 3D Studio
  2. QT3DS-657

Advanced blend mode fallback breaks for any non-fullscreen layer

    XMLWordPrintable

Details

    • 1cc0a14aaced3985a24d619fdc8b75dfd975ee10

    Description

      The advanced blend mode (overlay/color burn/color dodge) fallback implementation is somewhat lacking since it only works correctly when the layers cover the entire scene.

      For example, have a layer, then add another. The second layer should have an advanced blend mode. Now change the Left (or Top, Width, Height, etc.) property so that the second layer is not fullscreen anymore. The results from that point on are bizarrely incorrect. Switching back to a normal blend mode (or using advanced modes via the NV/KHR extensions) gives correct reults wrt positioning and sizing.

      The logic in the code is strange. First in Qt3DSRendererImpl.cpp it takes the first layer with an advanced blend mode and baseds layerBlendTexture's size on that. (ignoring any other layers) Then in Qt3DSRendererImplLayerRenderData.cpp there's a mix of theCurrentViewport and theLayerViewport (not that it matters since having a layerBlendTexture that can only accomodate one certain layer is already wrong).

      At first glance the correct algorithm would be something like:

      1. get a new fullscreen texture (screen_texture), clear it either to (0, 0, 0, 0) or (scene.clearColor, 1)
      2. for each layer:
        if uses advanced blend mode:
          - get a temp_texture matching the layer size
          - blit with screen_texture into temp_texture (appropriate area, i.e. only the area covered by the layer in question; this can be tricky)
          - draw a quad into screen_texture with the appropriate blend shader with base_layer=temp_texture and blend_layer=layer_texture
        else:
          - draw a quad into screen_texture with layer_texture (with normal blending)
      3. blit with screen_texture
      

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              myrjana Marianne Yrjänä
              lagocs Laszlo Agocs
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes