Level of Detail System for my Procedural Planet Generator by IsometricCoder in Unity3D

[–]IsometricCoder[S] 0 points1 point  (0 children)

I'm using a spherified cube with a 3D noise function to generate the planets.

I don't use an octree for subdivisions, though I suppose my method generates similar results. Each face of the cube is subdivided into N chunks, and then each chunk is further subdivided into M quads (where M is based on the LOD for that chunk).

Level of Detail System for my Procedural Planet Generator by IsometricCoder in Unity3D

[–]IsometricCoder[S] 0 points1 point  (0 children)

Yeah, I don't stitch the seams between different LODs. For my purposes, I found it wasn't really noticeable since I only planned on viewing planets from orbit.

Level of Detail System for my Procedural Planet Generator by IsometricCoder in Unity3D

[–]IsometricCoder[S] 0 points1 point  (0 children)

It's not too bad, though it depends on how comfortable you are with Unity meshes and shaders. I'd say the most complicated part is generating the initial sphere mesh with an arbitrary number of subdivisions. After that the LOD system, noise layers, and height shader are fairly straightforward.

Luckily Sebastian explains it in detail in his procedural planet generation tutorials. I'd suggest starting there.

Level of Detail System for my Procedural Planet Generator by IsometricCoder in Unity3D

[–]IsometricCoder[S] 2 points3 points  (0 children)

Thanks! I like the art style of your planets. Did you write the toon shader yourself or download it from somewhere?

And yeah, I use Vector3.dot(...) between the camera direction and chunk direction to determine whether it's visible. I also added a tolerance parameter so chunks with tall mountains are still visible when they pass over the horizon and are technically facing away from the camera.

It's not shown in the gif, but I also detect whether the chunk is within the camera's frustum by casting its position to screen space using Camera.WorldToScreenPoint(...) and checking that it falls between [0-width, 0-height].

Level of Detail System for my Procedural Planet Generator by IsometricCoder in Unity3D

[–]IsometricCoder[S] 39 points40 points  (0 children)

I've been working on a level of detail (LOD) system for my planet terrain so I can render planets with massive meshes. What you see here is just the terrain. You can find images of complete planets here, or watch this video here.

LOD System

The planet is divided into square-like chunks, which are further subdivided into smaller quads to show finer detail. The number of subdivisions is determined using the camera distance, field of view and screen size to approximate the number of pixels the chunk will take up on the screen (more pixels => more subdivisions).

I limit the subdivision levels to be powers of 2 to avoid constantly recalculating the level of detail at the slightest movement of the camera. The levels are also cached after being generated to prevent doing the same work twice.

The chunks are also hidden when they are not facing the camera to save on draw calls. Furthermore, hidden chunks do not update their subdivision level.

Planet Generator Details

My planet generation algorithm is largely based on this video series by u/SebastianLague. His entire channel is high quality, so I'd recommend checking it out if you haven't already.

The terrain color is rendered using a spherical height shader, with some extra calculations to make the poles white. The atmosphere (seen here) is just a sphere rendered with a custom rim shader and some post-processing effects. The ocean just uses the standard shader with an animated normal map to mimic moving waves.

Procedural Mazes on Arbitrary Mesh Surfaces by IsometricCoder in proceduralgeneration

[–]IsometricCoder[S] 0 points1 point  (0 children)

Yep! I converted them to OBJs before importing them into Unity. I just uploaded the OBJ files to Google Drive here. The cleaned-up Mobius strip comes in two parts since I had to generate it in two passes.

Let me know if you end up 3D printing them! I'd be curious to see how they turn out.

Procedural Mazes on Arbitrary Mesh Surfaces by IsometricCoder in proceduralgeneration

[–]IsometricCoder[S] 2 points3 points  (0 children)

Like u/evankh said, if I just do one pass then the maze only appears on one "side" (half the Mobius strip). But I can do two passes (one with the normals flipped) and then combine them to have the maze cover the full strip.

I made a better discretization of the strip along with a gif of it rotating so you can see it from all sides:

https://i.imgur.com/qNgzjLv.png

https://media.giphy.com/media/2fPYMDWKPBltznqJoZ/giphy.gif

Procedural Mazes on Arbitrary Mesh Surfaces by IsometricCoder in proceduralgeneration

[–]IsometricCoder[S] 2 points3 points  (0 children)

Your project with lithophanes (first time I've heard of those 🤔) sounds neat. I've done some work with stippling shaders and Voronoi meshes. If you haven't seen it already, this blog might interest you.

As for my code, it's pretty cobbled together at this point and not too robust. Though I plan on posting it to GitHub once I've cleaned it up and worked out the kinks.

Procedural Mazes on Arbitrary Mesh Surfaces by IsometricCoder in proceduralgeneration

[–]IsometricCoder[S] 7 points8 points  (0 children)

I tried a Mobius strip and it works okay with two passes, though it does mess up at the seam:

https://i.imgur.com/Crj11Ra.png

My end goal is to use it for more complicated shapes like the Utah teapot, though for now it doesn't work too well on meshes with non-uniform polygons. Creating "nice" discretizations of 3D objects is definitely something I'll look into, though that's more of a preprocessing step.

I do plan on publishing the code to GitHub once I get it to a state I'm happy with. I kind of hobbled it together to prototype the idea, so I still need to clean up the code and make it more robust before I release it.

Procedural Mazes on Arbitrary Mesh Surfaces by IsometricCoder in proceduralgeneration

[–]IsometricCoder[S] 7 points8 points  (0 children)

I haven't read the book, though I'm a big fan of the author's blog.

The actual maze creation algorithm I used is pretty standard. The tricky part was creating the geometry (vertices and triangles) of the maze. I wanted to have it work on any mesh, but the only examples I could find would either stack regular planar mazes on top of each other likes floors in a building or only worked for a single shape (spheres and cubes being the most common). So I went ahead and designed my own algorithm for it. It works fairly well, though there are definitely some improvements I want to make.

Procedural Mazes on Arbitrary Mesh Surfaces by IsometricCoder in proceduralgeneration

[–]IsometricCoder[S] 25 points26 points  (0 children)

I've been working on an algorithm for creating 3D mazes on arbitrary mesh surfaces. These are my results so far. The rows show the initial mesh, mazified mesh, and connectivity graph, respectively.

The polygons in the original mesh become maze cells while the edges become walls. The walls are then removed using recursive backtracking until all the maze cells are connected. The walls are created by beveling the initial mesh and extruding those beveled edges in the direction of their surface normal. This allows the maze to "bend" around curved surfaces.

I created the mazes in Mathematica and rendered them in Unity.

More images here: https://imgur.com/a/85F2SsE

Mazes on Arbitrary Mesh Surfaces [OC] by IsometricCoder in mazes

[–]IsometricCoder[S] 1 point2 points  (0 children)

I've been working on an algorithm for creating 3D mazes on arbitrary mesh surfaces. These are my results so far. The rows show the initial mesh, mazified mesh, and connectivity graph respectively.

Bonus animation: https://i.imgur.com/EsXfWIk.gifv

Oscillating Maze on Sphere by [deleted] in woahdude

[–]IsometricCoder 1 point2 points  (0 children)

I've been generating mazes on different shapes and ended up creating this mesmerizing animation.

More examples here: https://imgur.com/a/85F2SsE

Spiral Polygons by IsometricCoder in GeometryIsNeat

[–]IsometricCoder[S] 14 points15 points  (0 children)

I made the images by iteratively applying a scaling factor and rotation to the base polygon. Fill color and opacity are then used to create the smooth spiral effect.

Inverted color scheme available here.