Efficient Iteration
2481 9 1- alexwheezy
- Member
- 209 posts
- Joined: Jan. 2013
- Offline
Hello!
What is a good way in goody to be iterated over a large number of objects?
For example, I have a tree exported from SpeedTree, it has a separate group with leaves, a trunk with branches and wires.
What is the task? From the branches in which the leaves are attached, inherit the initial transformations for the animation. Therefore, in each iteration, I have to take each leaf to look for the branch from which it is inherited and from it to take the transformation, and so on again and again.
I want to get fake dynamics in the form of animation from some noise. There are no problems; there are only 60k leaves, but if they get under 1.8 million, it becomes not so fast and clogs up RAM very much. I tried to do this by iterating through the connectivity attribute in a loop, but it's terribly slow.
What are the options to solve this kind of problem?
Thanks!
What is a good way in goody to be iterated over a large number of objects?
For example, I have a tree exported from SpeedTree, it has a separate group with leaves, a trunk with branches and wires.
What is the task? From the branches in which the leaves are attached, inherit the initial transformations for the animation. Therefore, in each iteration, I have to take each leaf to look for the branch from which it is inherited and from it to take the transformation, and so on again and again.
I want to get fake dynamics in the form of animation from some noise. There are no problems; there are only 60k leaves, but if they get under 1.8 million, it becomes not so fast and clogs up RAM very much. I tried to do this by iterating through the connectivity attribute in a loop, but it's terribly slow.
What are the options to solve this kind of problem?
Thanks!
- N-G
- Member
- 209 posts
- Joined: March 2018
- Offline
- alexwheezy
- Member
- 209 posts
- Joined: Jan. 2013
- Offline
- N-G
- Member
- 209 posts
- Joined: March 2018
- Offline
I don't see your node network but you can use packed primitives and then looping over them via a primitive wrangle and manipulate primitive intrinsic transform attribute to rotate your packed object without needing to unpack you geometry.
If you should use for-each sop you can use compile block to process your loop in multithreading way.
Please watch Jeff's tutorial on compiled sops:
https://vimeo.com/222881605 [vimeo.com]
If you should use for-each sop you can use compile block to process your loop in multithreading way.
Please watch Jeff's tutorial on compiled sops:
https://vimeo.com/222881605 [vimeo.com]
Edited by N-G - April 4, 2020 16:45:31
- alexwheezy
- Member
- 209 posts
- Joined: Jan. 2013
- Offline
To better understand the essence of my problem, I attach the scene and the initial geometry for the job. If you have any ideas how to speed up this setup by an order of magnitude, I will be grateful.
I have to repeat this again, but the problems with the small number of leaves on the tree are generally fine with this setup, but on large it becomes a problem.
Thanks!
I have to repeat this again, but the problems with the small number of leaves on the tree are generally fine with this setup, but on large it becomes a problem.
Thanks!
Edited by alexwheezy - April 5, 2020 02:04:17
- N-G
- Member
- 209 posts
- Joined: March 2018
- Offline
- alexwheezy
- Member
- 209 posts
- Joined: Jan. 2013
- Offline
N-G
I have worked on your HIP file.
I copied around 60'000 leaves and it takes less than 2 minutes to cook on my 6 core AMD CPU.
Please see the attached HIP file, it looks promising now and me know if you accept this.
Thanks for trying!
But this is not a working setup, it is now working incorrectly and attribute values are not calculated correctly and then we did not solve the problem with the speed I mentioned above and mentioned many times. Processing 60k leaves in 2 minutes is very, very slow, because I will have big trees with a lot, about 1.5-1.8 million leaves.
Try to test your scene on a very large number of leaves and see if you have enough patience and RAM for these operations.
- N-G
- Member
- 209 posts
- Joined: March 2018
- Offline
Unfortunately my RAM is filled up for heavier geometries…
But you may want to separate your trunk and the leaves and scatter leaves on trunk by yourself.
Since the leaves are separated from the trunk it is costly to find out what point on each leaf is nearest to trunk!
But you may want to separate your trunk and the leaves and scatter leaves on trunk by yourself.
Since the leaves are separated from the trunk it is costly to find out what point on each leaf is nearest to trunk!
Edited by N-G - April 6, 2020 13:40:41
- blackpixel
- Member
- 182 posts
- Joined: April 2009
- Offline
Some ideas:
- get as much static preprocessing done as possible. You'd want to avoid iterating over each leaf per frame.
- find the orientation of the leaves and replace them with points + orient attribute.
- only deform the points and copy leaves later.
- replace existing leaves with a smaller subset of variants and use packed primitives or other instancing methods.
This can free you from being too constrained to the original topology and you can optimize it even further with custom leaf geometry , packed disk primitives or point instance procedurals. Each leaf variant can also have animation etc.
- get as much static preprocessing done as possible. You'd want to avoid iterating over each leaf per frame.
- find the orientation of the leaves and replace them with points + orient attribute.
- only deform the points and copy leaves later.
- replace existing leaves with a smaller subset of variants and use packed primitives or other instancing methods.
This can free you from being too constrained to the original topology and you can optimize it even further with custom leaf geometry , packed disk primitives or point instance procedurals. Each leaf variant can also have animation etc.
- alexwheezy
- Member
- 209 posts
- Joined: Jan. 2013
- Offline
-
- Quick Links