X_CULLMODE

Previous topic - Next topic

Hemlos

Quote from: HELP FILEThe "back" is defined as the side of an object that its normal vector is not pointing to. The normal for every triangle in a 3d object is calculated automatically by the graphics engine. When you create a triangle, by drawing its points in an anti-clockwise direction you are telling the graphics engine to point the normal towards the camera rather than away from it.


X_OBJSTART 1
X_OBJADDVERTEX   0,  0, 0,  0,0, RGB(255,255,255)
X_OBJADDVERTEX -20, 40, 0,  0,0, RGB(255,  0,  0)
X_OBJADDVERTEX  20, 40, 0,  0,0, RGB(  0,  0,255)
X_OBJEND

This is quoted from the help file....
In this excerpt the document says must be drawn anti-clockwise, which is counter clockwise i believe.
But the vertex are written in the sample below moving in a clockwise motion.

Should it be drawn clockwise or counterclockwise?
Is cullmode reversed?
Or is the documentation worded wrong?

Bing ChatGpt is pretty smart :O

Kitty Hello

the vertices here are drawn counter clockwise ;)

Hemlos

#2
Hmm, whats wrong here is the sample code is showing the vertices are being drawn clockwise, not anti-clockwise:

v2-v3
  \  /
   v1

Code (glbasic) Select
X_OBJSTART 1
X_OBJADDVERTEX   0,  0, 0,  0,0, RGB(255,255,255)
X_OBJADDVERTEX -20, 40, 0,  0,0, RGB(255,  0,  0)
X_OBJADDVERTEX  20, 40, 0,  0,0, RGB(  0,  0,255)
X_OBJEND

X_MAKE3D 1,20000,90
X_CULLMODE 1
X_CAMERA 0,1,50, 0,0,0

X_DRAWOBJ 1,0
SHOWSCREEN
MOUSEWAIT



This image #1 shows the order and vertices X and Y, it is the sample object (im not an artist but you can see the idea), this is clockwise.

In image #2: this is a screenshot of this code above.
So i think the problem is, the help file, stating "anti-clockwise".
I was making all my objects backwards because of that word lol  :'(

One other thing, can you add a line in X_OBJ... stating a triangle alone in a group must be drawn starting "clockwise", to show the face.

[attachment deleted by admin]
Bing ChatGpt is pretty smart :O

Kitty Hello

oh dear. "clockwise" is a bad name.
Should be "cross product is posisitve".