r/Unity3D
•
u/madhumster
•
Sep 01 '26
•
1
Show-Off Sphere cannot be build from hexes, but game dev is magic
For our roguelite Tile Crawl, we wanted our meta progression to stand out, so we designed it as a planet to explore. But our run map was already designed using hexes, so for consistency's sake, we wanted a globe out of hexes as well. We did not want to have pentagons but rather somehow achieve full coverage by equal hexes (even though it is geometrically impossible).
So how it works:
This is actually a plane with objects placed on it. Then, using camera position, vertices are recalculated in a shader (all objects must share the same bending subgraph or shader code with the same values to look consistent). This technique is used in Animal Crossing, as far as I am aware, but just not tuned as heavily.
Okay, so this gives us a bent plane that looks like a sphere. Next challenge is actually allowing it to rotate properly; rotation is achieved by just moving the plane in the X and Y axes while the camera stays static. To achieve looping of the planes I am spawning 8 more planes with copies of the objects and then teleporting them as I am crossing the edges (this part for sure can be done way, way better with some vertex magic or just fewer clones).
Next challenge is that shadows are broken as vertices are recalculated but normals are not; to calculate a new normal, we need to get two neighbours of the vertex, then bend them with the same logic and use the results to calculate the new normal. This allows us even to have proper shadowing from clouds above.
Last thing to do is clicking the nodes on the map. As objects are actually in very different spots from visuals, just raycasting from the mouse won't work. So I'm using one big sphere collider to detect the mouse position on the sphere, then recalculate it backwards to where it would be on the plane and find the closest node in radius.
There are still some things left to do (VFX support is quite bad, and there are some artifacts with water waves on the edges of planes). But in my opinion, already looks quite good and stands out.
Thank you for reading! If you like what you saw, consider wishlisting Tile Crawl on Steam!
262
u/SeregioFromTheSwamp Sep 01 '26
I really like your planet design! Hex-maps are my favorite.
54
u/NIKDEGame Sep 01 '26
You definitely accomplished the task - your meta looks unusual and appealing
5
u/Kenithal Sep 01 '26 edited Sep 01 '26
Hmm I have to watch it again but I think it was a dev vlog about some minecraft style hexagon world. Where you can make a sphere out of hexagons but you need to have like some # of polygons (12 in memory) on the sphere that are actually 5* sided.
This is also a really cool approach and maybe even cooler especially on a smaller sphere (big nodes)
11
u/DaveAstator2020 Sep 01 '26
So how does it behave after numerous rotations? You can fake it only so long untill you have to get a pentagon somewhere, no?
50
u/Potato_Batteries Sep 01 '26
Feels good knowing that people are still pushing boundaries and aren't afraid to step outside their comfort zone to achieve something beautiful. Kudos to you my friend <3
48
u/VolcanicA333 Indie Sep 01 '26
That shader is a work of art. If you look closely, I think it's possible to see some geometric distortions characteristic for a plane spherization, but if you hadn't told I'd never notice. Great job, and juice is also really nice!
3
u/weewoomeemoohee Sep 01 '26
meanwhile, i still cant understand how a state machine works after watching 10+ videos.
man, im not built for this.
14
u/AnxiousIntender Sep 01 '26
Congratulations, you made a torus! Actually I don't mind this kinda map design, old games did it and I never noticed as a kid. Looks awesome!
13
u/Bizsel Sep 01 '26
So this doesn't actually behave like a sphere, right? Since a looped plane should topologically represent a donut rather than a sphere.
4
u/uItimatech Sep 02 '26
The art looked good, sad that you used generative AI so much, instant buy otherwise
4
u/Away_Beginning_5446 Sep 02 '26
Ai slop
3
u/Oil_Aggressive Sep 01 '26
Praise Be the Icosahedron
3
u/Repulsive_Gate8657 Sep 01 '26
So is it like a spherical lense what you move over flat looped 2d map?
2
u/tatsujb Sep 01 '26
wow! what a solution! well done!
2
u/LKHGames Sep 01 '26
Yo this is very cooooool
2
u/Hotrian Expert Moderator Sep 01 '26
Looks amazing, and thanks for the detailed explanation :)
2
u/Due_Abbreviations205 Sep 01 '26
Looks really cool 🫡
2
u/SanoKei Sep 01 '26
of that's fucking neat :o
2
u/LimitlessRetardation Sep 01 '26
This is so beautiful.
2
u/XZPUMAZX Sep 01 '26
Thanks for the write up. This looks really good.
2
u/BucketCatGames ??? Sep 01 '26
"all of these hexes make a sphere, all of these hexes make a sphere" - mr popo, probably
2
u/Tychonoir Sep 01 '26
Very cool!
A while back I was looking for how to tile a seamless hex grid into a square texture (older mobile requirements wanted square textures for efficiency.)
The problem is that the minimum tileable area isn't a square, and the number of these needed to exactly converge into a square ratio is prohibitively large.
I ended up building a tool to determine how many tiles are needed vs. what amount of distortion is acceptable to make it fit.
For example, an arrangement of 4x7 tiles will fit into a square area with a slight distortion of 1.053% This is basically imperceptible and acceptable for my use case. But the tool also shows other solutions depending on how much distortion you want to allow. If that's still too many tiles for a given texture, 3x5 works with a distortion of 3.776%
Anyway, it works with any ratio, so it's not limited to hexes.
2
u/meutzitzu Sep 02 '26
It's a spherical shape but has euclidean topology
That shape cannot exist in real life. When you move the view you are performing a translation. It's just rendered to look like a rotation. But a full turn of the sphere doesnt get You back to where you started.
1
u/rimnas12 Sep 01 '26
I rarely play such games, but this is so satisfying and beautifully made it makes me want to unlock everything 😂 well done!
1
u/_OVERHATE_ Sep 01 '26
Modern Tetrisphere
1
u/XxDrFlashbangxX Sep 01 '26
Wow this looks awesome
1
u/blu3bird Sep 01 '26
Naise.
1
u/tutmoBuffet Sep 01 '26
This is so neat! Thanks for sharing your method behind the illusion, very clever.
1
u/I_HAVE_THAT_FETISH Sep 01 '26
You can definitely see some warping when the "sphere" moves quickly, but I think it actually adds to the atmosphere.
Most players likely won't notice, and I can't imagine those who do will complain as it looks very cool.
1
u/Apprehensive_Lake698 Sep 01 '26
I think with prior knowledge there are ways to nitpick, but if the user has no idea about hexagon tiling and doesn’t have any reason to suspect it, this is a 100% convincing solution. Very creative!
1
u/Enchrypted Sep 01 '26
I for one never thought about the fact that hexagons couldn't make a sphere but it looks neat!
1
u/Malkalypse Sep 01 '26
Fantastic effect! There are probably a couple other ways to achieve it but I don’t know that they would get better results, and what you have 100% works, so keep it!
1
u/pyabo Sep 01 '26
Mathematicians hate this one trick!
Looks great! The whole aesthetic with the art and palette. Just very smooth and great presentation there. Now quit violating the laws of spacetime.
1
u/mllhild Sep 01 '26
Seem like a lot of work to hide the fact that its not a sphere. Given that the pentagons dont have to be always in the same position, just having them as special tiles would have been fine as well. A player would have never questioned it.
1
u/annias Sep 01 '26
Did something similar (not in unity) on a multi planet 4x type game that is released but also very much still in development @ https://www.spawn.co/@annias/orbitalis/play
1
u/kaiiboraka Sep 01 '26
The visual design reminds me much of the board game Runebound. Very snazzy!
1
u/potatoman445 Sep 01 '26
is it a flat plane projected to a sphere?
1
u/ImprovementBig3354 Sep 01 '26
Dude, that is fucking beautiful. Amazing stuff :)
1
u/Comfortable_Rip5222 Hobbyist Sep 01 '26
I made something similar, maybe can help, I made using curved world
https://youtu.be/jHQDsnhS-Y4?is=eWaaRJP_-ICySKh6
1
u/HoveringGoat Sep 01 '26
where are you hiding the pentagons?
edit: nvm this is very clever shader magic. So presumably there should be stretching/artifacts but you can keep them off screen? Hows it look if the map fully tiles a planet?
1
u/Gold-Target-5462 Sep 02 '26
This reminds me a bit of how tetrisphere for N64 works. You can't map squares onto a sphere, so it's really a torus with the camera tweaked to look like a sphere. The problem is of course that if you rotate about the sphere and track the position of squares everything is wrong
1
u/Quick_Trick3405 Sep 02 '26
Uh, .... Cool.
1
u/GreggoryAddison Sep 02 '26
My god this is beautiful
1
u/MusicOfTheApes Sep 02 '26
Wow excellent design and creative !
I noticed you don't have any bgm in this video, if by any chance you're looking for a composer I'd be very interested !
Congrats anyway, can't wait to see how it's gonna turn out
1
u/qK0FT3 Sep 02 '26
I feel like this is some kind of grid mapping on a flat plane but with lense effect + repeat? I have done something very similar with fake earth on a website 10 years ago. Not sure how you do it tho.
Edit: i read the post fully after this and it seems like it is pretty similar lol.
1
u/salazka Professional Sep 02 '26
1
u/anthropogen0_0 Sep 02 '26
That's cool for a strategy game.
1
u/mannapi Sep 02 '26
Very cool!
EDIT: Wishlisted!
1
u/megablue Sep 02 '26
IIRC, dyson sphere project also faced a similar problem during their early development.
1
u/DoctorMog Sep 02 '26
Flat wraparound/repeating tiled surface with a fisheye lens effect?
1
u/Fla5hxB4nged Sep 02 '26
This has such a gripping style to it. Reminds me of things like magnum opus and against the storm where just booting up the game brings you into the artistic theme of it all. Great job on making it look so seamless and polished.
1
u/selkus_sohailus Sep 02 '26
I was trying to do exactly this some time ago. This is a really good solution but I don’t know if the other hurdles have workarounds. The 9 grid of cloned maps was also an idea I played with but never implemented. I gave up way sooner and just nixed the hexagons altogether, though bc the juice wasn’t worth the squeeze for my application, but it seems great here
1
u/rhys510 Sep 02 '26
Very cool!
1
u/KSaboruf Sep 02 '26 edited Sep 02 '26
Looks cool! And interesting workaround with custom warping, wishlisted!
1
u/Sweet_Culture_8034 Sep 02 '26
Isn't it possible to simply exploit the ocean to adress the issu ? Like, make it so there are not tiles where you can't put an hexagon and call it a day ?
I'm not aware of the underlying maths so I'm not sure.
1
u/SpareNickel Sep 03 '26
So freaking clever. It's like game designers are magicians. Even when we understand how the trick works, it still amazes every time without fail. Kudos on your awesome work!
1
u/nekoeuge Sep 03 '26
Populous The Beginning does similar trick, but even more cursed.
This is 3D strategy game, each game is played on the "globe" map. That is, the game pretends that each map is a a normal globe planet.
Underneath, it's just a fucking RECTANGLE stitched by opposite sides. It's is a fucking TORUS that is rendered like a sphere with a few gamedesign and technical tricks.
1
u/Ok-Host953 Sep 03 '26
Cuz it is not a sphere. Just a distorted plane. Illusion of a ball
1
u/xepherys Sep 03 '26
So uhhh... that's cool as hell!
1
u/dmchmk Sep 04 '26
It's so beautiful!
1
u/GoldshireDancer Sep 06 '26
Some next level juice on display here
1
u/Shoddy_Caterpillar36 PinePie | Asset Store Publisher Sep 07 '26
awesome
1
u/Fax3D Sep 07 '26
Very cool effect!
1
u/After-Pomegranate793 Sep 17 '26
👌
1
u/thebuddybud Sep 24 '26
Hell yeah
1
u/CharCharTup Oct 03 '26
hat's really cool, I think it's fantastic. Would you be up for making a video tutorial showing how it's done? I learn better by watching :D
P.S. It looked a bit odd when the hexagon got close to the edge; it really reminded me of how normal maps work. It would be amazing if you could add some volume to it to get rid of that weird look, but then again, I'm a perfectionist; it's already really good as is, heh.
1
u/Jacmac_ Sep 01 '26
A sphere can be made from hexes, in fact most GIS companies use Isosahedrons. There are 12 pentagons in the sphere, but if you subdivide the triangles with enough iterations the pentagons become so small that they are not much more than tiny artifacts.
0
u/LemonUnit1 Sep 01 '26
Wow, looks beautiful!
-2
u/swagamaleous Sep 01 '26
Spheres actually can be built from hexes. You just need to add 12 pentagons. You can make a huge sphere with 99% hexagons, and just evenly space out the 12 pentagons. That's how a soccerball does it as well.
0
u/Fr1k Sep 01 '26
And you’re a wizard! 🧙♂️