Transparency with soft edges and Shadows - not possible?

Node-based Shader Editor

Transparency with soft edges and Shadows - not possible?

Postby JBT27 » Thu Jun 07, 2018 11:23 pm

I have a large landscape mesh, onto which I want to place smaller meshes, each with their own shader and each having a soft border controlled by an opacity bitmap. All well and good: I set Render Type and Queue to transparent, and I get the nice soft blended borders I want. But shadows are then not received by these smaller meshes.

I read that Unity's transparent type or queue (not sure) does not receive shadows. The only way I can get this to nearly work is to set my ASE shader to a render type of transparent cutout, and the queue to geometry. Then I can control the borders using the mask clip value, and still receive shadows.

But is there any way to achieve those nice soft borders via my opacity masks, AND receive shadows on those smaller meshes?

Thanks.
JBT27
 
Posts: 9
Joined: Wed Jun 06, 2018 3:52 pm

Re: Transparency with soft edges and Shadows - not possible?

Postby Amplify_Borba » Fri Jun 08, 2018 11:14 am

Hello! Transparency and shadows is a complicated subject, mostly related to rendering limitations present in most engines and not a matter than can be easily solved.

While it is possible to have a transparent object write on the zbuffer in order for it to handle shadows, its not possible to do it partially, meaning that the object will either receive the whole shadow information, or allow it all to go through.
The intermediate solution that is present in Unity is to make use of dithering to fake this effect, but its only helpful in the casting of shadows, not the receiving.

A possible workaround, that would be far from perfect, would be to turn your transparent objects into opaque ones and use a grab pass to try and simulate transparency on your own. For this you need to be very careful on the Render Queue offset so they are rendered after all other opaque objects.

Also, when you set your shader to a Transparent Blend Mode it changes the type and queue to the transparent category, which will limit the shadow receiving capabilities, but with the following setup, you can also get alpha blend objects with receiving shadows:

CustomExample.jpg
CustomExample.jpg (127.91 KiB) Viewed 5661 times


Ideally, a custom solution would have to be written and implemented, as by default Unity provides no means of achieving this sort of effect without compromises.

Please let me know if this helps, thanks!
Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
User avatar
Amplify_Borba
 
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am

Re: Transparency with soft edges and Shadows - not possible?

Postby JBT27 » Fri Jun 08, 2018 4:39 pm

Yes, that helps a lot - thanks very much for your full reply.
JBT27
 
Posts: 9
Joined: Wed Jun 06, 2018 3:52 pm

Re: Transparency with soft edges and Shadows - not possible?

Postby Amplify_Borba » Fri Jun 08, 2018 5:59 pm

I'm glad that you found the shared information useful, please let me know if you have any further questions!
Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
User avatar
Amplify_Borba
 
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am


Return to Amplify Shader Editor

Who is online

Users browsing this forum: No registered users and 32 guests