Hello!

Does anybody of you have an idea how to project a 3D Object to a 2D Plain? My 3D Object consists of many tetraeders (with different colors) and therefore is a polyeder.

What I have is a polyeder that is in a XYZ coordinate system and that I want to project to a XY or YZ etc. plain (with the corresponding colors). I thought about drawing all triangles of the tetraeder of the polyeder in a certain row so that I finally have some kind of projection, but I dont know how I should sort the triangles before drawing them. Another but more complex idea is to find the collision point of a parallel ray (parallel to the not included Axis) with the polyeder - and project it to the corresponding plane, but honorly I have no idea how to realize it. Do you have any idea how to make it (if possible as easy as possible:)) - maybe you can give me a bit of a code? Thanx in advance,

Stefan

Hello Stefan,

could you explain crystal clear what you are trying to achieve ?

SeskaPeel.

Hi!

I have a 3D Coordinate system and I have a 3D object in this Coordinate system. This object consists of Tetraeders (which consists of triangles). I have the triangle points in the 3D space and their color (almost all have a different color). Now I try to make a projection of this 3D object to e.g. the XY Plane - how can I achieve that by also projecting the right colors to the XY plain?

I tried it with drawing the triangles and setting the z values of the points to 0 which works fine with the shapes. But unfortunatly the colors are not drawn properly ( because the colors of the front perspective are darker than the colors of the back perspective - due to the fact that I dont know how the triangles lie to each other I dont know which triangle is in front of which triangle and therefore it happens that a triangle that is in in front of another triangle is drawn first and than the other triangle is drawn - which sets the color to the color of the back triangle)…

Do you have a solution (even if it is totally different)?

Thanx

Stefan

I propose two solutions for your problems.

1/ Render your scene with the camera set on a point that lies on a perpdendicular axis to your plane, with ortho mode. Then grab the backbuffer in a texture (glCopyTexSubImage2D) and draw your texture on the plane. You’ll be careful to have this perpendicular axis passing by the centroid of your object so that the falt model will be in the center of the texture, in order to minimize its size. You’ll probably have aliasing effects. This is very similar to shadow mapping.

2/ I’m not a bigh maths guru, but I suppose you could find a workaround with a correct matrix transformation. If you wanted to project on the XY plane, you’d have to set a scale to 0.0 on the Z axis (this way your object will be rendered flat), and then translate it down to the XY plane. Maybe the scale set to 0 will induce z-fighting problems, so if this happen, you can try a scale factor of 0.01.

Method 2 is obviously faster.

SeskaPeel.