VertexMap colouring

  • On 31/08/2013 at 07:24, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   R14 
    Platform:   Windows  ;   
    Language(s) :     C++  ;

    Hi folks,

    I feel a bit guilty asking this one as I've gone in circles on similar subjects previously. But...

    How does the vertex map tag do it's drawing? Is that done through a SceneHook, using DrawPolygon()?

    I'm wishing to draw a similar vertex-map-style shading where a colour is interpolated between points on polys. And the only reference I've found doesn't really answer how it's done.

    My experiences with drawing polygons has been somewhat mixed. Some ways seem very slow, while other ways are limited in their scope. Is DrawPolygon() the only way to really achieve vertex-map style colouring?


  • On 31/08/2013 at 12:20, xxxxxxxx wrote:

    This doesn't seem to be slow at all to me.
    But I have to confess that I haven't used it in anything with a substantial number of vertices.
    Are you saying that this kind of thing is slow when used on dense meshes?

    TOOLDRAW LiquidToolData::Draw(BaseDocument *doc, BaseContainer &data, BaseDraw *bd, BaseDrawHelp *bh, BaseThread *bt,TOOLDRAWFLAGS flags)  
      Vector red = Vector(1.0, 0.0, 0.0);     //The color Red  
      Vector green = Vector(0.0, 1.0, 0.0);   //The color Green  
      Vector vp[4];                           //An array that will hold four vertices  
      vp[0] = Vector(-100.0, -100.0, 0.0);  
      vp[1] = Vector(-100.0, 100.0, 0.0);     //Draws the polygon using the four point positions  
      vp[2] = Vector(100.0, 100.0, 0.0);  
      vp[3] = Vector(100.0, -100.0, 0.0);  
      Vector vf[4];                          //An array that holds four colors  
      vf[0] = red;  
      vf[1] = green;                         //Assign the desired color to each specific vertice  
      vf[2] = green;  
      vf[3] = red;  
      bd->DrawPoly(vp, vf, NULL, 4, NULL);   //Draw the polygon using the above information  
      //The rest of the liquid painter code...


  • On 01/09/2013 at 07:21, xxxxxxxx wrote:

    Hi Scott,

    I had some code back home that was using DrawPolygon() - or something similar to what you've got above there. It worked, but at around 500+ polys it started to become quite sluggish. That part of my plugin I've since changed.

    But I'm still in need of a similar draw colouring in the viewport. And it really should be able to handle more than 500-odd polys! The vertex-map seems to do what I'm wishing to achieve colour-wise. But I'm not sure how that does it's draw.

    Is there a way to draw this kind of shading on a PolygonObject() perhaps?


Log in to reply