sketchucation logo sketchucation
    • Login
    πŸ€‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    Understanding overlayed transparent OpenGL polygons

    Scheduled Pinned Locked Moved Developers' Forum
    9 Posts 4 Posters 1.4k Views 4 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A Offline
      Aerilius
      last edited by

      When drawing a transparent box, its sides usually should overlay. This seems not to work reliably using the OpenGL methods. Does it depend on the graphics card?
      Can someone test and tell me if this example looks the same?
      (I've left the box open so it is easier to recognize the sides.)
      GL_QUAD_STRIP.png

      
      class AlphaBox
        def initialize
          @color = Sketchup;;Color.new("red")
          @color.alpha = 0.2
          @ps1 = [[1, 1, 1], [3, 1, 1], [1, 3, 1], [3, 3, 1], [1, 3, 3], [3, 3, 3], [1, 1, 3], [3, 1, 3], [1, 1, 1], [3, 1, 1]]
          @ps2 = [[1, 1, 1], [1, 3, 1], [1, 3, 3], [1, 1, 3], [3, 1, 1], [3, 3, 1], [3, 3, 3], [3, 1, 3]]
        end
      
        def draw(view)
          view.drawing_color = @color
          view.draw(GL_QUAD_STRIP, @ps1)
          8.times{ |i| view.draw_text(view.screen_coords(@ps1[i]), i.to_s) }
          #view.draw(GL_QUADS, @ps2)
        end
      end
      Sketchup.active_model.select_tool(AlphaBox.new)
      
      
      1 Reply Last reply Reply Quote 0
      • jolranJ Offline
        jolran
        last edited by

        Same problem here. Damned! this pose some problems 😞

        Left and right side of box gets blown away.
        IE when looking from the left the right-side-face doesent render, and vice versa.
        Not from top or behind.
        Graphics card. Geforce GTX 580.

        Are the Points in order ? Try GL_LINE_LOOP, maybe that result is suppose to happend.

        1 Reply Last reply Reply Quote 0
        • A Offline
          Aerilius
          last edited by

          I tried GL_QUADS with independent quads (instead of GL_QUAD_STRIP) and the same result, I tried reversing the orientation of some quads, and I tried using 4 method calls (on for each quad).

          
          # Individual quads
          @ps1 = [ [1, 1, 1], [3, 1, 1], [3, 3, 1], [1, 3, 1],   [3, 3, 1], [1, 3, 1], [1, 3, 3], [3, 3, 3],   [1, 3, 3], [3, 3, 3], [3, 1, 3], [1, 1, 3],   [3, 1, 3], [1, 1, 3], [1, 1, 1], [3, 1, 1]]
          4.times{ |i| view.draw(GL_QUADS, @ps1[4*i...4*i+4]) }
          
          

          Intel GM945

          It's also not influenced by the transparency quality setting in Styles/Face Style.

          1 Reply Last reply Reply Quote 0
          • A Offline
            Anton_S
            last edited by

            Same here, I was creating 3d GL_POLYGON particle effects in SketchyPhysics, and got the unexpected results. Some 3d GL_POLYGONs did blend while the others did not, or some did blend with other GL_POLYGONs, but did not blend with all.
            blending 1.png
            blending 2.png
            In SU7 the 3d GL_POLYGON was not being able to be colored. It always appeared in black color, not matter what color you set. The coloring of 3d GL_POLYGON was available in SU8+, but there was that blending issue.

            I hope SketchUp Team will consider to fix this little glitch.

            1 Reply Last reply Reply Quote 0
            • jolranJ Offline
              jolran
              last edited by

              I wonder if this has something to do with rendering backside faces and transparency ?

              1 Reply Last reply Reply Quote 0
              • thomthomT Offline
                thomthom
                last edited by

                What is the Transparency Quality set to for your current Style?

                Thomas Thomassen β€” SketchUp Monkey & Coding addict
                List of my plugins and link to the CookieWare fund

                1 Reply Last reply Reply Quote 0
                • A Offline
                  Aerilius
                  last edited by

                  The best (nicer) but it seems only to affect pngs.
                  The example should be fully working. Do you see the same phenomenon?

                  1 Reply Last reply Reply Quote 0
                  • A Offline
                    Aerilius
                    last edited by

                    OpenGL_transparency_with_backedges.png
                    Turning back edges on increases the general opacity, and the previousy missing overlayed part appeared (although with less opacity than expected).
                    However changing the opacity of the drawing color between 0 and 0.9 does not have the same effect, so the opacity increase is another not much related side effect. Drawing additional lines with line_stipple doesn't change anything. I don't know how back edges achieve the difference.

                    1 Reply Last reply Reply Quote 0
                    • thomthomT Offline
                      thomthom
                      last edited by

                      @aerilius said:

                      The best (nicer) but it seems only to affect pngs.
                      The example should be fully working. Do you see the same phenomenon?

                      I see the same on my nVidia 8800GT card. (SU8)

                      Thomas Thomassen β€” SketchUp Monkey & Coding addict
                      List of my plugins and link to the CookieWare fund

                      1 Reply Last reply Reply Quote 0
                      • 1 / 1
                      • First post
                        Last post
                      Buy SketchPlus
                      Buy SUbD
                      Buy WrapR
                      Buy eBook
                      Buy Modelur
                      Buy Vertex Tools
                      Buy SketchCuisine
                      Buy FormFonts

                      Advertisement