- Home /
per face lighting, low poly
Hi is there away to achieve per-face lighting in Unity? I'm trying to achieve a lowpoly, 90's virtual reality look for an art project.
Something along the lines of:
Answer by whydoidoit · May 02, 2013 at 06:21 PM
If you make the vertices of each face separate and all sharing the same normal then you will get that effect. So don't share vertices between faces, have multiple in each location. Normally in a modelling package you control this with smoothing (you don't want any!) or a flat shading option.
For my case, I'm defor$$anonymous$$g a plane in real time. In that case I guess unity's RecalculateNormals is the "culprit" ( even though it's doing exactly what it should do ) - Any pointers on where I might be able to calculate the normals myself in this manner?
Sure take the tree points of the triangle and calculate the cross product of the vector3 between them (though if you have the vertices split this should just work - are you sure that you are creating each face totally separately and not sharing the vertex?).
var normal = Vector3.Cross((p2 - p1).normalized, (p3 - p1).normalized);
(Or I might have it backwards and it's - that).
So each face has 6 vertices and 2 triangles? (or at worse it has a flat face has at least 4 vertices that aren't the vertex indices in any other triangle).
I'm creating a plane, and simply applying noise to deform it. I'm using the default plane from Unity, so I'm sure the vertices are shared. Once perform that calculation on each triangle, how can I be sure I overwrite the correct normal in the array?
It's impossible if the vertices are shared. You are going to have to make your own plane....
Your answer
Follow this Question
Related Questions
Light bulb moving HELP 1 Answer
Ugly shading issue 2 Answers
Gui label text change 0 Answers
Colors Seem all wrong when I set them in RGB 2 Answers
my point light and spot dont work 1 Answer