Jump to content

+= in setpointattrib?


Krion

Recommended Posts

Today I saw you can mix color using +=.    (http://www.tokeru.com/cgwiki/index.php?title=JoyOfVex12)

But now I wanted to test it in a case where I need to assign it on point numbers using setpointattrib, but I can't get this effect.

Why does "add" create this overblown effect? And not just subtle mix (like +=)?

5cdd83a4d99ef_Screenshot2019-05-16at17_36_58.thumb.png.902ee471615b081434a43bc7577455fd.png

 

Would appreciate your help. Thanks.

 

Edited by that Abstract guy
Link to comment
Share on other sites

Okay so a point wrangle does not run for each point individually and modify only that point, but when it loops over any point is able to modify every other point? (because I have 100 points and the green value is 100) Is this right? 

Two questions:

How do i get confined to only color these neighbour points of pointNum1 once, so it adds 1 on green instead on 100?

Why does it add 1 on green when the red is under it? (as seen in the GIF below)

ScreenFlow.thumb.gif.5742250882688bda35ef1abd59d8d3ea.gif

I'm honest with you: learning VEX is confusing to me. :) I hope I can fully understand it someday.

Link to comment
Share on other sites

7 hours ago, OdForest said:

How do i get confined to only color these neighbour points of pointNum1 once, so it adds 1 on green instead on 100?

based on your code you probably want to use Attrib Wrangle in Detail mode instead of Point

as you want your code to be executed just once and not per point, since you are not taking advantage of per point loop but setting values of the neighbours of 2 explicit points

 

7 hours ago, OdForest said:

Why does it add 1 on green when the red is under it? (as seen in the GIF below)

because setting color to 1,0,0 and then adding 0,1,0 repeated 100 times will still result just in 1,1,0 as "set" will reset the green value to 0 every time

Edited by anim
Link to comment
Share on other sites

9 hours ago, anim said:

 

Ah so I see: When you use ‘@ptnum’ in a point wrangle it does only colour the current point in the loop once, instead of on every point the particularly chosen point number 100 times. But still, when I play around with this now, there still arises questions. It never ends, does it?

So “set” resets and overrides. And my suspicions were that when you use setpointattrib on @ptnum and “set” it is thus just the same as an usual @Cd = {x,x,x};  But apparently this isn’t.

  • Why is the last “set” setpointattrib not overridden by @Cd = 0; ?
  • With the previous code in detail mode, why doesn’t it retain the color black underneath the  “add”s?

twoquestions.thumb.gif.a1c0a67d3ed7ad5a766a49a767a8d073.gif

 

Edited by OdForest
Link to comment
Share on other sites

@Cd in detail mode will create Cd as detail attribute, so Cd point attribute that you are creating using setpointattrib() will always have priority in the viewport as its more granular, use addpointattrib() function to initialize Cd to certain default value if it doesn't exist yet, or just initialize it in a point wrangle before

 

direct assignments to @Cd in point mode will be executed in parallel per point first

then all setpointattrib() commands are queued afterwards as a single threaded operation as those can possibly affect any point, therefore even if in your code v@Cd = 0; is after setpointattrib() on @ptnum it will still be executed before

 

Edited by anim
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...