[Q] Why does the generation of grass for borders take very long

rv 1.1.2
osx 10.11.6

Im busy with a scene which is on a large plane filled with grass. Ive set camera exclusion for this to minimize objects. I also want the smaller patches of grass but this takes very to to generate (200+ seconds). Ive already set the view limit to 5000 but still it takes very long to generate. The bigger patches are limited to 10000 and this goes much faster than the small patches.

It generates about 18347 objects and i also have a exclude area in the scene. What could cause this long generation time?

Here’s how Skatter works internally:

It first generates points with the specified density at the top of the surface’s bounding box.

Then it projects these points on the surface itself.

Finally, it checks if the remaining points are within areas.

The density of the “border” presets are very high, so Skatter generates a lot of points during the first step.
Each and every one of these points has to be checked against each face of your surface.
Then each point has to be checked against each edge of your area curve.
That’s a lot of computing, hence the long times your are experiencing.

The less faces in your surface, the faster.
The less edges in your curves, the faster.

You can leave the Ruby Console open while you work with Skatter, you’ll see a log of what it does and which step is taking time. Here is an exemple with a “Border” preset, on a 50’000 faces surface:

---- Skatter 1.1.2 ----
Processing surface 2ZOJ8Ut2fFxxpz3flNZyaZ
Sent surface to C++ : 0.446026 s
Generate points : 0.309018 s
Number of generated points : 721584

Project points : 55.558178 s
Number of projected points : 721573
Seed and def points : 0.508029 s
Scale points : 0.996057 s

Area points : 10.577605 s
Number of areaed points : 10887

Generate bounding boxes & transformations : 0.302018 s
Total number of points : 10887
View redraw : 0.147008 s

Total : 68.910942 s
------ End ------

Even though I end up with only 11’000 objects, Skatter actually started with more than 700’000 points to compute.

That’s why in the library there are small warning signs with tooltips next to the “Load” button on the border presets.
I have in mind ways to optimize all of this, like using Intel’s Embree framework. But that won’t be done soon :slight_smile: Performance is an issue, but I think there are other stuff more urgent.

Okay thanks for explaining me. Other question related to this. The Exlcude from camera and near field density. Are these taken in account before or after all these calculation? I think it will be best if this taken in account before all calculations are happening, but i dont know if this technically is possible. Perhaps you already coded it like that.

You say the calculations become harder with more face you say. Iv added a simple SU model of my scene. It has a quite large ground plane and a smaller plan “none grass”. On the ground i add “large short grass” and for the edges around “none grass” i add “small short grass”.

While the “none grass” model is quite simpel it takes quite a while to generate even though there just a few edges or faces. I used camera exclude and distance clipping but doesnt seem to differ on generation time. Therefor is was think perhaps this is done at the very end. So skatter is doing a lot of not needed computing.

I did another check now. I see when all the computing has been done changing the exclude and falloff density happens quite quickly. This means the regeneration is taken in acoount right and its done at the end?

i tried it with a smaller ground plane and goed much faster as expected. Now i see when the host is selected there is this option “selected object properties”, for me nothing shows here and i cant find anything about in the help docs. Does it need to show something here?

Other idea is it possible to exlcude the host boundaries, like the boundary include area for Areas? Not sure if this technically is possible though

Well even when you have a simple plane, if the number of points is high, it’ll take some time to compute. That’s the case here, the plane is large, so Skatter has to deal with lots of points (10 millions during step 1 for the border!)

Some calculation is cached, so for example when you change areas settings, it won’t re-compute the projection.

Regarding the exclude camera, it is indeed computed near the end, because I need to know the exact location of a point to determine if it’s visible to the camera.

“selected object properties”, for me nothing shows here and i cant find anything about in the help docs. Does it need to show something here?
Not for surfaces. There are options available for host curves and Points Sets.
Other idea is it possible to exlcude the host boundaries, like the boundary include area for Areas? Not sure if this technically is possible though
It should be technically possible, but I don't see the point. If the boundary of your surface is an exclude area, there will never be any object on your surface. Am I missing something in your request?

Well the problem i see is that edge particles is very hard to calculate cause you need a host and a area. This makes it very hard for large areas to have nice borders even when you just want a small part inside the big area with nice borders.

Other idea i had is that when you use a host, the distribution is opposite of the area. So outside the area, it will act as a sort mask. So in my example scene i would select the “none grass” group and use this as a mask or host then the particles will be generated outside this host. One problem is that skatter needs to know then on what surface or how they are going to projected.

Im just thinking about to make this process faster for large areas, not sure if this is possible though. Each idea has its limits and youve probably thought them all through very well.

Other idea is to first see what the projection area is before the computing and then shoot the particles at this area. This would mean less calculations right?

The issue is that on way of doing it is better for one situation and worse for another situation.

I need an intelligent algorithm that compares the surfaces vs areas to determine which one should be computed first.

My workaround now is using native su tool to make a sort of border manually around the “none grass” part and then fill this with a regular host with border fall off

OMG! This explains a lot! My preferred way of dealing with large areas is to check the “use surface boundaries as include area”, and then “paint in” the areas where i want grass. From this thread i gather that calculations are still being made on the ENTIRE surface, only to be filtered out at the last step? Did i understand correctly? Time to change my workflow…

You understood correctly, yes.

Thanks Thomas! now they i understand this better my quality of life has changed! Thanks!
I am now doing dummy objects on a transparent layer that can be hosts to grass. These partial copies of a larger “host” surface based on what is “seen” by the camera. To this smaller area i can now use distance clipping to further decrease objects. the number is more manageable now, and my computer is super more responsive.

Glad to hear that! :slight_smile:

I used smaller patches but one new issue occurs then. It will still look for inner ring and outring. Is it possible to only let it look at a inner ring or out ring?

By this i mean border edges of a smaller shape. Because it now looks at both borders if they are there, this gives weird results at the bordes/edges where its not needed.

Unfortunately, Skatter doesn’t make the difference between inner and outer loops.

perhaps edge selection, not sure if this is even possible or accessible when it’s in a closed group.