Project

General

Profile

Actions

Emulator Issues #2589

closed

Wrong fog emulation in Re4

Added by Line524 over 14 years ago.

Status:
Fixed
Priority:
Normal
Assignee:
-
Category:
GFX
% Done:

0%

Operating system:
N/A
Issue type:
Bug
Milestone:
Regression:
No
Relates to usability:
No
Relates to performance:
No
Easy:
No
Relates to maintainability:
No
Regression start:
Fixed in:

Description

What steps will reproduce the problem?
1.Launch Re4 with any latest rev's
2.Ingame you will notice fog problem

What is the expected output? What do you see instead?
Expected fog is just like before rev.4714
Check my screenshot please and you will see, link below
http://rapidshare.com/files/377253122/Re4.jpg.html

What version of the product are you using? On what operating system?
Any latest version and any hardware & software

Please provide any additional information below.
My advice is to create dropdown list in GFX plugin with two options: 1) NEW
FOG 2)OLD FOG
Without correct fog emulation this brilliant game lost graphic atmosphere,
fog beauty :(

Actions #1

Updated by Anonymous over 14 years ago

rapidshare for a image? are you kidding??

Actions #2

Updated by Anonymous over 14 years ago

  • Status changed from New to Questionable

http://i42.tinypic.com/2e3pr0z.jpg
scaled down a bit, but it gets the point across.
I think this has already been gone over a lot...even though you might think the fog looks better (in RE4, at least),
it was corrected.
But at least we can see what other people say..

Actions #3

Updated by Line524 over 14 years ago

Hi again :)
Please check this thread about fog emulation:

http://forums.ngemu.com/dolphin-discussion/130629-resident-evil-4-issues-list.html

Many people really waiting for this fix... Help us please... It will be brilliant if
we could choose between old and new fog modes :) Besides, many games might benefit,
not just this one.
And thank you guys for all your work and creation !!! You are heroes for us !=)

Actions #4

Updated by Line524 over 14 years ago

DEV's...... please ?

Actions #5

Updated by eliotfur over 14 years ago

I'm not a dev, I'm new here, but Linear has found me and asked to do this hack for the
damn fog...
I've added an option "FogHack1 = True" to enable it...

Here's the patch for the r5445

Actions #6

Updated by vadimurputi over 14 years ago

Looking at the comparison at comment 2.

The fog effects is only ~50%, or in fact, it still look like the incorrect version.

I tested using r5777 on a AMD PII 720BE x3 @3.3Ghz; GTX260; Win7 x64.

Actions #7

Updated by gnick79 about 14 years ago

Actually (I'm trying r6314) Fog in Dolphin for RE4 is absolutely wrong. This is the fact and I don't think it's questionable. Before was better!
If you watch original RE4's fog, it's much more intensive in order to compensate annoying texture pop-up effects due to the large DOF (deep of field).
In short... it's a stratagem, a trick used by Capcom for hiding too far details.
For this reason, this fog intensity is absolutely deferred.

Actions #8

Updated by wespipes69 about 14 years ago

Does this patch in comment 5 work? Was it ever officially committed?

If ZTP gets a hack then so should this awesome game! :P At least until fog is fixed properly, which from the looks of the dates in this issue, could be a while.

Actions #9

Updated by BhaaL about 14 years ago

The line inside the if should read "a = bpmem...", not "float a = bpmem..."; the latter might cause unintended behaviour by shadowing the previous variable, or not compile at all depending on settings.

One might want to review r4714 (and Issue 1654) where this line was introduced the way it was now.
Two points of interrest:

  • r4713 should have correct fog (if RE4 runs on that rev).
  • NSMB (and possibly others) will be broken when enabling the hack.

Leaving as questionable tho, since shuffle also has a point (one I can't confirm or amend, since I don't have RE4).

Actions #10

Updated by wespipes69 about 14 years ago

Attached a photo of before and after the change in r4714. The former looks correct to me.

I would vote, yes I know, another per game option to toggle for this (since it will break things) or maybe at least something that could be added to the game's ini that the emu could read. Keep in mind this has been "broken" for 1300 revisions and I think we should give RE4 players the ability to play it correctly again, especially given the hi-res packs being created for it on the forums.

With another option, you can add to the "Game Fixes" section as outlined in Issue 3004.

Actions #11

Updated by gnick79 about 14 years ago

Uhmm fog emulation is problematic!!
What kind of fog GC/Wii have?? LOL
If developers adjust it over SMB, later they broken the exact intensity for RE4 and vice-versa.

Actions #12

Updated by BhaaL about 14 years ago

Can you try out r6319?

Actions #13

Updated by Line524 about 14 years ago

Too bad, r6319 doesn't fixed this !=(
C'mon guys - there is only one line in the code, which should be reverted to r4714 fog function... Change it please :'

Actions #14

Updated by gnick79 about 14 years ago

No changes in r6319.

Actions #15

Updated by gnick79 about 14 years ago

A simple and maybe stupid question!!
But the fog in original hardware, can be it customizable from developers?
In short... is fog one and only one (on or off) or not and variable?
This can explain beacuse in SMB can't be intensive like RE4 otherwise bg becomes invisible.

Actions #16

Updated by gnick79 about 14 years ago

I reply to myself.
I found this from official forum:

Besides - hack from EliotFur doesn't working (maybe for double variable declaration :P) . And I found the root of this problem:
real console hardware is capable of fog distance and range calculation, but Dolphin video plugins still don't know about fog distance calculation - they are using fixed distance and simple linear fog
and this causes that issue #2589...
I can give you additional info about the fog if you need

Evermore by Linear (username).

Actions #17

Updated by Line524 about 14 years ago

Yeas, it is me and EliotFur, who can give some info about fixing this fog problem. But looks like there is no one who want to help...

Actions #18

Updated by Line524 about 14 years ago

Currently, different fog calculation algoritms (which original console capable of) is not implemented in Dolphin emulator.

There is: unsigned proj : 1; // 0 - perspective, 1 - orthographic
unsigned fsel : 3; // 0 - off, 2 - linear, 4 - exp, 5 - exp2, 6 - backward exp, 7 - backward exp2
But they doesn't implemented yet... (except simple linear fog)

Besides - there is some notes in TODO list:
u32 fogRangeAdj; //0xE8
u32 unknown15[3]; //0xe9,0xea,0xeb - fog related
u32 tev_range_adj_c; //0xec - screenx center for range adjustment, range adjustment enable
u32 tev_range_adj_k; //0xed - specifies range adjustment function = sqrt(xx+kk)/k
FogParams fog; //0xEE,0xEF,0xF0,0xF1,0xF2

Right now Dolphin support only linear fog function and only fixed fog distance.
(another funny thing: if(bpmem.fog.c_proj_fsel.fsel != 2)
WARN_LOG(VIDEO, "Unknown Fog Type! %08x", bpmem.fog.c_proj_fsel.fsel); )

Many games (including RE4) using those unimplemented code variables and video plugins doesn't produce correct GFX effects. Looks like main problem is - fog distance correction function need to be created, and it'll operate with those variables.

Another note -
Currently we have: Point_of_view-0123456789A-far
But with "correct" formula: Point_of_view-000002468A-far this should be right !
and with motion: Point_of_view-02468AAAAA-far (more dense fog, far geometry almost invisible)

  • this is how fogRangeAdj should work.

If someone here can code correctly all this stuff - please fix this, it will improve Dolphin video subsystem a lot ! (and of course it'll fix all this fog and far plane geometry bugs)

(P.S. - THANKS EliotFur for analysis)

Actions #19

Updated by skidau almost 14 years ago

  • Category set to gfx
Actions #20

Updated by gnick79 almost 14 years ago

Ok ok
Eureka!
Problem resides in the adopted formulas, non conformable with original fog patent.
Fog is fixed really for all games except for titles that enable x range adjustment... yet due by missing implementation.

If you give me full SVN access, I commit personally this major change.

Actions #21

Updated by wespipes69 almost 14 years ago

Wow! Very nice! Thank you for this! Can't wait to see it in action!

Actions #22

Updated by hrydgard almost 14 years ago

Hi gnick79, you got SVN access. enjoy :)

Actions #23

Updated by gnick79 almost 14 years ago

TnX hydgard :)

Messiseurs!!! Let's check for r6463 or above.
Max 24hrs and we close this issue.

Actions #24

Updated by gnick79 almost 14 years ago

  • Status changed from Questionable to Fixed
Actions #25

Updated by Line524 almost 14 years ago

HOLY SHIT !!! Fog problem is gone !!!(O_O) It is FIXED !!!
Who did this actually ??! Who is this brilliant mind ?
I've waited for years to see perfect RE4 fog and now - I'am the HAPPIEST MAN IN THE WORLD !!!
Thank you !!! THANK YOU VERY MUCH, whoever you are !!!
And thanks all people who made Dolphin Project !!!

Actions

Also available in: Atom PDF