GoldSrc:mirv_movie_depthdump - advancedfx/advancedfx GitHub Wiki
mirv_movie_depthdump 0|1|2|3
- Default: 0
Allows to enable output of images containing depth information:
value | function | image | speed normal | speed sampled |
---|---|---|---|---|
0 | none | n/a | n/a | n/a |
1 | linear | fast | fastest | |
2 | logarithmic | slow | slow | |
3 | Inverse (OpenGl) | fastest | fast |
When using the mirv_movie_splitstreams (matte effects) have a look at mirv_depth_streams.
See mirv_depth_exr
The debug commands __mirv_depth_slice_lo and __mirv_depth_slice_hi allow to output only a slice of the depth buffer. This is useful in case your output format has way lower precision than your graphic card buffer, which is usually the case in the default settings (__mirv_depth_bpp).
This can be useful especially with function 3 (Inverse (OpenGl)).
You can use the linear depthdump to calculate actual distances for a specific pixel in the dump very easily.
The following information is required:
- p: The index value in the linear depth dump of the pixel (in 0 - 255) we want to calculate the distance for
- N: The zNear value, which tells us how far black pixels (index 0) are away. It depends on the map you used, to get the value load that map and execute __mirv_depth_info.
- F: The zFar value, which tells us how far white pixels (index 255) are away. It depends on the map you used, to get the value load that map and execute __mirv_depth_info.
Now you can calculate the distance d as follows: d = (p/255)*(F-N) +N
Since one unit in Half-Life is said to be about 1 inch the result will be in inches. 1 inch is about 2.54 cm.
Please be aware of the limited accuracy, the maximum distance error for linear 8bit depthdump is about 2 to 3 foot on most maps, __mirv_depth_info will display a more accurate estimation for the maximum error based on the current map.
When sampling is enabled, HLAE will internally linearise the depth buffer before sampling (and do further conversion after sampling). The sampling itself is averaging by integration, which happens with two-point approximation in the default sampling settings. So it's similar to what happens with opaque colour images upon sampling, but unlike those not based on a theoretical camera (well you can imagine collecting depth-rays if you want, I don't know haha).
- GoldSrc:Commands for related debug commands
- GoldSrc:Matte Effects for a manual entry about streams, matte and depthdump
- Andre Kramer - After Effects Depth of Field - you can use the depth stream in place of the gradient in this tutorial (you don't need to pre-compose then).
- msthavoc - HLAE Cam 2 AE Tutorial - in part 3 the tutorial covers how to use depth for masking
- (German) msthavoc - Tiefenunschärfe in CS mit Sony Vegas Tutorial