Jump to content
C4D Cafe

Python Vertex Map

Recommended Posts

Hello guys! Can you someone help me? I'm watching video from Simon Holmedal where share his workflow. In one moment he explains how he put null object on one of the corner and grow distance from null object. HERE IS LINK on video. My question is how i can make this vertex map when starting point will be null object. 


Thanks 🙂 

Link to post

The vertex map is created (or modified, rather) by the Python tag on the proximity null. The tag reads an existing vertex map, then writes values 0-100 into another vertex map by how far the null is away from the mesh point. I can't see the exact setup but the distance value used by the tag can apparently be animated.

Link to post

Hi Cairyn! You are everywhere! 😄 Yeah i understand how it works. Now i trying someone who helped me with the setup. 🙂 Thanks for the reply. 

Link to post
  • Silver Contributor

Hi @akkanein

This kind of set-up is somewhat outdated, as Simon said in passing in a podcast as you can create the same effect using fields. 
Search "Growth Propagation or Reaction Diffussion in C4D". 

That said regarding manipulating vertex map, check the Xpresso Presets. There are sample python scripts to manipulate vertex maps. 

Sorry can't be more help than that.

Link to post
3 hours ago, akkanein said:

Hi Cairyn! You are everywhere! 😄 Yeah i understand how it works. Now i trying someone who helped me with the setup. 🙂 Thanks for the reply. 


Yeah, I know, I get around. One of these days, I might open a business.


The simplest approach would be this here:




The cube has two maps, one is empty (actually, can contain anything), the second is initially empty but gets written to by the Python tag:

import c4d

newdata = [0.0]
def main():
    global newdata
    source = op[c4d.ID_USERDATA,1]
    target = op[c4d.ID_USERDATA,2]
    polyObject = op[c4d.ID_USERDATA,3]
    if source == None: return
    if target == None: return
    if polyObject == None: return
    sourceData = source.GetAllHighlevelData()
    # print sourceData
    pos = op.GetObject().GetAbsPos()
    for i in xrange(0, polyObject.GetPointCount()):
        locPos = polyObject.GetPoint(i)
        dist = abs((pos - locPos).GetLength())
        if dist < 50.0 :
            sourceData[i] = 100.0

The Python tag has links in the userdata to address the poly object's aspects. In the code, Python retrieves the vertex map data, and then writes 100% to that data wherever the distance between the corresponding point and the null's position is <50.

Move the null around and the yellow spot will follow.


Control VertexMap By Proximity Object.c4d


Note that the cube needs to stay in the center as the code doesn't consider its object position. Also, the distance here is hardcoded; add more user data to animate it. Just a primitive sample.


Link to post

Okay, there were a few oopsies in the code (newdata is never used, and the proper values for a vertex map are between 0.0 and 1.0, not 100.0). Since I spent too much time with this topic already, I made a post with all the code explanations for your perusal:




(This is a free post, as I am building on that YouTube video.)

The sample in this post uses two nulls and additive vertex maps, just to make it a bit more interesting.



Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...