Quantcast
Channel: bugs, errors - openFrameworks
Viewing all articles
Browse latest Browse all 636

ofSpherePrimitive has an opposite winding order

$
0
0

@cuinjune wrote:

Hi, I've been playing with normals of 3d objects and I found out ofSpherePrimitive has a counter-clockwise winding order which is an opposite direction of all other 3d primitives.

I found this out not only by manually checking the order of indices but also have done a testing to prove this.
The test I've done was to copy all the vertices from original 3dPrimitives to ofMesh and then apply new normals to the mesh based on its vertices.
I used surface normal calculation found from https://www.khronos.org/opengl/wiki/Calculating_a_Surface_Normal

And this is the screenshot of the test which shows 4 original 3d Primitives at the top and 4 meshes that use surface normals at the bottom.

And as you can see, the sphere at the bottom doesn't reflect light because it has an opposite winding order so it's back faced.

So I changed all normal winding order to opposite, then I got this result.

As you can see, only sphere has an opposite winding order.
I think the original ofSpherePrimitive has opposite order of indices and also opposite order of normals so it looks like it is working correctly, but it's not.

Please find the attached source files below.

ofApp.h (945 Bytes)
ofApp.cpp (5.6 KB)

Posts: 4

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 636

Trending Articles