Please use english language
It is currently 26 Feb 2020, 10:34

All times are UTC





Post new topic Reply to topic  [ 14 posts ]  Go to page Previous  1, 2
Author Message
PostPosted: 04 Nov 2013, 21:47 
Offline

Joined: 01 Nov 2013, 12:12
Posts: 10
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?


Top
 Profile  
 
Tomoko
PostPosted: 04 Nov 2013, 23:00 
Offline
*blah-blah-blah maniac*
User avatar

Joined: 27 Dec 2011, 08:53
Posts: 14816
Location: Russia
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.

_________________
i5-4690k, 16Gb RAM, GTX 1060 6Gb, X-Fi Titanium, Win7 x128
I am INFP, not the brutal, godamnit.


Top
 Profile  
 
PostPosted: 05 Nov 2013, 01:32 
Offline

Joined: 01 Nov 2013, 12:12
Posts: 10
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:
Image
(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.


Top
 Profile  
 
PostPosted: 05 Nov 2013, 09:28 
Offline
*blah-blah-blah maniac*
User avatar

Joined: 27 Dec 2011, 08:53
Posts: 14816
Location: Russia
You must use my enbeffectprepass.fx, not others dofs.

http://enbseries.enbdev.com/forum/viewtopic.php?f=5&t=2528

Don't post here any more, it's not in topic.

_________________
i5-4690k, 16Gb RAM, GTX 1060 6Gb, X-Fi Titanium, Win7 x128
I am INFP, not the brutal, godamnit.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 14 posts ]  Go to page Previous  1, 2

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group