- Home /
Model Outline/Silhouette Shader
Hello,
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: http://wiki.unity3d.com/index.php/Silhouette-Outlined_Diffuse
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_$$anonymous$$ATRIX_IT_$$anonymous$$V, 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...