Vector-ifying Collision from S1-S3K
THIS IS NOT A WALKTHROUGH. You will need prior experience with everything listed here for things to go smoothly. If someone wants to step-by-step-ify this, be my guest. Also, this process could probably apply to other games/stuff as well.
- Sonic 1/2/3K/whatever disassembly
- Experience with all of the above things
- Lots of time
- Open level of choice with SonLVL.
- Replace any loops or other special tiles with flat ones of the same height as the base of the loop. (If you forget to do this, you can edit it out of the image, but it'll be more annoying.)
- Enable the display of collision. (View -> Collision -> Path #)
- Disable the display of level art. (View -> Layers -> Low/High)
- Export level map collision as an image. (Export -> Foreground)
- Open this image in your multi-layer image editor of choice. (I use GIMP.)
- If using an engine without LRB support, replace all yellow with black. (Make sure to use the same shade black that's already in the image.) The rest of the tutorial will assume you did this.
- Tune as much of the collision now as you can. It will be much harder to change things once we vectorize. This includes integrating walls that were originally objects, simplifying complex collision (Remember, this will be a 3D model! We want to keep verticies down.) and just general cleaning. Make sure to stay faithful to the original design, however. Don't pixel-peep; we'll smooth things out in the next step. Also remember that we'll only be keeping the tops of the top-solid (white) collision, so don't bother screwing with the bottoms of those.
- Replace the background color with transparency.
- Separate the top-solid (white) and all-solid (black) collisions into different layers.
- Bring the brightness of the top-solid collision down until it's near-black.
- Export those layers to lossless images. (PNG, BMP, etc.)
- Open up Inkscape.
- Import the images you exported. (Set Image Rendering Mode to Blocky.)
- You may also want to import a visual map of the image to use as reference.
- Set the X and Y positions of each image to 0.
- Open up document properties, resize page to images, and save your eyes (checkerboard background or background color).
- Seperate the two images into two layers.
- Trace Bitmap each of the images, with the following settings:
- Brightness cutoff
- Smooth corners (1.00)
Edit the top solid path and remove the bottom nodes of all platforms. You want to delete them with break cuts, so select all nodes below the top path (but INCLUDE the top corners) and click the "delete segment" button. You'll also want to set the drawing style to stroke instead of fill to see your changes better.
Manually optimize all the collision. Have fun. Look out for small, sharp curls and other oddities.
Remove any images that may remain in your drawing.
Save your collision to an SVG. (Hopefully you were also doing that while you were working...)
Open up Blender, delete the cube, and import your SVG.
Set the X and Y scales of your paths to 14.76365843456008 * (the width or height of a tile in ingame units for whatever engine you're using). This should make each tile equal to the size of a tile in your engine with meters as the unit. For me, a tile is 8 units tall and wide in my engine, so my scale would be 14.76365843456008 * 8 = 118.1092674764806.
Extrude both paths by 1m.
Convert both paths to meshes.
Export everything to an FBX, with the following settings.
- Only choose to export Mesh
- No add leaf bones
- No baked animations
Import your FBX into your game engine of choice. Adjust scale as necessary. Assign colliders and layers. Hope you didn't fuck anything up.
Now, wasn't that fun!