This post is a part of the series on the development of Library of Blabber, an infinite library of procedurally generated books. In the previous post, I've talked about the background, the ideas and the initial outline of the project. It was time to move on to blocking out, and writing some code.
Note: The art in the pics/gifs on this page is the final one. This is simply because I am taking screenshots 'post-mortem', and I don't have any from the actual time of development. So, if you want to imagine how blocking out actually looked during development, just think of a lot of white Unity boxes.
The purple circle on the left is the player from top view. As you can see, when the player crosses the center of the chamber, their position gets 'wrapped', teleported to the chamber on the opposite end. The illusion of infinity is maintained because the rooms are identical.
It was important to see what chambers on the sides can be actually seen from the player's perspective, so we can cut the others, since we can't render infinite chambers.
There were a few angles where background chambers on the sides would be seen 'popping' into existence when the player shifts:
And therefore this sort of 'diamond' arrangement of 16 book chambers made sure no weird appearances would happen:
Initially, I placed a bunch of chamber meshes along the forward axis, but soon I realized that actually you need a LOT of these corridor pieces to see the infinity seamlessly. Since the player will always see them all when looking towards an one of these axes, rendering all those meshes at once is just an overkill. Instead, I made 2 additional meshes where some of the sides that are not visible through the portals have been removed. You can think of them as LOD levels
The intermediate level was needed because on approximately 8 closest chambers, if player leans along the portal wall, the pillars next to the shelf walls are a tiny bit visible. The last LOD essentially only has the frame around the portal.
Assembling a line of meshes along each axis now became acceptable:
Now, there was a tiny problem, no matter how many of these corridor meshes I put, you can still see a tiny skybox dot in the middle, even with highest antialiasing setting (you can see it on the left side of the last picture of the post).
At first, I tried adding some fog, to add some atmosphere and effectively blend into that skybox pixel. But I just didn't find it satisfying, no matter the color or distance, it just seemed now like a cheap trick instead of looking down the actually infinite corridor I wanted to achieve.
Instead, I got an idea to use an ancient technique of matte painting, or more like - matte 'screenshot'. I simply took a screenshot of a few dozen corridor pieces from approximately player's eye-height, and put that screenshot on a quad on the far end of the 3D corridor:
It perfectly masks the annoying skybox pixel, and shifting is now completely seamless! Mission accomplished!
With this method working great, I now tried shortening the 3D corridor and placing the matte screenshot quad earlier, to gain a bit more performance. But when the player shifted, you could clearly see the perspective 'pop'. Turns out it actually has to be a considerable distance in 3D.
The only unsolved problem in the end appeared to be the darkening of the floor texture with distance, as can be seen in the last picture. I presumed it is due to mip levels of the floor texture, which at more extreme angles blurs the texture. But even with mip maps turned off, the dark pixels were appearing. The material is using an unlit shader, so it couldn't have been some lighting issue. Eventually, I just left it unsolved since it was happening at the same distance from player, hence wasn't visually popping when shifting the player.
With the chambers and 'infinity' now working, I went on to designing the books themselves, and making the first procedural texts, which I will talk about in the next part.
Note: The art in the pics/gifs on this page is the final one. This is simply because I am taking screenshots 'post-mortem', and I don't have any from the actual time of development. So, if you want to imagine how blocking out actually looked during development, just think of a lot of white Unity boxes.
The Wrap
As I already mentioned in the previous part, the design specified that all chambers look exactly the same. Therefore, to create the illusion of infinitely repeating rooms we can simply make them static, no need to move them or change their appearance. Instead, I make the player shift position as they reach a certain limit. I decided to make the center lines of book-filled chambers as limits, without much thinking. However, it would've actually been smarter if the limit was the center of the corridor, since it is better to be as far away from 'regenerating' books as possible, which I will talk about in the next part.The purple circle on the left is the player from top view. As you can see, when the player crosses the center of the chamber, their position gets 'wrapped', teleported to the chamber on the opposite end. The illusion of infinity is maintained because the rooms are identical.
It was important to see what chambers on the sides can be actually seen from the player's perspective, so we can cut the others, since we can't render infinite chambers.
There were a few angles where background chambers on the sides would be seen 'popping' into existence when the player shifts:
And therefore this sort of 'diamond' arrangement of 16 book chambers made sure no weird appearances would happen:
The infinity
Now what is missing is the literally infinite sequence of rooms that can be seen in front-back and left-right axes. This is the most important part of the illusion, because it allows the player to really 'see' the infinity.Initially, I placed a bunch of chamber meshes along the forward axis, but soon I realized that actually you need a LOT of these corridor pieces to see the infinity seamlessly. Since the player will always see them all when looking towards an one of these axes, rendering all those meshes at once is just an overkill. Instead, I made 2 additional meshes where some of the sides that are not visible through the portals have been removed. You can think of them as LOD levels
The intermediate level was needed because on approximately 8 closest chambers, if player leans along the portal wall, the pillars next to the shelf walls are a tiny bit visible. The last LOD essentially only has the frame around the portal.
Assembling a line of meshes along each axis now became acceptable:
The 'whole' library
Now, there was a tiny problem, no matter how many of these corridor meshes I put, you can still see a tiny skybox dot in the middle, even with highest antialiasing setting (you can see it on the left side of the last picture of the post).
At first, I tried adding some fog, to add some atmosphere and effectively blend into that skybox pixel. But I just didn't find it satisfying, no matter the color or distance, it just seemed now like a cheap trick instead of looking down the actually infinite corridor I wanted to achieve.
An attempt with white fog
Instead, I got an idea to use an ancient technique of matte painting, or more like - matte 'screenshot'. I simply took a screenshot of a few dozen corridor pieces from approximately player's eye-height, and put that screenshot on a quad on the far end of the 3D corridor:
Cake is a lie
It perfectly masks the annoying skybox pixel, and shifting is now completely seamless! Mission accomplished!
With this method working great, I now tried shortening the 3D corridor and placing the matte screenshot quad earlier, to gain a bit more performance. But when the player shifted, you could clearly see the perspective 'pop'. Turns out it actually has to be a considerable distance in 3D.
The only unsolved problem in the end appeared to be the darkening of the floor texture with distance, as can be seen in the last picture. I presumed it is due to mip levels of the floor texture, which at more extreme angles blurs the texture. But even with mip maps turned off, the dark pixels were appearing. The material is using an unlit shader, so it couldn't have been some lighting issue. Eventually, I just left it unsolved since it was happening at the same distance from player, hence wasn't visually popping when shifting the player.
Are we there yet?
Brilliant.
ReplyDeleteMagnificent. Thanks for sharing the details of your fantastic work! The next part isn't out yet, is it?
ReplyDeleteThank you for taking the time to explain some of the thinking behind Library of Blabber. I've long been a fan of this project, having discovered it while learning a bit about procedural generation. I'm now learning Unity, and this post has been really helpful in showing how something like this is achieved. Excellent work. I look forward to the third post, but if you don't manage to get around to it, know that what you've already written has been inspiring.
ReplyDeleteSuper Bowl Money Games Are Now Available For 카지노사이트 카지노사이트 카지노 카지노 7063NFL odds on nfl games today【VIP】betting odds on nfl
ReplyDelete