I want to get a nice outline around my model like this:
In fact, this image is from the wiki unity 3d for an outliner shader, which is what I'm currently using, but it doesn't display correctly on my imported models.
Here is the link to the Silhouette Shader that I'm using:
Now, the shader works fine on the prebuilt shapes within Unity, below is a screen shot, on the left are a bunch of trees I made in Maya, and the right it a Unity sphere, which displays it perfectly:
As you can see, it has a nice outline on the right model, but the left (trees) appear to split with the edges of my model. When I click on my tree, I can see that the Vertex Faces have been pulled apart slightly, where as the Unity Sphere is still in tact. Is this to do with my actual model?
Answer by oliver-jones
Sep 17, 2013 at 02:04 PM
Seems to work fine when I change my model Import Settings:
If I change the 'Normals' to Calculate, instead of Import, it seems to work. Any reason why this is?
Although this really decreases the res/detail of my model
Well, the silhouette shader you're using creates the outline by moving the vertices of the backfaces of your model out based on their normals. That's what these lines do:
float3 norm = mul ((float3x3)UNITY_MATRIX_IT_MV, v.normal);
float2 offset = TransformViewToProjection(norm.xy);
o.pos.xy += offset * o.pos.z * _Outline;
So, if your model's normals are messed up, that would mess up the outline too.
I see, well, they're hardly messed up ... are they? What do you mean by messed? And how would I fix them?
I have no idea - I'm just telling you what I believe the problem to be based on your screenshot and description...
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a site navigation guide.
If you are a new user to Unity Answers, check out our FAQ for more information.
Make sure to check out our Knowledge Base for commonly asked Unity questions.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
Answers and Comments
18 People are following this question.
Object outline component
Making a silhouette outline shader
Outlined Shader Shadows
Silhouetted-Outlined Shader not working with baked lights.
Silhouette Toon Shader