DarioSamo / sm64rt

Fork of https://github.com/sm64pc/sm64ex with raytracing support.
274 stars 13 forks source link

Billboards in Reflections & Shadows #21

Open ghost opened 3 years ago

ghost commented 3 years ago

This isn't exactly an issue specifically with sm64rt per se, but it made more noticeable by additions from RT64. The issue is that since billboards always face towards the main camera, the shadows of billboards can get rather odd, as well as billboards in reflections. This also can break alpha on the edges of them, if they're inverted upside down (reflection on the ground, easy to see with mario's dust particles or the edges of trees) A possible fix may be to make it so that from the perspective of the lightsource, or of the reflections' view, the billboard is always facing towards them, This should look good for most all of the spherical billboards, as they should look the same no matter what the angle is. This may not look so great for the trees, though. There's also a related issue with the sky, since it's a linear scrolling texture that always faces the player; if there's a reflection on the ground and you look down on it, the top of the sky is distorted into a single point.

DarioSamo commented 3 years ago

These are things that would be pretty sweet to fix.

The current problem is that the billboard behavior is not controlled by the renderer but rather by the game. As it is, the renderer has no way to identify if something is a billboard or if it's just a regular polygon mesh. So to fix that, we'd need to either hook into the billboard routines and set the identifier there or just tag the billboard textures manually.

For the sky, I think it would be best to just find a way to pull the entire texture that is used. Right now it's just doing a fake environment map by warping whatever tiles are being rendered to the background. I believe this would also need a separate hook in the game code like for the previous suggestion and to ignore the background rendering entirely.