About this blog
opengl and c++ adventures
Entries in this blog
Hello! This journal is going to be about my personal projects, which almost always involve C++ and OpenGL. Currently, I'm working on a project involving the rendering of Minecraft levels. Since this is the first entry, I'm going to attempt to give a brief overview of my project as it stands today, and what my plans are for the future!
The main goal of this project is for me to learn more about C++ and OpenGL and have fun at the same time. I have always been fascinated by Minecraft and how it works; focusing my project on rendering Minecraft worlds gives me something concrete to work towards and lets me worry about the rendering problems, not content creation.
I have a few goals in mind for this project, and some of them have already been met. I've been working on this on and off for a while now, but have just reached the point where I can post pretty (maybe?) screenshots. My main goals are:
1) Parse Minecraft world files and extract the world data.
2) Create a basic OpenGL 3.0 rendering framework that I can re-use.
3) Render any given Minecraft world and allow the user to fly around with a free camera.
The first goal is pretty much complete, although there are improvements I would still like to make. I currently have to hardcode which region files are loaded in and ultimately I would like the user to be able to select the world from a file chooser. The region parsing works well but is a little slow, and that is something else I would like to improve.
For the Minecraft file parsing, I forked a project I found on github called "cppNBT." It hadn't been updated in over a year and I updated it to work with the latest NBT file format. I also added support for parsing a NBT buffer instead of reading from a file and made some performance improvements.
The second goal I have is to bring my OpenGL knowledge up to date. Most of my prior OpenGL experience was with the fixed functionality pipeline, and I wanted to take some time and do it "The Right Way." I spent a couple weeks learning modern OpenGL techniques and implementing a basic framework for future projects. I am by no means an expert, but it is something I really enjoy learning about and this project gives me a great opportunity to do so.
The third goal is to render any Minecraft world in OpenGL and be able to fly around and look at everything. Its a pretty broad goal, and this is the part of the project I am focusing on at the moment. Currently, I am doing some very basic rendering of a Minecraft region - No shadows, textures, lighting, transparency, etc. So far, the only part I have working is the creation of the basic block geometry. The application is correctly parsing the chunk data and generating meshes. I have hardcoded about 20 different block types to different colors so I have something interesting to look at.
Just to give you an idea of my hardware, my development machine is an Intel i7 920 with a Radeon 4870. With one full region loaded (1024 chunks), I currently get around 120 frames per second. Its acceptable, but I know performance will degrade as I improve the image quality and am looking forward to doing some optimizations.
For the future, my main goals are to keep improving the rendering quality and performance. Once the basics are working well, then I can move on to crazy stuff like realistic water, depth of field, motion blur, etc.
I've uploaded the first three screenshots I created after I got the basic region rendering working. In this entry I haven't gone too in depth since I wanted to just give a basic overview of where I was, but in the future I hope to get into the gritty details as I am implementing them.
If you made it this far, give yourself a pat on the back. Thanks for taking an interest, and I hope to have another journal entry soon!