   Translucency
  Hi. I''m working on an application that includes much 3D. I am using OpenGL for rendering. At the moment, I am facing a serious problem in one feature - implementing translucent objects. I believe I''ve read all of NeHe tutorials on this subjects, but that doesn''t seem enough.From what I''ve figured, to achieve this effect I have to draw all the triangles of my object in fartherst-to-nearest order. But, isn''t sorting at every frame too slow to achieve real-time rendering? And how exactly do I figure which of two triangles is in front? Is this sorting stuff really needed, or can I achieve translucency in a more efficent way (the thing I want to render is a little ship in a translucent bottle)? I''ll be very happy if someone can help me with this... 
  Well, firstly, sorting isn''t that slow.Secondly, things such as portals, BSPs and octrees can help you transverse your scenery in depth-order.Sorting wise, assuming your triangles never intersect, triangle A is in front of triangle B if all of the vertices of A are in front of the most distant vertex of B. Another, approximate, solution is to sort on the average distance of each vertex.   CoV;We use sorting, but we don''t sort individual triangles.  Instead, we  sort groups of polygons.  For example, if translucent particle system A is "generally" behind translucent particle system B, we draw particle system A first.  This approximation causes a small anomaly: it will always appear that one is in front of the other, even if the two are actually side-by-side and intersecting.  Another minor side effect is that there will be a small "pop" if system A moves forward until it''s in front of B.  I think the anomalies are sufficiently minor as long as your scene doesn''t contain *that* many translucent objects.   ;  Render ship, enable alpha blending, render bottle, disable alpha blending.   Height Map Editor | Eternal Lands | Fast User Directory