How do I Create a 2D isometric image from a 3D entity?

Blitz3D Forums/Blitz3D Programming/How do I Create a 2D isometric image from a 3D entity?

leeluna(Posted 2003) [#1]
I am very new to programming and would like to get my head around isometric perspective. Something along the lines of having a cubes 3D co-ordinates and then producing an Isometric Representation of it in 2D.

Any help to get me going on this would be well received.

Lee.


Todd(Posted 2003) [#2]
Doing that would require some 3d maths (which I don't know), but there is a command in Blitz3d to render a camera view orthographically. This will give the same result without having to redo the scene in 2d. Just use
CameraProjMode Camera,2 
on your camera. You might need to zoom out and move the camera around to get the right view too.


RexRhino(Posted 2003) [#3]
And it would not be that hard to write a program to get a close up of your 3D object, render it and then save the bitmap (maybe you could also shrink the bitmap to the right size).


leeluna(Posted 2003) [#4]
Thanks for the info peeps, But sadly I need to be able to get an isometric output. My field is pipe manufacture and what I intend to write would be a program that can take 3D co-ordinates from a 3D modeling package such as CADDS5 and produce a nice manufacture isometric drawing to actually make the pipe too. There are a few products on the market that do this but they all produce an output that needs some cleaning up to make them clear enough for someone to use.

This is a site to the most used one, Have a look and you may then see what I am trying to achieve.

www.alias.ltd.uk/isgn_det.htm

Thanks Lee.


_PJ_(Posted 2003) [#5]
Point the camera azt the object, when on an identical plane. Then turn the object through 30 or 60 degrees.

You may need to play with the CameraZoom or Scale functions as the distortion of the object may be more or less apparent in your final screen.

When you are happy, use SaveBuffer and grab the screen display into a bitmap.


Todd(Posted 2003) [#6]
Here, you can try something like this. If you need me to explain it I can, but it should be pretty simple. Also, make sure you replace "test.b3d" with the model you want to use.

Graphics3D 800,600,32,1
SetBuffer BackBuffer()

Camera=CreateCamera()
PositionEntity Camera,0,3,-6
TurnEntity Camera,27.5,0,0
CameraProjMode Camera,2
CameraZoom Camera,0.1

Cube=LoadMesh("test.b3d")
FitMesh Cube,-5,-5,-5,10,10,10,1

Light=CreateLight()
TurnEntity Light,30,50,0
AmbientLight 50,50,50

Dim prX#(3)
Dim prY#(3)

While Not KeyDown(1)
Cls
	
	RotateMesh Cube,0,1,0
	
UpdateWorld
RenderWorld

	For s=1 To CountSurfaces(Cube)
		Surf=GetSurface(Cube,s)
		For t=0 To CountTriangles(Surf)-1
			For v=0 To 2
				Vert=TriangleVertex(Surf,t,v)
				vX#=VertexX(Surf,Vert)
				vY#=VertexY(Surf,Vert)
				vZ#=VertexZ(Surf,Vert)
				TFormPoint(vX#,vY#,vZ#,Cube,0)
				vX#=TFormedX()
				vY#=TFormedY()
				vZ#=TFormedZ()
				CameraProject(Camera,vX#,vY#,vZ#)
				prX(v)=ProjectedX()
				prY(v)=ProjectedY()
				Color 0,255,0
				Oval prX(v)-1,prY(v)-1,3,3
			Next
			Line prX(0),prY(0),prX(1),prY(1)
			Line prX(1),prY(1),prX(2),prY(2)
			Line prX(2),prY(2),prX(0),prY(0)
		Next
	Next

	Color 255,255,255
	SetFont LoadFont("Small Fonts",11)
	Text 16,16,"Press <Esc> to End"

Flip
Wend



leeluna(Posted 2003) [#7]
This is pointing me in the right direction, Thanks Todd