- Home /
Basic Outline (Toony) doesn't work with orthographic view?
How come when I apply Toony - BasicOutline to a sphere the outline doesn't work when in an Orthographic?
Anyone know how to get it to work in an Orthographic?
Thanks.
Answer by skovacs1 · Oct 15, 2010 at 09:26 PM
It should work in both the Orthographic and Perspective cameras if you change the vertex program to something like:
v2f vert(appdata v) {
v2f o;
o.pos = v.vertex;
o.pos.xyz += v.normal.xyz *_Outline;
o.pos = mul(UNITY_MATRIX_MVP, o.pos);
o.color = _OutlineColor;
return o;
}
The problem with the old version is that the position was being adjusted in camera-space and The projected normals don't behave the same in orthographic projection as they do in perspective projection. The simple workaround used here is to add the outline in world-space and then project to camera space.
This is a shader vertex program - The Toony-BasicOutline shader to be precise. There's only one vertex program in the entire shader. Replace the vertex program at lines 26~35 with this one and it should do the trick.
This solution worked for me still using Unity 2017.3.1f1. Thank you so much!
Your answer
![](https://koobas.hobune.stream/wayback/20220613075743im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
scaling (Resizing) orthographic camera in 2D mode 3 Answers
I need no perspective distortion for some part of screen 0 Answers
How to make a smash bros-like camera 3 Answers
Dynamic Orthagraphic Camera Zoom 1 Answer
2D Camera size based on unit width 1 Answer