Chaos Corona Forum

Chaos Corona for Cinema 4D => [C4D] Daily Builds => Topic started by: fierruccio on 2022-10-07, 10:58:17

Title: Scatter edge trimming shader
Post by: fierruccio on 2022-10-07, 10:58:17
Hi guys.
I am trying corona 9 and its new features. I can't understand how the scatter edge trimming shader works.
can anyone give me some info about it?

Title: Re: Scatter edge trimming shader
Post by: Nejc Kilar on 2022-10-07, 11:37:14
Hello!

You're supposed to create a "Scatter Edge Trimming" shader and then plug it into the Opacity slot of the material you'd like it to affect.

If those materials are already being driven by an opacity map (f.e leaf cut outs and such) then you can do the above and then plug that opacity map into the "Scatter Edge Trimming" shader.

Hope that helps!
Title: Re: Scatter edge trimming shader
Post by: Beanzvision on 2022-10-07, 11:43:46
Yep^

(https://forum.corona-renderer.com/index.php?action=dlattach;topic=38037.0;attach=172386;image)
Title: Re: Scatter edge trimming shader
Post by: fierruccio on 2022-10-07, 13:52:03
Thanks a lot guys. I wonder why I thought it was for anything else.
Very good feature. super easy.
Title: Re: Scatter edge trimming shader
Post by: elaraisawhale on 2022-10-07, 16:28:13
hi guys, thanks for the great feature, really appreciated.
i was testing it on a shrub close to a wall. i understand how it works, i scattered it on a plane limited in a spline rectangle. put the trim shader on every model's material but some branches are still not trimmed. what i'm doing wrong?
Title: Re: Scatter edge trimming shader
Post by: TomG on 2022-10-07, 17:48:20
It depends on where the pivot point is for that sub-object - if it is inside the scatter area, it still gets displayed, which means for a long thin branch it can still stick out beyond the scatter area. Your example is an ideal case for using a Slicer object though, to achieve what you want (things not sticking through a wall), shouldn't even need the new edge trimming.
Title: Re: Scatter edge trimming shader
Post by: elaraisawhale on 2022-10-07, 17:53:16
It depends on where the pivot point is for that sub-object - if it is inside the scatter area, it still gets displayed, which means for a long thin branch it can still stick out beyond the scatter area. Your example is an ideal case for using a Slicer object though, to achieve what you want (things not sticking through a wall), shouldn't even need the new edge trimming.

Thank you Tom!!!
Title: Re: Scatter edge trimming shader
Post by: leo3d on 2022-10-09, 20:58:23
I find that going through the shader edge trimming, it is not simple at all
There should be an option in the scatter to activate it or not
Title: Re: Scatter edge trimming shader
Post by: leo3d on 2022-10-09, 21:02:20
the slicer shader only works in inclusive and not in exclusive with the scatter
Title: Re: Scatter edge trimming shader
Post by: Cinemike on 2022-10-09, 22:23:24
I find that going through the shader edge trimming, it is not simple at all
There should be an option in the scatter to activate it or not

This is what Chaos-Ondra (I had to use this ^^) says in the Max-section:
"yes, we want to have the trimming feature implemented internally with just a checkbox in the future. It requires some internal changes first though. When done, it will work the same also for ForestPack."

Fingers crossed, there's hope!
Title: Re: Scatter edge trimming shader
Post by: tiagosaraivacg on 2022-10-10, 16:06:48
Yep^

(https://forum.corona-renderer.com/index.php?action=dlattach;topic=38037.0;attach=172386;image)

Hi, can you share this scene? .. im not able to use it.. with and without the shader gives me the exact same outcome, tried it with Chaos Cosmos Grass.

thanks in advance.
Title: Re: Scatter edge trimming shader
Post by: Beanzvision on 2022-10-11, 08:31:11
Sure, here's a setup using Cosmos ''Field Grass 008'', Corona 9 RC2. :)

Please note that the grass mesh is not included in this zip, you'll need to download it from Cosmos and then add it to the scatter object.

(https://forum.corona-renderer.com/index.php?action=dlattach;topic=38037.0;attach=172635;image)

(https://forum.corona-renderer.com/index.php?action=dlattach;topic=38037.0;attach=172637;image)
Title: Re: Scatter edge trimming shader
Post by: Nejc Kilar on 2022-10-11, 08:51:22
Also, to add to Bengamin's really helpful post, make sure you're on the latest daily too as there's been some improvements to the way we do trimming especially with Corona Proxy objects.
Title: Re: Scatter edge trimming shader
Post by: Philw on 2022-10-11, 12:24:48
Sorry to hijack the thread - but thank you all for that last setup - I now understand and it works brilliantly :-)
Title: Re: Scatter edge trimming shader
Post by: Pepelecrabb on 2022-10-11, 15:10:19
I am having difficulty understanding how this works.
 A slightly different scenario. I have a blanket in the middle of a grass field. How do I keep the grass from coming up through the balnket? The exclude spline does not seem to exclude.
I am using Short Grass 98-08 from Cosmos so you'll need to download for yourself. Unfortunately I cannot get a fabric from Cosmos for the blanket;)

 
Title: Re: Scatter edge trimming shader
Post by: TomG on 2022-10-11, 15:28:49
No time to look at the scene, but not sure if you have a way of using the edge of the blanket as some edge for the scatter (coz the blanket wouldn't be a spline). If all else fails, you should be able to use a Distance map, set to "Distance to" the blanket, into the distribution map of the scatter (now that distribution maps are supported :) )
Title: Re: Scatter edge trimming shader
Post by: Pepelecrabb on 2022-10-11, 22:09:56
Originally I took a looped edge of the blanket and converted to a spline and dropped that into the spline exclude box. Doesn't seem to do anything. Cancel that. I am more confused then ever, but now it is working (somewhat). 
Apparently this is not the correct tool for this instance. In my little test scene the blanket falls out of the image area on the x axis so it would work but what if I wanted to pull back the camera and get the whole blanket in the scene. The include/exclude areas only work on one axis. And you cannot use the same spline more then once to apply to different axis. I suppose I could break up the spline and use some parts for the z axis and the other for the x axis.
Don't know why it now works. I wanted to try what TomG suggested but putting a distance shader into the Distribution slot of Surface Scattering slowed my system down a bunch and eventually crashed. So I lost the scene and just reloaded the one I uploaded here. Then I tried to redownload the grass from Cosmos but now the newly updated version of Cosmos was giving me an error that the installer could not be found! Quitting Cosmos and restarting seemed to fix that problem. But I still cannot use certain Cosmos Fabrics. So I just had to use a rug for my blanket.
On a side note, Sorry I'm hijacking this too, I didn't notice the beer in Cosmos before. I know everyone thinks American beer is fn close to water, but this is ridiculous. Or there is something wrong with the beer_mtl. I'll just file that over at the Bugs Reporting along with some other observations after I have a real west coast IPA...It's just not been my day!
Title: Re: Scatter edge trimming shader
Post by: Beanzvision on 2022-10-12, 08:05:50
Hi there, have you tried using a different grass model? Seems to work better with smaller clumps rather than larger ones. As for the American beer (no comment) ;) There is some good beer shaders in our material library. The one from Cosmos has some issues and I will report it.

(https://forum.corona-renderer.com/index.php?action=dlattach;topic=38037.0;attach=172679;image)
Title: Re: Scatter edge trimming shader
Post by: Pepelecrabb on 2022-10-12, 13:50:18
It's a new day! Thanks once again Bengamin.
Title: Re: Scatter edge trimming shader
Post by: Beanzvision on 2022-10-12, 13:56:56
You're most welcome! :)