Skip to content

Instantly share code, notes, and snippets.

Last active Sep 4, 2019
What would you like to do?
Vector-ifying Collision from S1-S3K

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.


  • GIMP
  • Blender
  • Inkscape
  • SonLVL
  • Sonic 1/2/3K/whatever disassembly
  • Experience with all of the above things
  • Lots of time


  1. Open level of choice with SonLVL.
  2. 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.)
  3. Enable the display of collision. (View -> Collision -> Path #)
  4. Disable the display of level art. (View -> Layers -> Low/High)
  5. Export level map collision as an image. (Export -> Foreground)
  6. Open this image in your multi-layer image editor of choice. (I use GIMP.)
  7. 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.
  8. 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.
  9. Replace the background color with transparency.
  10. Separate the top-solid (white) and all-solid (black) collisions into different layers.
  11. Bring the brightness of the top-solid collision down until it's near-black.
  12. Export those layers to lossless images. (PNG, BMP, etc.)
  13. Open up Inkscape.
  14. 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.
  1. Set the X and Y positions of each image to 0.
  2. Open up document properties, resize page to images, and save your eyes (checkerboard background or background color).
  3. Seperate the two images into two layers.
  4. Trace Bitmap each of the images, with the following settings:
  • Smooth
  • Brightness cutoff
  • Smooth corners (1.00)
  1. 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.

  2. Manually optimize all the collision. Have fun. Look out for small, sharp curls and other oddities.

  3. Remove any images that may remain in your drawing.

  4. Save your collision to an SVG. (Hopefully you were also doing that while you were working...)

  5. Open up Blender, delete the cube, and import your SVG.

  6. 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.

  7. Extrude both paths by 1m.

  8. Convert both paths to meshes.

  9. Export everything to an FBX, with the following settings.

    • Only choose to export Mesh
    • No add leaf bones
    • No baked animations
  10. 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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment