ENBSeries wrote:
I can't help much, because have no idea what examply do you need, so math for converting depth to proper value is on your side. SamplerDepth is what you need, right, but also you must not use post processing filters (tonemapping) in enbeffect.fx, because they will be applied to depth data, so do the following:
before
Code:
return _oC0;
insert this line
Code:
color=tex2D(_s0, _v0.xy);
and depth will be directly written without changes (of course if enbeffectprepass.fx output is depth).
Depth output in enbeffectprepass.fx is probably code like this:
Code:
res=tex2D(SamplerDepth, IN.txcoord.xy).x;
and some kind of linearisation and scaling code like this:
Code:
res=tempF1.x/(max(1.0-res, 0.00000000001));
so temporary variable 1 (key 1 and pageup/pagedown keys or in editor window) will handle scaling. I don't remember if depth is linear or not, that math is to make it linear.
Thank you.
What i need is a grayscale image with the dark pixels being out of focus and the bright pixels being in focus, sort of like your video here:
http://www.youtube.com/watch?v=w56RMuXclps but for depth only. That way I can apply blur or fog on the image based on the pixel luminance in some editing software.
Example of depth map/pass:

(random image from google)
I will try first with midhrastics preset, I found:
Code:
return _oC0;
in enbeffect.fx and inserted the line.
The closest to the second code in enbeffectprepass.fx I found was:
Code:
}
//SRCpass1X=ScreenWidth;
//SRCpass1Y=ScreenHeight;
//DESTpass2X=4;
//DESTpass2Y=4;
float4 PS_ReadFocus(VS_OUTPUT_POST IN) : COLOR
{
#ifndef USE_MANUAL_APERTURE
float res = tex2D(SamplerDepth, 0.5).x;
#else
float res = EApertureScale * tempF1.x;
#endif
return res;
}
Code:
float EApertureScale = 1.0; // Matso - base size of the manually changable aperture size (use keys to change the value of 'tempF1' to vary the actual aperture)
What am i supposed to do with these? Change to the code you wrote?
Edit: Oh, I think I get it. I removed comment from //#define USE_MANUAL_APERTURE 1 so now I can change focal distance or something by doing as you said. It will be very helpfull later but what I need is a grayscale image of the depth only (without blur applied), if possible.