Basically, I have 2 triangles that appear slightly different in color (looks like a lighting issue due to incorrect normals). But I don't think this is the case...
Details
I have a simple cube (box), where each face is composed of 6 vertices using a vertex buffer (I am not using an index buffer at the moment).
In addition to my vertices I have defined the normal values for each face.
However, it appears that something is slightly wrong with either the normals (which I don't think there is an issue with) and/or the lighting.
Each face is drawn using WebGl.drawArrays using TRIANGLE_STRIP. The image is showing the front face of the cube. The following are its vertices (note that the origin is the top-left corner of the front face):
0, 1, 0,
0, 0, 0,
1, 0, 0,
1, 0, 0,
1, 1, 0,
0, 1, 0
The following are its normals:
0, 0, 1,
0, 0, 1,
0, 0, 1,
0, 0, 1,
0, 0, 1,
0, 0, 1
Question
Any ideas why the 1st triangle is lighter in color than the 2nd triangle?
The trick with triangle strip is that each additional triangle gets one additional vertex but three normal vectors. I would guess you are not specifying enough normal vectors or specifying too many vertices.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With