Depth of Field
Depth of field is defined as the space in which we can see
objects clearly; objects outside this depth appear blurry to our eyes, whether
they are closer or further. Depth of field is fundamental to have for
photo-realistic rendering.
To do depth of field you need to have alpha information to
work with. To do depth of field you need to have alpha information to work
with.
The first step is to pre-blur the image through downsizing.
After this you use a kernel as well as the depth information to approximate
where your circle of confusion is. After this you blend between the original
and pre blurred image in this region.
This means that we need the blurriness as well as the depth
of each pixel. To get this we pass three different types of information from
the camera to the shader: the Focal Plane, the Near Plane and the Far Plane.
The camera stores depth information between -1 and 1. To blur we need an
absolute value instead of this relative value; to get this we merely half the
value and add 0.5. This allows us to pass through blurriness and depth through
the same channel. Even though we are doing this we can still do alpha blending
in two passes. First you render the rgb with blending enabled for the first
pass, after that you use the output of the your computation of depth blur to
render to your destination.
Then now you blur you back image. You then blur blend
between the original image and the blurred image based on the depth to find how
blurry the image is supposed to be.
Most blurring techniques cause leaking of sharp objects into
the background. To fix this we use the depth buffer to compare samples and
remove ones that contribute to this “leaking”.
Portals
Lately I have been working on a portal system, trying to
replicate the one in portal. There are three cameras in total, the main view
camera and a camera attached to each portal.
There is a three pass system. For the first pass I start off
by drawing the scene. I then create a texture out of the FBO from the first
portals view.
The second pass is much like the same but bound the texture
from the first pass to the second portals mesh before drawing the scene. Then I
create a FBO texture from the second portals view.
During my third pass I have both of the textures bound the
opposite portals, the first portals view is bound to the second and the seconds
view to the first. I then render my scene to an FBO.
The fourth pass is to create a full screen quad and put the
view FBO on top so that it can be post processed.
For the future I plane to add in the glow and ripple effects
in. Both of these would create two more passes for the program.
For glow I plan to make two different border textures which
I will blend between in order to get the glow to move. Then I will overlay this
created texture on top of the texture created for the portals. This will
require me to send in two additional textures and the a time variable that is
between 0-1 to use for blending.
For my ripple effect I plan to do something similar with
normal maps.
Teleportation is set up as a basic box collision check that
is checked on both portals. Going through the portals is set up as
teleportation for now as I am unsure how to do the gradual teleportation.
While this is not done yet I plan to work on it while I do
other things and will post about my progress in the future.
Game Jam
A few weeks ago I took part in a game jam again. The theme
of the game jam was interference and interactivity. There I had the chance to
work with the Leap Motion. I worked with two others to create the game Ballin’.
The basis of the game is to escort a marble through a maze and around pitfalls
while not being able to see all but you near surroundings. The catch is that
the maze is controlled by the Leap Motion. To play you would hover your hand
over the Leap Motion and the board would mimic the movements of your hand.
While it is not yet finished, we have actually acquired a Leap Motion of our
own and plan to make and perhaps release the game on our own time.

No comments:
Post a Comment