[Fallout 3] Detailed Shadow Bug

fixing bugs
  • Author
  • Message
Offline
Posts: 10
Joined: 01 Nov 2013, 12:12

Re: [Fallout 3] Detailed Shadow Bug

ENBSeries wrote:Edit depth of field effect to output depth data only from it.
Thanks. I only have a very basic understanding of programming though so I don't understand much of enbeffectprepass.fx. If I understand it correctly, I want to output SamplerDepth only? Is there any docs or anything that can push me in the right direction?

Offline
User avatar
*blah-blah-blah maniac*
Posts: 17582
Joined: 27 Dec 2011, 08:53
Location: Rather not to say

Re: [Fallout 3] Detailed Shadow Bug

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: Select all

return _oC0;
insert this line

Code: Select all

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: Select all

res=tex2D(SamplerDepth, IN.txcoord.xy).x;
and some kind of linearisation and scaling code like this:

Code: Select all

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.
_________________
i9-9900k, 64Gb RAM, RTX 3060 12Gb, Win7

Offline
Posts: 10
Joined: 01 Nov 2013, 12:12

Re: [Fallout 3] Detailed Shadow Bug

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: Select all

return _oC0;
insert this line

Code: Select all

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: Select all

res=tex2D(SamplerDepth, IN.txcoord.xy).x;
and some kind of linearisation and scaling code like this:

Code: Select all

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:
Image
(random image from google)

I will try first with midhrastics preset, I found:

Code: Select all

return _oC0;
in enbeffect.fx and inserted the line.

The closest to the second code in enbeffectprepass.fx I found was:

Code: Select all

}

//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: Select all

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.

Offline
User avatar
*blah-blah-blah maniac*
Posts: 17582
Joined: 27 Dec 2011, 08:53
Location: Rather not to say

Re: [Fallout 3] Detailed Shadow Bug

You must use my enbeffectprepass.fx, not others dofs.

viewtopic.php?f=5&t=2528

Don't post here any more, it's not in topic.
_________________
i9-9900k, 64Gb RAM, RTX 3060 12Gb, Win7
Post Reply