Page 1 of 2

Silhouette Shader

PostPosted: Tue Feb 13, 2018 11:57 am
by sazberryftw
Hi,

Is it possible to use ASE to create a silhouette shader? I'm aware of the Outline feature built into ASE currently, but this seems to render an outline on all edges rather than just the silouhette based on the camera position.

I've also noticed that with the Outline feature I get floating outlines if my models are using their own imported normals or on intricate details. Calculating normals within Unity fixes this issue but I don't want to manually calculate normals.

I've attached some screenshots to explain what I mean.

Re: Silhouette Shader

PostPosted: Tue Feb 13, 2018 2:07 pm
by Ricardo Teixeira
Hello,

Thank you for reporting the issue, we would be happy to examine it!

Can you share a sample for further testing on our side? (model and shader)

Feel free to send file download links directly to [email protected].

Thanks!

Re: Silhouette Shader

PostPosted: Tue Feb 13, 2018 2:41 pm
by sazberryftw
Hi Ricardo

Thanks for getting back to me. In regards to the issue with the current Outline effect - I'm not entirely sure what to send you. All I'm using is the tick box for "Outline", and this issue occurs on anything that doesn't have soft normals (such as a standard Unity cube).

However, I am looking for information on whether there are nodes that will let me create a silhouette effect instead of the way the Outline effect currently works. I want the outline to only be around the outer edges based on the position of the camera.

The desired effect below is not done with an Amplify shader.

Re: Silhouette Shader

PostPosted: Tue Feb 13, 2018 4:36 pm
by Ricardo Teixeira
sazberryftw wrote:Hi Ricardo

Thanks for getting back to me. In regards to the issue with the current Outline effect - I'm not entirely sure what to send you. All I'm using is the tick box for "Outline", and this issue occurs on anything that doesn't have soft normals (such as a standard Unity cube).

However, I am looking for information on whether there are nodes that will let me create a silhouette effect instead of the way the Outline effect currently works. I want the outline to only be around the outer edges based on the position of the camera.

The desired effect below is not done with an Amplify shader.


Thank you for the additional information, I just wanted to confirm that we could replicate the issue on our side.

Changing the Outline mode to "Vertex Scale" should resolve the issue. Alternatively, I recommend looking into the Custom Outline setups, they are quite flexible.

Image

Looking forward to your feedback!

Re: Silhouette Shader

PostPosted: Tue Feb 13, 2018 5:23 pm
by sazberryftw
Ricardo Teixeira wrote:Thank you for the additional information, I just wanted to confirm that we could replicate the issue on our side.


You can recreate the issue by using the example outline shader that comes with Amplify, and apply it to any object with hard edges, such as a cube. I assume this happens just because of the way vertex offset is calculated?

Ricardo Teixeira wrote:Changing the Outline mode to "Vertex Scale" should resolve the issue. Alternatively, I recommend looking into the Custom Outline setups, they are quite flexible.

Image

Looking forward to your feedback!


Using "Vertex Scale" seems to still outline inner edges (see screenshot). It also seems to scale from the pivot of the mesh rather than the center, is this how it's meant to work? Am I able to change it to scale from the center of the mesh? I have attached a Unity package with the asset from the screenshot.

I am using version 1.4.2 of ASE incase that is an issue.

Re: Silhouette Shader

PostPosted: Tue Feb 13, 2018 7:22 pm
by Ricardo Teixeira
Yes, I tested it with the default Cube.

Unfortunately, although you can tweak the way the outline is drawn, I don't think that you can quickly fully exclude overlaying outline effects.

I will have to get back to you tomorrow as soon as the ASE developer gets back to me. (national holiday here)

Thank you for bringing up the issue, hopefully there's something we can do to help.

Apologies for the inconvenience!

Re: Silhouette Shader

PostPosted: Wed Feb 14, 2018 9:18 am
by sazberryftw
Okay thanks for the info. :) Look forward to hearing more.

Re: Silhouette Shader

PostPosted: Wed Feb 14, 2018 2:01 pm
by Ricardo Teixeira
sazberryftw wrote:Okay thanks for the info. :) Look forward to hearing more.


In order to mitigate the outline issues, so to speak, we recommend using a custom outline similar to the screenshot; Transparent, ZTest=Always, and ZWrite=On. In any case, this solution will not work for every type of model.

In order to add a flawless outline you will need to implement a custom screen space solution. It involves a few additional scripts but it's quite flexible.

Unity Shaderlab Outline - Screen Space

I hope the information above helps, be sure to let us know if you have any additional questions.

Re: Silhouette Shader

PostPosted: Wed Feb 14, 2018 3:23 pm
by sazberryftw
Ricardo Teixeira wrote:In order to mitigate the outline issues, so to speak, we recommend using a custom outline similar to the screenshot; Transparent, ZTest=Always, and ZWrite=On. In any case, this solution will not work for every type of model.


Thanks, I implemented this and I can see what you mean.

Ricardo Teixeira wrote:In order to add a flawless outline you will need to implement a custom screen space solution. It involves a few additional scripts but it's quite flexible.

Unity Shaderlab Outline - Screen Space

I hope the information above helps, be sure to let us know if you have any additional questions.


Thanks for the information. I have a Valve Silhouette shader (package attached below) that appears to create a silouhette without the use of a screen space post effect. However, it masks out everything but the outline. Is it possible to use their method combined with the standard shader within Amplify? :)

I just stumbled across this whilst googling: viewtopic.php?f=8&t=425
Is the multi-pass effect mentioned what I'm trying to achieve?

Re: Silhouette Shader

PostPosted: Wed Feb 14, 2018 5:00 pm
by Ricardo Teixeira
sazberryftw wrote:I just stumbled across this whilst googling: viewtopic.php?f=8&t=425
Is the multi-pass effect mentioned what I'm trying to achieve?


I believe that was before we included support for Outline effects as we do at the moment.

Regarding the Valve example, it's great reference but unfortunately it requires multi-pass support. We're actually working on multi-pass support as we speak, it should be available in a couple of weeks.

I would definitely recommend looking into the screen-space solution as it provides the best results, regardless of the geometry used.

Apologies for any inconvenience caused, we'll keep your email on record and notify you as soon as multi-pass support is available.