Tag-plugin draw-function and transparency



  • On 26/02/2013 at 06:07, xxxxxxxx wrote:

    Hey guys.
    I'm toying around with a tag-plugin which draws a simple polygon into the viewport. The polygon should be transparent which I set by using BaseDraw.SetTransparency(-235). It works, the polygon is transparent but has one major flaw: every polygon-object behind my polygon is not visible except for it's wireframe-lines (the world-grid is also visible).

    def Draw(self, tag, op, bd, bh) :  
    bd.SetMatrix_Matrix(None, c4d.Matrix())  
    bd.SetTransparency(-235)  
    p = ( c4d.Vector(0,0,0), c4d.Vector(100,0,0), c4d.Vector(50,100,0) )  
    f = ( c4d.Vector(1,0,0), c4d.Vector(0,0,1), c4d.Vector(0,1,0) )  
      bd.DrawPolygon(p, f)
    

    Is there some kind of workaround for this? The transparency works fine in my tool-plugins.
    Thanks
    Phil



  • On 27/02/2013 at 00:31, xxxxxxxx wrote:

    Hi Phil,

    With a positive value for the transparency it works. But it's dotted.
    I asked the developers if it's possible to get a true transparency from within a TagData plugin.



  • On 27/02/2013 at 02:39, xxxxxxxx wrote:

    Hi Yannick.
    Yeah I tried the dotted version, but I don't like the look (too dominant) and in my viewport other objects start flickering when I use positive values.
    I assume there won't be a workaround, but I just want to be sure.
    Thanks for your help.



  • On 27/02/2013 at 07:55, xxxxxxxx wrote:

    Maybe I don't understand the problem. But it seems to work fine for me.
    I tried it using the Py-LiquidPainter plugin example in the python SDK.  The two triangle polygons are transparent. And the objects behind it are seen through them as expected.

        ...plugin code  
      
    def Draw(self, doc, data, bd, bh, bt, flags) :  
          bd.SetMatrix_Matrix(None, c4d.Matrix())  
          bd.SetTransparency(-235)  
      
    ...Rest of the plugin code
    

    -ScottA



  • On 27/02/2013 at 08:45, xxxxxxxx wrote:

    i guess the point is that he is trying to do it from a tag plugin, c4d seems to throttle tag draw
    functions.



  • On 28/02/2013 at 00:13, xxxxxxxx wrote:

    Yeah that's exactly the point. Tool-plugins like LiquidPainter work without problems, tags not so much 😕



  • On 26/03/2013 at 06:57, xxxxxxxx wrote:

    The developers told me that true transparencies are only possible with shaders.
    The result is more or less undefined when using BaseDraw::SetTransparency().



  • On 26/03/2013 at 07:34, xxxxxxxx wrote:

    Thanks for the clarification Yannick.


Log in to reply