3D Fundamentals...

Blitz3D Forums/Blitz3D Beginners Area/3D Fundamentals...

WillKoh(Posted 2004) [#1]
I thought I'd learn 3D now, and the fundamental parts are vertices as far as I understand (I like to understand things thoroughly(sp?)) I took the vertex example of the help and changed it like this:


Graphics3D 640,480 
SetBuffer BackBuffer() 

mesh = CreateMesh() 
surf = CreateSurface(mesh) 

	V1x# = Input$("V1.X: ")
	V1y# = Input$("V1.Y: ")
	Print ""
	V2x# = Input$("V2.X: ")
	V2y# = Input$("V2.Y: ")
	Print ""
	V3x# = Input$("V3.X: ")
	V3y# = Input$("V3.Y: ")

	Plot 320+V1x#*10,240+V1y#*10
	Plot 320+V2x#*10,240+V2y#*10
	Plot 320+V3x#*10,240+V3y#*10
	
	Print ""
	
	Print "Dare you see result (Y/N)?"
	
	While ink = 0
		ink = GetKey()
		If ink=Asc("y") Exit
	Wend
	
v2 = AddVertex (surf, V1x, V1y, 0)
v1 = AddVertex (surf, V2x, V2y, 0)
v0 = AddVertex (surf, V3x, V3y, 0)

tri = AddTriangle (surf,v0,v1,v2) 

cam = CreateCamera() 
MoveEntity cam, 0,0,-14

RenderWorld 
Flip 

WaitKey 
End  




The first part plots the x,y of the vertices of this traingle as I would think of it (after all y is still up/dn and x is still right/left in 3d, and bigger x is more right and bigger y is more down). The part that shows the 3d result confuses me. If I don't set the vertex with the lowest x,y as the last (index 2) (and so forth) nothing shows, and if I do so (as in the code above) the resulting triangle is the exact opposite of what I expected...

Assume that the first answer is 0,0, the next 5,0 and the third 0,5..


big10p(Posted 2004) [#2]

...and bigger y is more down).



No, bigger y is more up. ;)


WolRon(Posted 2004) [#3]
Left hand coordinate system.
All fingers point positive.
No finger points downward.


eBusiness(Posted 2004) [#4]
Rmember that a triangle is only viewable from one side, I think there is some command or parameter to flip it around.


WillKoh(Posted 2004) [#5]
>> No, bigger y is more up. ;) >>

Why did you put a smiley at the end? I thought you were kidding since in 2d it's more down. The might help to clear at least some things..


Gabriel(Posted 2004) [#6]
When you create triangles, you have to do so in a clockwise manner. If you create them in an anti-clockwise fashion, they will face the opposite direction, as eBusiness says. You can flip all the faces on a mesh with the FlipMesh() command, but I'm not sure if you can flip one triangle alone, so it's usually best to ensure you create them clockwise.


big10p(Posted 2004) [#7]

Why did you put a smiley at the end? I thought you were kidding since in 2d it's more down. The might help to clear at least some things..


No, I wasn't kidding.