Outline Alternate Method
I'd like to see an alternate option to the current outline feature that keeps the vertices connected at the corners:
Answer
The issue is that in shaders, individual vertices don't know whether or not other vertices are in the same location, which is exactly the case on hard edges. Vertices only have a single normal, so, on hard edges, their normal direction is just the one of the triangles it's associated to.
There is no ideal solution, but there are ways of getting the ideal looking one, with some limitations
The first two are solutions on my end, the third is something you can do now already:
1. Be able to switch outline mode to "Scale" instead of "Normal offset". Essentially works by scaling a copy of the object, and reversing its face normals. The limitation with this is of course that it only works on convex objects that are near-spherical or cuboidal. So, in your case, the "Scale" method would work.
2. Use vertex colors as normals. This would require baking normals to the vertex colors, which would be required by asset creators in a program such as Maya.
3. Make your meshes 100% smoothed - make tiny bevels at hard edges to make them look sharp, while keeping the mesh smoothed, which will make sure the outline is fully connected.
I think #1 and #2 are viable options for me to implement in SF at some point, but #3 should work right now :)
Is it possible to add a color to the outline based on a texture?
- Vertex normals
- Vertex colors
- From origin
The second one will read the vertex colors as directions. I've added a script you can add to your objects, to make their meshes write outline-style normals into the vertex colors. That way, you sacrifice the ability to use vertex colors, but gain the ability to have hard edges together with a continuous outline!
The third one is as the "scaled" method mentioned above - it will move the verts away from the origin.
Hope it helps :)
Hey Joachim,
Could you elaborate about the outline method using vertex color. I can't seem to find that script to add to your objects. :)
Oh boy, I looked for it before and now I instantly found it of course :) Thanks for answering anyway, works like a charm now!
Hi, I have an Issue, I`d like to try out the Vertex Color variant of the border feature, the problem Is I`m working with double sided meshes (because of collisions) and it seems the script can't handle it. I can't afford to bevel all the meshes though the game is made of simple geometrical shapes, but It's matter of breakeven.
Isn`t there another possible way working it out as a post effect (i.e. like a classical 1px wireframe)?
Thanks! Great Editor!
It is possible to do it with a post effect, but it's not cheap. It would probably involve multi-sampling the depth buffer and write black if the threshold of the depth buffer is larger than some value, and not write anything if it's below.
@Joachim Is it possible to only outline object? The current one is more of a toony look (Vertex Normals) where as I just want a unit select looking shader (like what games like dota have)
Hello,
I'm using the "soft normals to vertex color" script to be able to make a smooth outline even in geometry with hard edges. It is great. But my problem is that I can only use it with the checkbox "generate on awake" enabled because if I close and open unity the vertex info is gone.
I'd like to use the script to bake the soft normals info into vertex color and then remove the script. Is it posible? Am I misunderstanding the "soft normals to vertex color" script purpose?
Thanks a lot
Customer support service by UserEcho
- Vertex normals
- Vertex colors
- From origin
The first one is the default behavior we've had before.The second one will read the vertex colors as directions. I've added a script you can add to your objects, to make their meshes write outline-style normals into the vertex colors. That way, you sacrifice the ability to use vertex colors, but gain the ability to have hard edges together with a continuous outline!
The third one is as the "scaled" method mentioned above - it will move the verts away from the origin.
Hope it helps :)