There are many tutorials and explanations of ambient occlusion on the net but, for those of you who don't know how it works, the algorithm (in a nutshell) is:
For every surface (Quads in my case), calculate whether a ray sent out from each vertex collides with any other surface. The amount of rays that are occluded are then interpreted in relation to the total amount of rays to establish how dark/light that vertex should appear.It is important to note that the rays sent out from a surface should be distributed uniformly on the unit sphere. There are many algorithms you could use to calculate the points the rays should pass through (Personally I prefer the Golden Section Spiral).
While messing around with different ideas I just lumped a lot of the code into the graphics library, which now looks really messy. And there are much more optimal ways of doing the calculations involved. Hence, I will be refactoring most of the code into proper libraries, this should take about a week.
Here are some screenshots, a video and for the executable, you can go here. Sorry about the quality of the video, I don't have fast enough internet to upload a proper one.
Lastly, generating terrain with simplex rather than perlin noise.
I really like where you are going with this, I'd love to see the shader in action in real time.
ReplyDeleteSome more suggestions:
1. Day night cycle (would be nice to see how the shader reacts to that).
2. Some environmental objects, like generated trees, and perhaps animals.
3. a HUD (player info) or/and a menu system for settings/game start, and perhaps even a stats or inventory page.
4. I want to see that player swim!
5. Sky, some generated clouds, perhaps even some kind of weather system (I'd be happy with clouds for now).
The above in no particular order.
Awesome work, I love the new direction this project is going.
ReplyDeleteCan't wait to see what happens next.
I am glad I found your blog. I am looking at writing my own Voxel engine in XNA. I would be interested in hearing what your coding environment is.
ReplyDeleteHi there. Thanks for taking the time to comment. I'm writing mine with c++ and OpenGL.
Delete