Open PiKeyAr opened 7 years ago
This will require figuring out how an entity knows that it's under water. It's very likely that the way characters are notified of their under water status will be the same for the camera. Much like characters, the camera is an entity with collision, and it uses the same entity structure (EntityData1
).
A good place to start would be to see what writes to the underwater timer for any character in particular. There will most likely be a condition check just before the write which can be investigated further. Following that lead upward in the code should lead to something common between characters and the camera.
Be nice to get the GC water effects too
yes THAT lol i always loved that and it's the only real improvement i cared about in DX
On the GameCube version, the ripple effect texture is there. It's this texture. https://s13.postimg.org/yn6r92ojb/salt_tev01_01.png
also known as “tex1_256x256_m_f94822877d9452de_14” on Dolphin…
When disabling the texture (by making texture completely black), the ripple effect turns off.
Note that this specific texture is not for the shaky screen nor ripple look during underwater. Never was a fan of the shakiness while underwater anyway, but I still approve the ripple look.
Tried replacing salt_tev01_01.png with it, and nothing. Hope someone out there can figure a way to add the two water effects above back into the game…if even possible. Ripple improves the look of water so much more, especially for the overly transparent water of DXStylesWater. Imagine this effect with Dreamcast water that was brought back into Emerald Coast just recently? Only one can dream. That'd look too good.
May have to dig into the code of the GC version to actually get the ripple to work unless some of it is left over in the PC version but that will be someone elses job since i dont know code i can only look around textures and test builds of mods
The distortion unfortunately won't just appear by adding the texture back in (as SADX PC actually has this and one additional texture still ingame). Implementing it again would be relatively simple though.
What we're looking at with that texture is a bump map (or a height map), where the brighter white the pixel is, the more extreme the bump is. The idea is to use this to offset texture coordinates before sampling pixels in the back buffer (what has already been rendered) which gives the appearance of distortion.
Here's a simple overview of the process of applying the distortion:
A normal map would be more effective in this case, but bump maps can be easily converted. Additionally, the depth buffer (z-buffer) can be (ab)used to reduce some artifacting that's present on the GameCube, such as the pseudo-reflection of Sonic visible when standing in front of the water. It would be as simple as verifying that the depth is greater than the surface of the water before applying the distortion.
@SonicFreak94 sounds like you got that figured out ^^ dont mind me but im feeling giddy atm the fact you guys are making sadx better so we can exp it the way it should is the stuff of dreams and to think soon that a dreamcast emulator will not be needed to exp the best version soon.
Figures why DX water looked clear as glass. Distortion implementation should be meant for the SADXStyleWater. That being said I still don’t get why most youtubers use DX water in a Dreamcast conversion mod by default. To each their own.
some think the water looks better in DX but it only really looked good with the bump mapping effect and I think the DC water would look better with it and if not still would be nice to have lol
I've been poking around and I found the function that determines whether the character is underwater: sub_49F1A0. All playable characters plus Tikal and Eggman call it, and disabling the function makes the character ignore water completely.
The function takes two arguments: EntityData1* and something that looks like (int)&EntityData2->field_1DC.
This may not be exactly what is needed for the camera, but I think starting from here may help.
Near the end of CameraDisplayB() there's a check that looks like this:
if ( p2.y < 0.0 || p2.y > 480.0 )
{
njPushMatrix(0);
njProjectScreen(0, &v13, &p2);
njPopMatrix(1u);
}
The if condition is triggered whenever the camera is underwater. I hooked this to recreate a Dreamcast-like overlay - ended up using the color 0x1E0008FF with an additive effect as that looked the closest to the original and it's probably how the game does it anyway.
Before:
After:
Shader shenanigans aside I think this is enough to add distortion effects for when the camera is underwater. The actual effect and what to do with stuff that gets distorted below the water surface I don't know, but I hope this is a start.
3 years later still no GameCube ripple effect oof
I started experimenting with refraction in sadx-d3d11. I have a job to worry about though, so unfortunately my time for these things is limited.
yea I saw some of it a few months back then you moved onto per object motion blur lol
This isn't necessarily lighting-related, but I thought it would fit the profile of this mod, and it can be implemented with a shader as well.
In SA1, when the camera is underwater, the whole screen except the HUD gets a slight blue tint.
Comparison: SA1
SADX PC
![SADX PC](https://cloud.githubusercontent.com/assets/23312549/21451424/66080782-c942-11e6-96df-f5358c50a7f2.png)
This effect was removed in SADX, possibly because the Gamecube TEV "shader" took its place. The PC version has neither the shader nor the tint effect.
The exact parameters of the effect are unknown, but a very similar look can be achieved by applying a Soft Light filter with the color of #3f5bd3 and alpha of 50%.
Sample, SA1 at the bottom![SA1 at the bottom](https://cloud.githubusercontent.com/assets/23312549/21451475/ae791704-c942-11e6-9b71-a441b1c145ce.jpg)