Jump to content

Sign in to follow this  
akkanein

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 🙂 

Share this post


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.

Share this post


Link to post
  • Topic Author
  • 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. 

    Share this post


    Link to post

    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.
     

    Share this post


    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:

     

    image.thumb.png.4ee8d9d59a01d07283e23ea8c71331fe.png

     

    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
        target.SetAllHighlevelData(sourceData)

    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.

     

    Share this post


    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:

     

    https://www.patreon.com/posts/script-club-1-07-34384586

     

    (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.

     

     

    Share this post


    Link to post
  • Topic Author
  • Cairyn thank you so much! It's amazing. If you want i have some examples another vertex maps. You can share on your patreon. 🙂 And if you can you can try make last effect with velocity 😄, but only if you can. I don't want you wasting your time. 

    Thanks guys!

    Share this post


    Link to post
    17 hours ago, akkanein said:

    Cairyn thank you so much! It's amazing. If you want i have some examples another vertex maps. You can share on your patreon. 🙂 And if you can you can try make last effect with velocity 😄, but only if you can. I don't want you wasting your time. 

    Thanks guys!

     

    I actually didn't understand what Holmedal means by "velocity" in his talk (he just passes over it very quickly, and I'm not in the mood to watch it three times more). Velocity of what? The null?

     

    If you want to work with velocities, you'd in general need to calculate the positional difference in time, so you keep a data set from the previous frame (like "newdata" above, which was not needed in that case but is if you want velocities) and determine the distance traveled for each frame and each point. That distance then will set a value in the vertex map, I guess. (It may be a bit tricky to find out what the proper distance ranges are that you need to map onto the vertex map range 0-1 in order to achieve whatever effect you want.)

     

    Share this post


    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.

    Guest
    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.

    Sign in to follow this  

    • Recently Browsing   0 members

      No registered users viewing this page.

    ×
    ×
    • Create New...