x


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.

more ▼

asked Oct 15 '10 at 02:41 AM

MikezNesh gravatar image

MikezNesh
843 64 74 93

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

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.

more ▼

answered Oct 15 '10 at 09:26 PM

skovacs1 gravatar image

skovacs1
10k 11 25 91

Where do I put the code?

Oct 15 '10 at 11:18 PM MikezNesh

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.

Oct 18 '10 at 02:07 PM skovacs1
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x2978
x89
x42
x5

asked: Oct 15 '10 at 02:41 AM

Seen: 1414 times

Last Updated: Oct 15 '10 at 02:41 AM