Jump to content
OdForest

+= in setpointattrib?

Recommended Posts

Posted (edited)

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

Share this post


Link to post
Share on other sites

The overblown color, is what you get when you go above 1 with your color,
so your addition probably works fine, its just that multiple points may be adding to the same target point.

Share this post


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

Share this post


Link to post
Share on other sites
Posted (edited)
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

Share this post


Link to post
Share on other sites
Posted (edited)
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×