1
\$\begingroup\$

We superposed two cameras, one of which uses AA as post-processing effect (AA filtering is cancelled). The camera with the AA effect has depth 0 and the camera with no effect has depth 1 as can be seen in the 5th and 6th Picture. The objects seen on the left are in layer 1 and the ones on the right are in layer 2. We then wrote a script that switches the culling masks of the cameras between the two layers at the push of buttons 1 and 2 respectively, and accomplishes object-selective antialiasing as seen in the first the three pictures. (The way two cameras separately switch culling masks between layers is illustrated in pictures 7,8 & 9.)

HOWEVER, after making the environment 3D (see pictures 1-4), by parenting the 2 cameras under First-Person Controller, we started moving around in the environment and stumbled upon a big issue: When we look at the objects from such an angle as in the 4th Picture and we want to apply antialiasing to the first object (object on the left) which stands closer to our cameras now, the culling mask of 1st camera which is at depth 0, has to be switched to that object’s layer while the second object has to be in the culling mask of the 2nd camera at depth 1. And since the two image outputs of two superposed cameras are laid on top of one another; we obtain the erroneous/unrealistic result of the object farther in the back appearing closer to the camera than the front object (see 4th Picture).

We already tried switching depths of cameras so that the 1st camera –with AA- now has depth 1 and the second has depth 0; BUT the camera with the AA effect Works in such a way that it applies the AA effect to its full view. So; the camera with the AA effect always has to remain at the lowest depth and the layer of the object to be antialiased has to be then assigned to the culling mask of the AA camera; otherwise all objects in the AA camera’s view (the two cubes in our case) become antialised, which we don’t want.
So; how can we resolve this? The pictures are below and in the comments since each post can have 2 pics:

Pic 1. No button is pushed: Both objects seem aliased.

Pic 1. No button is pushed: Both objects seem aliased.

Pic 2. Button 1 is pushed: Left (1st) object is antialiased. 2nd object remains aliased.

Pic 2. Button 1 is pushed: Left (1st) object is antialiased. 2nd object remains aliased.

Pic 3. Button 2 is pushed: Right (2nd) object is antialiased. 1st object remains aliased.

Pic 3. Button 2 is pushed: Right (2nd) object is antialiased. 1st object remains aliased.

Pic 4. The problematic result in 3D, when using two superposed cameras with different depths

Pic 4. The problematic result in 3D, when using two superposed cameras with different depths

Pic 5. Camera 1’s properties can be seen: using AA post-processing and its depth is 0

Pic 5. Camera 1’s properties can be seen: using AA post-processing and its depth is 0

Pic 6. Camera 2’s properties can be seen: NOT using AA post-processing and its depth is 1

Pic 6. Camera 2’s properties can be seen: NOT using AA post-processing and its depth is 1

Pic 7. When no button is pushed, both objects are in the culling mask of Camera 2 and are aliased

Pic 7. When no button is pushed, both objects are in the culling mask of Camera 2 and are aliased

Pic 8. When pushed 1, camera 1 (bottom) shows the 1st object and camera 2 (top) shows the 2nd

Pic 8. When pushed 1, camera 1 (bottom) shows the 1st object and camera 2 (top) shows the 2nd

Pic 9. When pushed 2, camera 1 (bottom) shows the 2nd object and camera 2 (top) shows the 1st

Pic 9. When pushed 2, camera 1 (bottom) shows the 2nd object and camera 2 (top) shows the 1st

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.