Introduction to Poseidon
What is Poseidon?
Creating dynamic spaces in games can be tricky. When our team first started working on games, we kept running into the age-old problem: How do I connect this area to this other area? We’d created a nice mesh for an area in our 3D Modeler, but we hadn’t punched holes in it. Sigh… back to the modeler we go.
If we wanted to be more modular, reusing that area in different ways, we’d constantly run into the issue of having to make “possible” holes. Who knew how we’d want to reuse that space later, and where we’d need to connect a tunnel or something elsethat we hadn’t even anticipated yet. Our 3D models grew increasingly more and more complicated with lots of holes/walls that we could toggle on and off depending on our needs… and those holes were baked into our models and could never change.
That’s how Poseidon started – we wanted to be able to iterate and create dynamic levels for our own purposes. We wanted to create 3D environments in our modeler of choice, and not worry about HOW those areas could be used when brought into Unity. We’ve gone through many, many iterations of level design tools over the last 5 years, and Poseidon is the simplest, cleanest, and most elegant solution we’ve been able to find.
Poseidon is useful if you want to be able to connect 3D spaces to each other dynamically, allowing you to create the meshes you want, and not have to anticipate every possible way they could ever be used by a level designer. Poseidon allows a level designer to make subtle tweaks to levels without having to send a mesh back to an artist. Poseidon allows you to create modular levels with very few pieces but without everything feeling repetitive. Poseidon allows you to create unique geometry. Poseidon does not force you to use it for everything, unlike other level design tools. You can delete it when you’re done if you don’t want it anymore.
Why is it called Poseidon? We have no idea. It was a code name that stuck. We toyed with other names like Intersect CSG or Welder but we ended up sticking with Poseidon.
How does it work?
At its core, Poseidon is a geometry intersection tool that allows you to take two meshes in Unity, intersect them together, and then, magic happens. It works something like this:
- We detect that something has changed in the scene (A carver was moved, rotated, scaled, enabled/disabled, had its mesh changed outside of Unity, etc.)
- We analyze all of the Poseidons in the current scene to figure out which ones need to be updated, and how they need to update.
- We rerun our algorithm across each dirty Poseidon and its sisters (the ones it’s intersecting).
- We slice the meshes by each other.
- We take any polygons from one mesh that are inside of the other and discard them.
- We bake out a final output mesh and store it in a scene-copy.
- We repeat the operation until all affected Poseidons have successfully carved each other.
Clearly, it’s a lot more complicated than that, but that is the general overview. This approach is the result of many years of iteration and slow improvement until we’ve created something that is both performant and clean (in most circumstances).
Technical Requirements
- Unity 2019.x or newer (2018.x branches work, but have a few slight issues).
- Runtime Version: .NET 4.x or .NET Standard 2.0 (Preferred)
- Any Scriptable Render Pipeline (Built-in, Universal/LWRP, HDRP)
Because our code is packaged in DLLs, we requre at least the .NET 4.x framework, and do not really support anything before Unity 2018.3. Technically, Poseidon may work even on older builds (2017.4 and later), but a lot of the UI code and inspector stuff may be problematic and may need to be removed. If you’re trying to get Poseidon working on an older build of Unity, please contact us and we’ll see if we can get you specially built DLLs that work on older builds of Unity.
Also - the Examples/Demo Scenes were built on Unity 2019.2, and as a result, do not work on any of the 2018.x branches of Unity. Unity apparently changed how the Prefab variants work and our prefabs built in 2019.2 won’t work on older builds, even though Poseidon itself should. If you are targeting a 2018 build of Unity, you can check out the examples in a separate 2019.2 project just to see how the examples come together. Sorry about that… but it’s Unity’s fault.
What is CSG?
Constructive Solid Geometry is a way of combining simple mesh together in order to make more complicated ones. In the world of game level design, it used to be the way people made levels… way back when. You assume the world is completely filled in, and you add empty space by defining the few places in the world that aren’t filled in.
That’s sort of how Poseidon works. The difference is that we don’t assume the world is filled in, but, when a character is walking around inside of an indoor area - you have no idea what’s behind the walls.
Poseidon is our kinda-CSG - where we attempt to recapture the old-school way of making levels (defining all of the negative space), but allowing people to work with Unity the way they’re already used to Unity. This hybrid aproach is what we think is the most fun way of making levels.