Java Programing

December 31, 2006

Figure 2.3 The positions of some projected points

Filed under: Java 3D Programming — webmaster @ 1:39 am

Figure 2.4 Compare the output from Java 3D (left) with the output from MyJava3D (right) 2.2.3 Drawing filled triangles Java 3D rendered the hand as an apparently solid object. We cannot see the triangles that compose the hand, and triangles closer to the viewer obscure the triangles further away. You could implement similar functionality within MyJava3D in several ways: Hidden surface removal You could calculate which triangles are not visible and exclude them from rendering. This is typically performed by enforcing a winding order on the vertices that compose a triangle. Usually vertices are connected in a clockwise order. This allows the graphics engine to calculate a vector that is normal (perpendicular) to the face of the triangle. The triangle will not be displayed if its normal vector is pointing away from the viewer. This technique operates in object space as it involves mathematical operations on the objects, faces, and 2 edges of the 3D objects in the scene. It typically has a computational complexity of order n where n is the number of faces. This quickly becomes complicated however as some triangles may be partially visible. For partially visible triangles, an input triangle has to be broken down into several new wholly visible triangles. There are many good online graphics courses that explain various hidden-surface removal algorithms in detail. Use your favorite search engine and search on hidden surface removal and you will find lots of useful references. Depth sorting (Painter s algorithm) The so-called Painter s algorithm also operates in object space; however, it takes a slightly different approach. The University of North Carolina at Chapel Hill Computer Science Department online course Introduction to Computer Graphics (http://www.cs.unc.edu/~davemc/Class/136/) explains the Painter s algorithm (http://www.cs.unc.edu/~davemc/Class/136/Lecture19/Painter.html). The basic approach for the Painter s algorithm is to sort the triangles in the scene by their distance from the viewer. The triangles are then rendered in order: triangle furthest away rendered first, closest triangle rendered last. This ensures that the closer triangles will overlap and obscure triangles that are further away. 17

Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Java Web Hosting services

No Comments

No comments yet.

RSS feed for comments on this post. TrackBack URI

Sorry, the comment form is closed at this time.

Powered by Java Web Hosting