Jump to content

how to get connected primitives


demoan666

Recommended Posts

hi acey195,

thanks for the reply... i tried both ways (within my noobility).

i did get random colors for each box using the connectivity node and used it's detail ( 'class')  inside a point VOP. 

however the second method i can't seem to be able to colorize it anything other than random gray values.
here is the snippet i used on the point wrangle (which works on each box rather than primitive or points):
@Cd =  set (random(@ptnum),random(@ptnum),random(@ptnum));

either that snippet is not proper or i didn't quite get and transfer the color in the "copytopoints1" node  from your answer

i would appreciate if anyone can point me to the right direction.

d.

Link to comment
Share on other sites

You have to use a foreach for that, try to use and "assemble" SOP after the copy to create the "name" attribute that the foreach uses by default to iterate at each object and use the 'attribute randomizer' inside the foreach, that should do the trick. I hope that helps.

Link to comment
Share on other sites

4 minutes ago, konstantin magnus said:

For non-gray colors, you should vary the seed value for each color component, e.g:


@Cd =  set (random(@ptnum + 123),random(@ptnum + 456),random(@ptnum + 789));

 

thanks konstantin magnus :)

 

d

Link to comment
Share on other sites

Another thing of note is that there are random() and rand() vex functions. The output from random() is not assumed to be in the range of 0-1. However, the output of rand() is. This may be more suited to constructing colors and other data fields that typically fall in the range of 0-1.

v@Cd = set(rand(@ptnum+123), rand(@ptnum+456), rand(@ptnum+789));

 

Edited by Atom
  • Like 1
Link to comment
Share on other sites

v is the explicit type cast for the attribute. v= vector, f = float, i = integer and s= string. So you may see those other prefixes in posted code as well. Most common attributes, such as, P, v, ptnum, Cd etc don't need explicit casting but every once in a while you will find that VEX may complain about automatic type casting not working. In those cases you need to specify the type or explicitly convert to the destination type manually by using int() or float() functions.

Edited by Atom
  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

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.

×
×
  • Create New...