With the new fixed level of detail, it was time to make som terrain. For a flat ground, have I formerly used highmaps for the terrain but using that for a terrain on a sphere was not an option. I wanted also to have a variegated terrain so the look of the planet could change. So for me I decided to use a variant of perlin noise called simplex noise. Simplex noise like perlin noise is a pseudo-random generator. Why using just simplex noise instead of a rand(), is that random number generators like rand, their output can be too harsh to appear natural. That simplex noise does is that it take an parameter, or more depending on implementation, and return a random number based on that parameter. If you pass it the same parameter twice, it produces the same number twice. Which will therefore make a smoothly generated numbers so they can easily be interpolated.
Here you have a picture of a small part of the generated terrain, and all made bu simplex noise. The appearance of the mountains looks good, and I am happy with the result. A picture I posted earlier in this blog showing you the result I had before with my terrain. The planet which looked more like a meteorite than a planet. Well, as you can se, now it is mountens when you are close to the ground as you are in the picture above.
And here you see how it looks like when you are high up in the sky. It is looking amazing, I am very pleased with the result. The picture with the mountain above is somewhere in the middle of the planet. Hard too see from here but it is there.
Right now it is a bit laggy, when detail is added and sertently when detail is removed. So up next will be to implement view frustum culling, which will make to only render and calculate detail where the camera is headed. So only the things that the camera is looking at, will be rendered and calculated.
As I mentioned yesterday, the detail level was not high enough to get the terrain effect I needed. I plan to solve this was to dynamic add more detail to the ground when the camera came closer and closer. So just add detail where it is needed. And that solution worked out very well!
I made an picture to try to explain how much of a difference it did. As you can see in the picture above, the one to the right was what I had first. This is one side of the cube, with 512×512 quads in it. Now you can see in the left image that I have increased the amount of quads from 512×512 to 16384 x 16384! And the red spot in the left image is how big the right image is now.
Last week we had Milestone 2, which went great. I presented all that I had done the last 2 weeks since Milestone 1. I have for the most worked on the sphere and the terrain. That is for me the most imported thing to get right. Without a good looking terrain, the planet will just be a big thing with some pits in the ground.
The picture above is representing my cube when I have not jet translate it to a sphere. Each side of the cube have 512×512 quads in it, like the red arrow pointing at. The problem I have is that I need much more quads in each side to the illusion that when you are far away, everything is just flat and the closer you get the more you will see some terrain popping up. But the make that happened I need as said more quads. And the way I are doing it now is that I calculate all quads when the program start and store everything in the memory for easy and fast access. But that is not possible anymore because the memory cant save 1024×1024 quads for each side, it´s just to many quads! So how will I solve this?
A solution I came up with is on frame decide if I need more detail where I am right now, thus, where the camera is. So then I is so close that the last quad in memory is showed and I am going closer to the surface. I then split that quad into four new quads and calculate everything for them now. So I only get more quads saved in memory then I need it. And if I getting away from the surface I just remove it from memory. Hopefully this is what I need so I get that detail that is required. Because more then 5120 quads is needed for get the right felling and so it will look like a planet in the end. I have already started with it and hopefully you will get an update on the progress tomorrow.
Today is it Milestone 2 so going to talk about what I have done the last 2 weeks. Present test of concept and show the sphere with level of detail. Also going to talk the problem a have encountered. Going to write more about that after the presentation. Also going to show you the first terrain I have come up to.
Looking good, except I had not in mind to make an meteoroid, I want to make a planet. There you have a hint about the problem.
Today was a good day. Because today level of detail is working perfectly. That you can see in my earlier post is that I am working with an cube that I i transform to an sphere. So for the level of detail I use each side of the cube as a starting quad, then i split each side/quad up in 4 new quads. So each quad have 4 children as I call them. And so on I do this 10 times. So I end up with a cube, there each side of the cube have been split down to 512 smaller quads. Depending on the cameras distance to all quads, them nearest will be rendered. SO depending on the distance quads will be rendered of call their child quads to see if they are close enough to be rendered.
Here is an picture of the implemented level of detail on the sphere. As you can see, the “camera” in this picture is near the circle in the middle of the sphere.And the quads further away is getting bigger and bigger the further away they are.
This week have I for the most just researching and started with my sphere with Level of detail(lod). I was in the beginning very unsure how to do implement lod to an sphere because I have only implement it on an flat terrain. So that is what I have been started to research about and found a very interesting solution, which will fit my needs. First I will start with one cube, the cube have 6 sides, up, down, left, right, front and back. With each side represented as each own flat terrain with it’s own lod. This suits me very well not only because it was not to hard to implement. And later on when view frostum culling is implemented, it can easily just cull an entire side.
Here is a picture of the result, it’s looking terrific. Perfectly round sphere. The picture to the right is from mu project, and the other one is for easier understand what I have done. There you can see that the red line represent the edge of the cube.
Level of detail have I started with but it’s not done jet, some small fixes before I can share it with you all!
Making World is the name of my specialization project. Here on the blog will I show you my progress, any problems I have and just enlighten you what´s have happen.
The project idea is to render planet with an appurtenant sun where it is possible to visit the planet close up on the ground, take a look from the sky or get an overall impression of the planet from space. The planet will have varied terrain, from flat ground to high mountains with water linking all land together. Everything will be textured with different texture for example flat land, mountains or water. With atmospheric effect surrounding the planet and with sunsets and sundown to blend the day to night and night to day.
This is the idea and it will be very fun to work with this and to see how the project grow and to see how all will look like in the end.
See in next post!