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

share shaders here
Post Reply
  • Author
  • Message
Offline
User avatar
Posts: 79
Joined: 12 Jan 2012, 11:09

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

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.
Attachments
enbeffect.fx
(22.58 KiB) Downloaded 5302 times
Last edited by gp65cj04 on 31 Dec 2012, 17:49, edited 9 times in total.

Offline
User avatar
Posts: 21
Joined: 13 Jan 2012, 10:35
Location: FCS

Re: GTA4 Depth of Field and Motion Blur Fixed

gp65cj04, you are the best with ENBSeries :)

Offline
Posts: 8
Joined: 06 Apr 2012, 21:43

Re: GTA4 Depth of Field and Motion Blur Fixed

Hey thanks a lot for this but this is what I see ingame

Image

Offline
User avatar
Posts: 79
Joined: 12 Jan 2012, 11:09

Re: GTA4 Depth of Field and Motion Blur Fixed

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.

Offline
Posts: 8
Joined: 06 Apr 2012, 21:43

Re: GTA4 Depth of Field and Motion Blur Fixed

Ok thanks a lot

Offline
User avatar
*master*
Posts: 119
Joined: 05 Jan 2012, 22:34
Location: France

Re: GTA4 Depth of Field and Motion Blur Fixed

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

Offline
User avatar
Posts: 79
Joined: 12 Jan 2012, 11:09

Re: GTA4 Depth of Field and Motion Blur Fixed

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);


Offline
User avatar
*master*
Posts: 119
Joined: 05 Jan 2012, 22:34
Location: France

Re: GTA4 Depth of Field and Motion Blur Fixed

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;
};

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

Re: GTA4 Depth of Field and Motion Blur Fixed

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

Offline
User avatar
*master*
Posts: 119
Joined: 05 Jan 2012, 22:34
Location: France

Re: GTA4 Depth of Field and Motion Blur Fixed

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.
Post Reply