Hello ! I'm trying to visualize data from a sequence of csv files. It all works well with the table SOP, loading a new csv file on each frame. Now I would like to sum one attribute over time, like stacking up on each frame. The solver SOP seems to be the right direction, but how do I generate the actual sum of the attribute on each frame?
Thanks in advance! J
Sum point attribute accumulative over time
6795 6 2- GiovanniB
- Member
- 10 posts
- Joined: Oct. 2015
- Offline
- neil_math_comp
- Member
- 1743 posts
- Joined: March 2012
- Offline
I put together a HIP file, but then I realized that you might be using Apprentice or Indie, so here's a screenshot. Attribute Wrangle is a versatile node that lets you write quick things of VEX code to do all sorts of things. In this example, it goes over each point of the first input (input 0), and adds the value of the “attrib” point attribute from the corresponding point in the second input (input 1) to the y component of the “P” (position) point attribute in the output. (It copies the starting value from input 0.) Some people prefer to use VOPs (a visual representation of VEX, in an Attribute VOP SOP) for things like this, but I find it much easier and faster to write VEX directly.
Writing code for fun and profit since... 2005? Wow, I'm getting old.
https://www.youtube.com/channel/UC_HFmdvpe9U2G3OMNViKMEQ [www.youtube.com]
https://www.youtube.com/channel/UC_HFmdvpe9U2G3OMNViKMEQ [www.youtube.com]
- GiovanniB
- Member
- 10 posts
- Joined: Oct. 2015
- Offline
- GiovanniB
- Member
- 10 posts
- Joined: Oct. 2015
- Offline
- neil_math_comp
- Member
- 1743 posts
- Joined: March 2012
- Offline
Pretty close! My “@P.y += @opinput1_attrib;” was just an example. If you have a float attribute named “foo” and you also want it accumulated into “foo”, it'd be “@foo += @opinput1_foo;”, and Attributes to Create would need to be “foo” instead of “P”.
For the first input into the Solver SOP, you'd want something with the same number of points but with “foo” equalling zero for all points, else the first frame's values will get counted twice, so you may want to put an Attribute Wrangle with “@foo = 0;” between the Table Import and the Solver SOP. Oh, and remember that the Table Import outside the Solver SOP shouldn't be time-dependent, else the Solver will have to recook the whole range of frames up to that point on each frame, instead of just cooking once. The Table Import SOP inside the Solver should use $F to select the file to load for that frame.
For the first input into the Solver SOP, you'd want something with the same number of points but with “foo” equalling zero for all points, else the first frame's values will get counted twice, so you may want to put an Attribute Wrangle with “@foo = 0;” between the Table Import and the Solver SOP. Oh, and remember that the Table Import outside the Solver SOP shouldn't be time-dependent, else the Solver will have to recook the whole range of frames up to that point on each frame, instead of just cooking once. The Table Import SOP inside the Solver should use $F to select the file to load for that frame.
Writing code for fun and profit since... 2005? Wow, I'm getting old.
https://www.youtube.com/channel/UC_HFmdvpe9U2G3OMNViKMEQ [www.youtube.com]
https://www.youtube.com/channel/UC_HFmdvpe9U2G3OMNViKMEQ [www.youtube.com]
- GiovanniB
- Member
- 10 posts
- Joined: Oct. 2015
- Offline
- Sieneskil
- Member
- 2 posts
- Joined: Feb. 2017
- Offline
Use a combination of a delete node/range and an attribute promote set to sum.
http://3d-rendering-services.uk [3d-rendering-services.uk]
-
- Quick Links