Jump to content

7. Depth of Field Tutorial


ent

Recommended Posts

This tutorial will be about two different ways to make the depth of field (DOF) effect in videos captured with jaMME.

They are constant and variable (scriptable) DOF.

 

-----------------------------------------------------------------------------------------

Constant DOF

-----------------------------------------------------------------------------------------

 

Constant DOF is also divided in two different ways.

The first is capturing a DOF mask. To activate this way of DOF you have to set the cvar "/mme_saveDepth 1".

The DOF mask output will be in grayscale with dark colours for the nearest objects and light colours for the farthest ones:

ppqVSq7.png


This output will be captured as a parallel one to your regular one with an additional ".depth" string in its name. So you will have 2 more screenshots/videos.

And the regular screenshot:

jVX6mmn.jpg


Then you'd need to use additional software to apply a blur effect to your regular image by using the DOF mask. Example for Adobe After Effects: http://q3mme.proboards.com/thread/21/after-effects-tutorial-depth-field

 

To adjust the focus point - the position between the darkest and the lightest parts (aka gray centre), you need to use the cvar "mme_depthFocus". Try values between 0 and 2048. I suggest using 1024.

To adjust the length of "flow" between black and white - the range from focus to far and near objects, you need to use the cvar "mme_depthRange". It just adds and subtracts its value to "mme_depthFocus" to count the farthest place (white) and the nearest (black). Try 512 or a higher value. If it's over the value of "mme_depthFocus" then the black part will start behind the camera.

 

Quick setup:

1. Start demo and pause at needed moment

2. Type in the console "/mme_saveDepth 1"

3. Type in the console "/mme_depthFocus 1024" and "/mme_depthRange 512"

4. Type in the console "/capture avi 30 doftest1"

5. Unpause demo

6. Wait until it captures what you wanted and pause again

7. Quit game and find "doftest1.000.avi" and "doftest1.depth.000.avi"


 

 

The second way to capture DOF makes a more realistic DOF.

Instead of capturing a mask which would require being post-edited, it can create a single output with an already captured DOF. How does it work? The solution is simple: it just captures a bunch of frames with a little camera offset around one focus point each. Then it merges them together similarly to how motion blur merges frames, then saves them in one. The more frames it captures - the more realistic it looks.

 

To set the amount of frames that will be captured for final output, you need to use cvar "mme_dofFrames". WARNING: if it's 0 then it won't work. It looks rather cool with a value of 40 or higher. Max is 256. IMPORTANT: the more value is set - the longer capturing will be. Think like this: if "mme_dofFrames" is 40 then the output will be capturing 40x longer (maybe a bit faster though).

To adjust the focus point, use cvar "mme_depthFocus" like in the previous way. Also if you are chasing any object, then DOF focus will be on that object with this way of DOF.

To adjust the power of blur - how much camera is focused, use the cvar "mme_dofRadius". The value over 10 is something crazy.

 

Quick setup:

1. Start demo and pause on needed moment

2. Type in the console "/mme_dofFrames 40" and "/mme_dofRadius 5"

3. Type in the console "/capture avi 30 doftest2"

4. Unpause demo

5. Wait until it captures what you wanted and pause again

6. Quit game

 

 

 

-----------------------------------------------------------------------------------------

Variable (scriptable) DOF

-----------------------------------------------------------------------------------------

 

Variable DOF is the one which can change its focus point and focused power (radius) by following a scripted instruction. Those instructions are just control points like in the camera or timeline modes. Each keypoint contains information about the focus point and the radius. It works with the same technique as the second way of Constant DOF. Therefore to activate it you need to set the value of the cvar "mme_dofFrames" to more than 0.

 

TIP: DOF does not depend on your current view. Thus for the best result you should probably set the camera keypoints and lock the camera, so you will be editing DOF with an already prepared view.

 

Start your demo, fast-forward to the needed moment and pause. To start working with variable DOF you need to switch editing mode to "Dof". You can be in any Chase or Camera view modes to edit DOF. Now press 4 and it will show "Edit:Dof" in the demo HUD and draw a red grid in the game world. The place where the grid crosses the world is the focus point and the thickness of the lines represents the focused power aka radius.

Now you need to adjust DOF settings for the first keypoint. To adjust the focus point hold W and move your mouse. It will move the red grid in the world closer or more far from the previous position. After that hold SPACE and move your mouse again. It will change the grid lines' thickness with the radius value together (before, after). You can see the focus point position and the radius values in the demo HUD. Now press V to add a keypoint with the current values.

Hold SHIFT and move your mouse to move in time. Then hold W, move your mouse, hold SPACE, move your mouse to get new values for the current view and add a keypoint by pressing V again. Repeat until you're finished with your cool moment and lock DOF by pressing R. WARNING: if you don't lock, your scripted DOF won't work, and the 2nd constant DOF will work instead.

 

To delete a keypoint sync with it by pressing Q or E and then press B.

 

You can also lock your focus point on any entity. Therefore you will always be focused on that entity, and keypoints will only be able to change the radius. To lock the focus point on an entity you should be in Camera view ("View:Camera" in the demo HUD). Just fly with the camera by holding MOUSE1 and using movement keys like in the regular Camera view. Hold MOUSE1 and MOUSE2 together to highlight lockable entities. Position your view so that entity will be in the center of the screen (highlighting box will be red) and click F. IMPORTANT: Remember to be in DOF editing mode.

 

Now go through keypoints by pressing Q or E to switch to previous or next ones, and adjust them again if needed. So you are done now and it's time to capture. Type in the console "/capture avi 30 doftest3", rewind to the beginning of your editing (you can just hold Q to get to the first keypoint) and unpause to start capturing. You know how it works already. So there will be an output with captured scripted DOF in your "capture" folder. That's all.

 

Quick setup:

1. Start demo and pause at needed moment

2. Type in the console "/mme_dofFrames 40" to activate

3. Press Z or X to switch to Camera view

4. Press 4 to switch to DOF editing mode

5. Hold W, move your mouse

6. Hold SPACE, move your mouse

7. Press V to add a keypoint

8. Move in time and repeat 5, 6 and 7 steps

9. Press R to lock DOF

10. Type in the console "/capture avi 30 doftest3"

11. Unpause demo

12. Wait until it captures what you wanted and pause again

13. Quit game

 

Have fun.

----

ent

Boothand and Omicron like this
Link to comment
Guest
This topic is now closed to further replies.
×
×
  • Create New...