Hello there! I’m currently learning shaders, and I got the basics settled, but now I’m thinking of doing something a but more complex.
In Super Castlevania 4, one of its well-known stages has a room spinning with an effect that made it look like it was a cylinder room. I’ve always been intrigued by this effect and I’ve been wanting to recreate it.
Here’s an example of it:
I was wondering on how this can be achieved using 2D shaders in Godot, and I’m slowly learning new things about it, so I would like some help here
Have you tried writing a shader where the pixels are stretched on the X axis depending on far away they are from the Y-center. This might give you a start: Squish Sprite - Godot Shaders
About the rotation, either move the sprite’s texture or load the whole big texture into the shader and only show part of it depending on the rotation.
probably the simplest solution would be to create a cylindrical mesh with opposite normals to the background, create a cylindrical UV and then use a shader to solve simple operations like UV X move and UV Y move in time…
and optionally parameterize the shift by looking at the camera in the X axis
IIRC in the SNES hardware that effect was achieved (effectively) by scaling individual scanlines for the tilemap output. The SNES hardware could do that. So, it’s just drawing a standard 2D tilemap, but stretching the scanlines based on how far they are from the center of the screen. The “rolling” effect is just a linear vertical scroll on the tilemap, with the scanline scaling making it look cylindrical.
2D hardware from this era usually had multiple independent graphics outputs that got composited into the output, so the scanline stretching on the tilemap didn’t affect the sprite output. The extreme example of this would be the SegaCD+32X, where both add-ons added new independent tilemap layers and sprite layers with different capabilities.
To be honest, it probably would be easier these days to do this with a textured 3D model, but if you want to replicate this (and other) effects in shaders, scanline scaling/offsetting is what you’re trying to emulate.
For extra verisimilitude, you might consider rendering the tilemap to a texture and then drawing that texture with your distortion shader…