0
En revisión

Variable z offset for outline

sugarchap hace 9 años actualizado por Freya Holmér (Developer) hace 8 años 6

Hi!


I'm using the outline quite heavily for our game's non photorealistic style, and am running into a few limitations with the outline. With more complex meshes (characters for example) with concave geometry, the outline often appears in front of these details in small patches and generally makes the model appear messy.


The outline is being generated properly (soft normals to vertex colours).


It would be great to have additional control on the z read offset of the outlines to enable them to be 'pushed back' into the geometry, lessening these artifacts.

Respuesta

Respuesta
COMPLETADO

You can probably do this manually. Offset them in the negated direction of the view vector based on whatever data you want to base them on

Respuesta
COMPLETADO

You can probably do this manually. Offset them in the negated direction of the view vector based on whatever data you want to base them on

Thanks for the reply!


Offset the outline? Excellent. Which node does that?


I have previously tried offsetting the mesh but (as you would want normally) the outlines followed

En revisión

Oh wait, I was thinking of vertex offset, sorry. Not sure if outlines will have support for this anytime soon

Hi Joachim.


I was wondering if this is the right place to pester you about it. I've ended up hand editing my compiled shaders to achieve this result (an offset of the outline away from the camera) and my workflow is really starting to creak. If you're able to introduce this functionality I'd really appreciate it.


For your interest, here's our main character - Felix without the outline offset -

And with -


Following up here. We are using this functionality in anger, and are finding it very useful for the outlines shader. However, it is becoming tough to maintain the hand-edits across all the shaders in the game. Any chance that this could become incorporated?


Here is what I do in the shaders, if that helps. I have added the line marked //HANDEDIT


VertexOutput vert (VertexInput v)

{

VertexOutput o = (VertexOutput)0;

o.uv0 = v.texcoord0;

v.vertex.xyz += mul( unity_WorldToObject, normalize(_WorldSpaceCameraPos - mul(unity_ObjectToWorld, v.vertex).rgb) * -min(v.vertex.y, 0.15)); //HANDEDIT

o.pos = mul(UNITY_MATRIX_MVP, float4(v.vertex.xyz + v.vertexColor*_OutlineWidth,1) );

UNITY_TRANSFER_FOG(o,o.pos);

return o;

}


Cheers!

I'll see if I can prioritize this for the next update. However, 5.6 changes are of higher priority! So it might take a bit