Hello,
Can someone point me the right way to normalizing a custom attribute in vops? Usually I do this is sops, by getting the oldmin, oldmax values using attrib promotes and then fitting the original attribute between these and then specifying 0 and 1 for the newmin, newmax values.
I want to do this in vops as its quicker (I've been told). I tried to do it by looping through each point in my geometry, pulling in the attribute value for each point and the ptnum + 1 and doing min and max on that and so forth, but I can't work out how to use the for loop vop properly! It seems sort of non-nonsensical to me.
A simple example would be great. Thanks!
Basic vops question
7997 11 2-
- Dean_19
- Member
- 319 posts
- Joined:
- Offline
-
- goldfarb
- スタッフ
- 3456 posts
- Joined: 7月 2005
- Offline
-
- Dean_19
- Member
- 319 posts
- Joined:
- Offline
Yes, this was the first thing I tried. But it didn't seem to output what I expected. Say for example I create a random $CR value on a sphere using a point sop with rand($PT) in the first component of ‘add colour’, then I multiply it by something random, say 56. This gives me $CR values ranging between around 55.9 and 0.1.
Taking that into vops and plugging it into the normalize vop then outputting it back to Cd simply gives me 1 for every $CR value.
I messed about with it a little by converting Cd into a ‘proper’ vector (as its a 3 component float) but still the same output.
Taking that into vops and plugging it into the normalize vop then outputting it back to Cd simply gives me 1 for every $CR value.
I messed about with it a little by converting Cd into a ‘proper’ vector (as its a 3 component float) but still the same output.
-
- eetu
- Member
- 606 posts
- Joined: 5月 2007
- Offline
I would think that getting the min and max with attrib promotes is the way to go.
You could then read that value in as a parameter in VOPs and do your per-point math there.
Doing a loop for finding min and max in VOPs is a bad idea. the VOP code is run separately for each point (in a simd/vector -friendly way), so you would end up running the loop for each and every point.
You could then read that value in as a parameter in VOPs and do your per-point math there.
Doing a loop for finding min and max in VOPs is a bad idea. the VOP code is run separately for each point (in a simd/vector -friendly way), so you would end up running the loop for each and every point.
-
- Dean_19
- Member
- 319 posts
- Joined:
- Offline
But surely attrib promote has to do some per-point attribute comparing of its own to determine the min and max values too? Although attrib promote does seem to be very quick whenever I use it, so it must do something pretty clever…
Regardless of the ‘best’ way though, how would this be done in vops using the for loop vop? Does a vops savvy person out there have any ideas?
I'm looking to kill two birds with one stone, getting an example of using the for-loop vop for my own knowledge and a vops method of normalizing attributes.
Thanks!
Regardless of the ‘best’ way though, how would this be done in vops using the for loop vop? Does a vops savvy person out there have any ideas?
I'm looking to kill two birds with one stone, getting an example of using the for-loop vop for my own knowledge and a vops method of normalizing attributes.
Thanks!
-
- axebeak
- Member
- 51 posts
- Joined: 10月 2006
- Offline
This thread has some examples of both approaches, attrPromote->fit to range and loop over points in VOP:
http://www.sidefx.com/index.php?option=com_forum&Itemid=172&page=viewtopic&t=23294 [sidefx.com]
http://www.sidefx.com/index.php?option=com_forum&Itemid=172&page=viewtopic&t=23294 [sidefx.com]
-
- axebeak
- Member
- 51 posts
- Joined: 10月 2006
- Offline
But surely attrib promote has to do some per-point attribute comparing of its own to determine the min and max values too?Attr promote iterates over points just once (N iterations). In VOP you will iterate over all the points for each point (N^2 iterations). That is assuming you're trying to iterate over the same points you're applying the VOP to.
You can connect a single point to the first input and loop over points in the second input, this will be probably comparable in speed to attr promote, the single point in this case is just a container for computed values.
-
- Dean_19
- Member
- 319 posts
- Joined:
- Offline
-
- Dean_19
- Member
- 319 posts
- Joined:
- Offline
-
- Erik_JE
- Member
- 299 posts
- Joined: 1月 2010
- Offline
-
- Dean_19
- Member
- 319 posts
- Joined:
- Offline
-
- jkim7979
- Member
- 10 posts
- Joined: 3月 2009
- Offline
Hello!
I have a simple vop for loop question. I am trying to use vop for loop to smooth a mesh multiple times by embedding for loop inside of another for loop, but it seems like final global point position value doesn't update. Can someone take a look at my file and see what I am missing? Thanks so much!
I have a simple vop for loop question. I am trying to use vop for loop to smooth a mesh multiple times by embedding for loop inside of another for loop, but it seems like final global point position value doesn't update. Can someone take a look at my file and see what I am missing? Thanks so much!
-
- Quick Links