phoboslab / wipeout-rewrite

2.64k stars 212 forks source link

Missing sound reverberation effects #76

Open boricj opened 1 year ago

boricj commented 1 year ago

There are sections of tracks which have reverberation on both music and sound on the original PlayStation release, but the effect isn't present in this rewrite.

Here's an example here, where the audio is noticeably cavernous in the area where the track has railings.

tjrileywisc commented 1 year ago

I think first we'd have to have some way to detect where it would be appropriate to turn on the reverb effects. Probably it would just be easiest to get the track sections corresponding to the start and end of a tunnel and hardcode them into the source, unless there's some other attribute in the track data for this.

phoboslab commented 1 year ago

As stated in the readme I believe the game originally just checked if there the current track section has more than 4 faces. A normal (open) section has one face for the left wall, two faces for the surface and another face for the right wall. This is trivial to check as we already have section->face_count.

The original game also has the reverb effect on the "ramp" section in Altima, even though it's not fully enclosed. So this face_count > 4 seems accurate. But I'm not sure if we'd have any "false positives" with this approach - i.e. if there any sections that have more than 4 faces and yet should not have a reverb effect. Any insights on this?

Sadly, this all seems to be completely missing from the leaked source, just as the cheering from the crowd stands (which I reconstructed).

tjrileywisc commented 1 year ago

I put a breakpoint while racing in ship_update and checked self->section->face_count > 4 and hit a couple of places where that criteria wouldn't work:

(maybe one could make a case that the wall on the right would cause reverb effects but that geometry isn't part of the track AFAIK) image image

But given that the face count is the base of the track, I'd expect you'd hit this in places where the track gets 'wobbly'/very curvy. Notably I didn't hit the breakpoint in the tunnel in Altima either.

tjrileywisc commented 1 year ago

There are objects in the scene data that seem to suggest having something to do with tunnels by the name, though I don't think there's a reliable way to tell that you're 'in' a tunnel that way.

phoboslab commented 1 year ago

I'm afraid you did that wrong™. ship_update() runs for all ships, not just the player.

Add this to hud_draw() in hud.c

ui_draw_number(ship->section->face_count, ui_scaled(vec2i(16, 120)), UI_SIZE_8, UI_COLOR_DEFAULT);

This draws the number of faces for your ship's current section on the hud. Results seem to be consistent with my initial assumption: 4 faces for normal track sections, 6 faces for the ramp, 7 faces for the tunnel. There still might be false positives on other tracks; I haven't checked.

tjrileywisc commented 1 year ago

Ah, I usually forget to check for the player ship - but this still misses areas a user would consider a tunnel, like the first tunnel on Altima (the second tunnel seems to be correct).

image

phoboslab commented 1 year ago

There's no reverb in the PSX original in this tunnel either. Only two places in Altima are the ramp section and the tunnel before the start/finish line.

The difference here is that the first rocky tunnel on the downward slope is scene geometry, while the other two are part of the track.