A note about Z-Sorting

All of the methods described above work by modifying the z depth of a 3D object relative to the other 3D objects that are in the scene. It is important to realize that the desired relative depth of these 3D objects will change depending on the position of the camera. Consider the same scene created by the ZSorting application, but now viewed from the opposite side.

A note about Z-Sorting

In this situation, if we were to set the pushback property to true for Triangle B, as we did to fix the rendering order when the camera was on the left, we would in fact be introducing a z-sorting error rather than fixing it. This is because from the camera's new position, Triangle B should be drawn in front of Triangle A, not behind it.

So keep in mind that the values assigned to the pushback, pushfront, screenZOffset, and screenZ properties may need to be modified as the position and orientation of the 3D objects within the scene are changed relative to the position of the camera.

Tip

An example of where it is necessary to adjust the value of the screenZOffset property for a 3D object, as its position relative to the camera changes, is given in Chapter 10, Creating 3D Text, with the FontExtrusionDemo application.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.218.212.102