Hello there!
Firs of all, i’m Sergio, nice to meet you all, first time asking a question around here, so please be gentle hehehe
About my problem, right now my group and i are working on a VR game, with a cartoonish style, and we are using the Toon Outline Lit from the standard assets.
My biggest problem with this shader is the “re-sizing” of the outline, the further away you get, the thicker the outlines become. Let me show you a couple pics.
This is what i’m talking about, because of this the models are completely blocked by the outline if you move the camera away, making them impossible to see unless you are very close.
So, that’s my question, is there any way to make the outline to re-size depending on the distance, to keep the ratio so the model doesn’t become a black dot in the screen?
I started playing with some of the parameters, for example i discovered that what i want to do is actually possible if we change this line. (source code: Shader “Toon/Basic Outline” )
Code (CSharp):
- #ifdef UNITY_Z_0_FAR_FROM_CLIPSPACE //to handle recent standard asset package on older version of unity (before 5.5)
- o.pos.xy += offset * UNITY_Z_0_FAR_FROM_CLIPSPACE(o.pos.z) * _Outline;
- #else
- o.pos.xy += offset * o.poz.z * _Outline;
- #endif
If i delete the UNITY_Z_0_FAR_FROM_CLIPSPACE part, leaving it as .pos.xy += offset * o.poz.z * _Outline; my objective is achieved, BUT, it won’t work in VR (i’m using HTC VIVE), only with normal cameras, there is some step inside the VR camera that a normal camera won’t do (the cameras configuration, view, field etc are the same, the problem only appear once the VR is working)
I’m new in shaders so my knowledge is very limited, but any help or workaround is most than welcome.
Thank you for reading!