Page 1 of 8

GTA4 Depth of Field and Motion Blur Fixed - final update v2

Posted: 21 Aug 2012, 07:04
by gp65cj04
1. Motion blur fixed which is not contained in default enb was from Boris.
2. Depth of field

Motion blur with 23 taps
Image
Image

Depth of field
Qulity 1
Image
Qulity 2
Image
Qulity 3
Image

------------------update 0821------------------
All of the Unknown 48 of timecyc.dat must be 0 or the DoF will be incorrect.

for instance :
Extrasunny Midday unknown 48 : 130.750 to 0.000
Sunny Midday unknown 48 : 1000.000 to 0.000
Cloudy 7pm unknown 48 : 555.000 to 0.000
....

------------------update------------------
Fixed DoF incorrect setting.
Image

------------------update 0822------------------
Motion blur optimization
Sample number depeneds on speed now.

All credits go to Boris. :D

------------------uptate 0909------------------

Image

------------------uptate 0910------------------
Fixed incorret bokeh shape
Image

Terrible artifact from focus to out of focus when the bokeh become more visible.
Image

This is the final update.

Re: GTA4 Depth of Field and Motion Blur Fixed

Posted: 21 Aug 2012, 11:55
by Electrik
gp65cj04, you are the best with ENBSeries :)

Re: GTA4 Depth of Field and Motion Blur Fixed

Posted: 21 Aug 2012, 12:53
by leec313
Hey thanks a lot for this but this is what I see ingame

Image

Re: GTA4 Depth of Field and Motion Blur Fixed

Posted: 21 Aug 2012, 13:24
by gp65cj04
leec313 wrote:Hey thanks a lot for this but this is what I see ingame

Image
Sorry, I forgot to say that all of the unkown48 of timecyc.dat must be 0 to get the correct depth or the dof will be incorrect like the screen you posted.

Re: GTA4 Depth of Field and Motion Blur Fixed

Posted: 21 Aug 2012, 13:36
by leec313
Ok thanks a lot

Re: GTA4 Depth of Field and Motion Blur Fixed

Posted: 21 Aug 2012, 14:50
by icelaglace
Ah great! You finally released that DOF ( I spotted it a while ago on your screens :P) Rendition of the ADOF?
Very well done my friend. Thank you.

About the motion blur; I don't recommend so much taps for MB; I used approx. this kind of amount on 2.0; I lost 5/10 fps but motion blur was smooth as hell like your pictures.
Did you change the code directly ?
Because if yes; I might be not necessary to have so much samples on a motion blur

Re: GTA4 Depth of Field and Motion Blur Fixed

Posted: 21 Aug 2012, 15:28
by gp65cj04
icelaglace wrote:Ah great! You finally released that DOF ( I spotted it a while ago on your screens :P) Rendition of the ADOF?
Very well done my friend. Thank you.

About the motion blur; I don't recommend so much taps for MB; I used approx. this kind of amount on 2.0; I lost 5/10 fps but motion blur was smooth as hell like your pictures.
Did you change the code directly ?
Because if yes; I might be not necessary to have so much samples on a motion blur
The dof is the same as the old one, I just changed it to calculate sample points directly without accessing memory for pre-store sample offsets.
Motion Blur is also changed a bit to fit more taps and deleted the unnecessary codes (vanilla dof).

:)

Code: Select all

//r4.zw=r3.xyxy * _c2.w; //8.0
r4.xy=r0.yz / (MotionBlurSamples + 1);
..
//r4.zw=r4.xy * (r5.x - 4.0) + _v0.xy; 
r4.zw=r4.xy * (r5.x - (MotionBlurSamples + 1.0)*0.5) + _v0.xy;

//r0.x=saturate(r0.y * r0.x);
r0.x=saturate(r0.y * r0.x * 0.15);


Re: GTA4 Depth of Field and Motion Blur Fixed

Posted: 21 Aug 2012, 15:32
by icelaglace
gp65cj04 wrote: The dof is the same as the old one, I just changed it to calculate sample points directly without accessing memory for pre-store sample offsets.
Motion Blur is also changed a bit to fit more taps and deleted the unnecessary codes (vanilla dof).

:)

Code: Select all

//r4.zw=r3.xyxy * _c2.w; //8.0
r4.xy=r0.yz / (MotionBlurSamples + 1);
..
//r4.zw=r4.xy * (r5.x - 4.0) + _v0.xy; 
r4.zw=r4.xy * (r5.x - (MotionBlurSamples + 1.0)*0.5) + _v0.xy;

//r0.x=saturate(r0.y * r0.x);
r0.x=saturate(r0.y * r0.x * 0.15);

Oh yes, I just figured this out. ADOF but cleaner! Excellent mate.
Didn't try the motion blur taps yet to compare the FPS boost.
Gotta remove my old DOF sh*t to yours now! :P Now gotta put the autofocus stuff on it for screenies; seems to work too. <3

Did you try motion blur with this? :

Code: Select all

sampler2D s5 = sampler_state
{
Texture   = <texs5>;
MinFilter = LINEAR;
MagFilter = LINEAR;
MipFilter = NONE;
AddressU  = Wrap;
AddressV  = Wrap;
SRGBTexture=FALSE;
MaxMipLevel=0;
MipMapLodBias=0;
};

Re: GTA4 Depth of Field and Motion Blur Fixed

Posted: 21 Aug 2012, 16:32
by ENBSeries
Why not to use dynamic flow for amount of samples? There are too much of them and most image area don't need so many samples.

Re: GTA4 Depth of Field and Motion Blur Fixed

Posted: 21 Aug 2012, 16:56
by icelaglace
ENBSeries wrote:Why not to use dynamic flow for amount of samples? There are too much of them and most image area don't need so many samples.
You mean this part :

Code: Select all

	
//motion blur
	for (int iii=0; iii<MotionBlurSamples; iii++)
	{
		r6.x=r4.x * r3.w + r4.z; //v2
		r6.y=r4.y * r3.w + r4.w; //v2
		r7=tex2D(s6, r6.xy);
		r5.w=r7.x - _c85.x;
		if (r5.w<-0.3)
		{
			r5.w=_c1.y; //1.0
		} else r5.w=_c1.w; //0.0
		r6=tex2D(s2, r6.xy);
		r5.xyz=r6.xyz * r5.w + r5.xyz;
		r2.w=r2.w + r5.w;
		r3.w=r3.w + _c1.y; //1.0
	}
Should be dynamic to avoid useless calculations?

Btw, Boris; I want to put TempF1.x on a value in the .fx of GTAIV ENB; not the effect.txt, does it work?
Because it should be way better to control the screenshots depth of field if we can change the fardepthblur depending of a key; like you do on a real camera; instead of auto-focus
Just wondered if it's supported.