OpenGL map viewer : an experiment [DEMO AVAILABLE]

External additional handy features.
44 posts Page 1 of 3
melchips
Coder
Coder
Posts: 12
Joined: Wed Nov 14, 2012 10:15 am


Hello,

! Downloadable demo available at the end of the post !

I am working on a simple OpenGL viewer for Ace Of Spades .vxl maps (in C language).
I made it to learn OpenGL and to see if Minecraft lighting would suit AoS.

Comparison shots between Ace of Spades and the OpenGL viewer :
Image

Image

Image

Image

Image

Image

Video of mesa.vxl in the map viewer:
The light is propagated just like in Minecraft.
There is also lighting interpolation across block faces.

Below a screenshot without color information (to have a better look on the shades) next to a full render :
Image

The tool is a command line program with the following switches :
Code: Select all
   ___|         |             ___|  |     
  |      |   |  __ \    _ \  |      |     
  |      |   |  |   |   __/  |   |  |     
 \____| \__,_| _.__/  \___| \____| _____|  v0.4a


Usage : ./cubegl [OPTIONS] <mapfile>

options :
	-f : enable full screen
	-w [value] : window width
	-h [value] : window height
	-z [value] : window depth (bits per pixel)
	-v : verbose output
	-d : debug
	-p : display debug graphs (plots)
	-b : discard block's color information (white blocks)
	-a [0,1] : advanced OpenGL enabled or not (VBO)
	-c [0,1] : draw clouds or not
	-t [0,1] : draw textures on blocks or not
	-m [0-15] : minimum lighting value (0 for dark, 15 for light, default = 2)
	            for 0, dark areas will be pitch black
	            for 15, there will be no dark areas
	-s RRGGBB : color of the sky in hex values (e.g. FF0000 for red)
	            sample values :
	            9BD2F1 : blue sky for day (default value)
	            001F36 : dark blue for night (you may want to lower gamma to have a better effect)
	            E3A857 : for a sunset color (you may want to lower gamma to have a better effect)
	-q [0,2,4,6,8,16] : antialias quality
	-g [value] : gamma value (default 1.0) 
	-r [value] : render distance (default 24)

example :
	./cubegl -w 1024 -h 768 -z 16 -p -v -a 0 -b -c 1 -t 0 -m 2 -f -s 001F36 -g 0.5 ./mesa.vxl
If it's not working straight away, you could try the lowest settings as indicated below :
Code: Select all
cubegl -q 0 -t 0 -c 0 -w 800 -h 600 -z 16 -a 0 map.vxl
On GNU/Linux, if you have a missing library error, try launching the program like this to use the included libs :
Code: Select all
LD_LIBRARY_PATH=./libs ./cubegl map.vxl
Controls are WASD / ZQSD to move, shift to go down, space to go up. Esc to exit.

Links to version 0.4a download :
GNU/Linux 32 bits (2 MB)
GNU/Linux 64 bits (2 MB)
Windows (2 MB)
Last edited by melchips on Thu Apr 18, 2013 1:22 am, edited 2 times in total.
TheGeekZeke101
Deuced Up
Posts: 116
Joined: Sun Dec 02, 2012 6:54 pm


That is beautiful. Looks very promising. Can't wait for this to be released.
CraftDinur
Deuced Up
Posts: 152
Joined: Thu Nov 08, 2012 8:20 pm


If only we could get lighting like this implemented into the full game Green_Crying
rakiru
Coder
Coder
Posts: 1349
Joined: Sun Nov 11, 2012 12:26 pm


Nice work. ^-^
What are you planning to do with this? Release a map-viewer? Release a library for others to use?
Yourself
Coder
Coder
Posts: 28
Joined: Mon Nov 05, 2012 5:24 pm


Very nice! Are you only using ambient occlusion for shading? It looks to me like there are no other sources of light or any sort of shadows. Are you using screen space ambient occlusion?

I started a thread on CPU based AO here: http://www.volumesoffun.com/phpBB3/view ... f=14&t=481

The idea is that hopefully AO can be used on computers with older graphics cards.

I'm working on an engine for a new game atm. Using polyvox and Irrlicht. Screenshot: http://i.imgur.com/5RxnXfD.png

Edit: also I think you might get better results if you implement directional lighting and turn down the AO slightly.
Last edited by Yourself on Sun Feb 17, 2013 9:33 pm, edited 1 time in total.
HoboHob
Winter Celebration 2013
Winter Celebration 2013
Posts: 979
Joined: Mon Nov 05, 2012 5:02 pm


Do us all a favor, download the Iceball source and implement this nao.
melchips
Coder
Coder
Posts: 12
Joined: Wed Nov 14, 2012 10:15 am


Thanks everyone for your comments.

@Yourself The algorithm used is directly the one used by Minecraft. There is no ray casting or anything, it is only a cheap method to propagate light (maximum at 15 blocks). That's why caves entrances are lighten just a little and the end of the caves are pitch black (although I am forcing a maximum darkness to prevent seeing nothing in dark places).
Yourself wrote:
I'm working on an engine for a new game atm. Using polyvox and Irrlicht. Screenshot: http://i.imgur.com/5RxnXfD.png
.

Good luck with that ;)
I started by using Ogre3d with C++ and I had pretty good results but I wanted to know how things worked under the hood.
And relying on external libraries was a mess for compilation times and for cross compiling :/
Yourself wrote:
Edit: also I think you might get better results if you implement directional lighting and turn down the AO slightly.
I haven't planned to have shadows matching the sun's position or other light sources, but I guess it could be done with shaders, like it is in Minecraft with Sonic Ether's Unbelievable Shaders.
rakiru wrote:
Nice work. ^-^
What are you planning to do with this? Release a map-viewer? Release a library for others to use?
Originally, I worked on this project as a proof of concept.
I knew a good client was in dev (Iceball) so I focused only on graphical aspects (as it was not the priority for Iceball).

I have not yet decided what to do next.
I plan to release first a demo and then the source code after a bit of clean up (GPL licence).

Many options are then possible, and all depends of the community :
- use it only as a map viewer
- use it as a base or an inspiration for new voxel based games (hence opening the source up)
- work on an alternative client for AoS : depends if people wants to participate in the project or not and if the rendering constraints (like in Minecraft) are suitable for a game like AoS. Maybe we should merge our forces instead and work only on Iceball ?
- incorporate ideas in Iceball, wink to HoboHob (but I'm not sure I'm skilled enough to incorporate concepts into Iceball, even if the latests commits have already done a lot of work with the addition of OpenGL as an alternative renderer)
- others thing I haven't thought about ? tell me !

What you do think ?

As a bonus, a little preview video of the mesa.vxl map
Yourself
Coder
Coder
Posts: 28
Joined: Mon Nov 05, 2012 5:24 pm


melchips wrote:
Thanks everyone for your comments.

@Yourself The algorithm used is directly the one used by Minecraft. There is no ray casting or anything, it is only a cheap method to propagate light (maximum at 15 blocks). That's why caves entrances are lighten just a little and the end of the caves are pitch black (although I am forcing a maximum darkness to prevent seeing nothing in dark places).
Yourself wrote:
I'm working on an engine for a new game atm. Using polyvox and Irrlicht. Screenshot: http://i.imgur.com/5RxnXfD.png
.
Yourself wrote:
Edit: also I think you might get better results if you implement directional lighting and turn down the AO slightly.
I haven't planned to have shadows matching the sun's position or other light sources, but I guess it could be done with shaders, like it is in Minecraft with Sonic Ether's Unbelievable Shaders.
Wow I'm very impressed by the results from such a simple algorithm! One question though: the posts I've been reading on the minecraft algorithm work per-block and not per vertex. Your screenshots and videos on the other hand show variation in shading over block faces. Are the vertices different colors? What algorithm is this?

Also I wasn't talking about shadows, but rather something like flat shading, phong shading, or gouraud shading. Flat shading is really easy to implement and will give you good results!

Edit:
A possible implementation I came up with: at each vertex, take the average color of the blocks that make up that vertex. This way you get a nice shading effect.

This doesn't explain something like this though:
Image

Edit2: I found https://github.com/overviewer/Minecraft ... h-lighting which explains what's going on. Very nice! Blue_Happy3
Buffet_of_Lies
Mapper
Mapper
Posts: 402
Joined: Tue Nov 20, 2012 11:25 am


I love the clouds.
HoboHob
Winter Celebration 2013
Winter Celebration 2013
Posts: 979
Joined: Mon Nov 05, 2012 5:02 pm


If you ask me this looks 10x better than Ace of Spades 1.0!
melchips
Coder
Coder
Posts: 12
Joined: Wed Nov 14, 2012 10:15 am


@Yourself
Exactly, each vextex gets an average value.
Simple but very effective ^^

@Buffet_of_Lies
I love them too ;)
It gives a nice touch to AoS maps.

@HoboHob
Thanks mate.
I think AOS 1.0 implements the same principles but they have also added a texture to blocks and a pixelated texture on the skybox.
Their chunks tesselating seems incredibly fast. I suspect that chunks are pre-rendered at map loading screen and then just loaded from memory (that's would explain why map loading takes a huge amount of time). But I haven't checked that theory yet.
Sample
Deuced Up
Posts: 83
Joined: Wed Nov 21, 2012 8:37 pm


Prototype AoS version with that graphic

Image
melchips
Coder
Coder
Posts: 12
Joined: Wed Nov 14, 2012 10:15 am


I have uploaded a precompiled demo for GNU/Linux (32 and 64 bits) and windows.

The tool is a command line program with the following switches :
Code: Select all
   ___|         |             ___|  |     
  |      |   |  __ \    _ \  |      |     
  |      |   |  |   |   __/  |   |  |     
 \____| \__,_| _.__/  \___| \____| _____|  v0.4a


Usage : ./cubegl [OPTIONS] <mapfile>

options :
	-f : enable full screen
	-w [value] : window width
	-h [value] : window height
	-z [value] : window depth (bits per pixel)
	-v : verbose output
	-d : debug
	-p : display debug graphs (plots)
	-b : discard block's color information (white blocks)
	-a [0,1] : advanced OpenGL enabled or not (VBO)
	-c [0,1] : draw clouds or not
	-t [0,1] : draw textures on blocks or not
	-m [0-15] : minimum lighting value (0 for dark, 15 for light, default = 2)
	            for 0, dark areas will be pitch black
	            for 15, there will be no dark areas
	-s RRGGBB : color of the sky in hex values (e.g. FF0000 for red)
	            sample values :
	            9BD2F1 : blue sky for day (default value)
	            001F36 : dark blue for night (you may want to lower gamma to have a better effect)
	            E3A857 : for a sunset color (you may want to lower gamma to have a better effect)
	-q [0,2,4,6,8,16] : antialias quality
	-g [value] : gamma value (default 1.0) 
	-r [value] : render distance (default 24)

example :
	./cubegl -w 1024 -h 768 -z 16 -p -v -a 0 -b -c 1 -t 0 -m 2 -f -s 001F36 -g 0.5 ./mesa.vxl
If it's not working straight away, you could try the lowest settings as indicated below :
Code: Select all
cubegl -q 0 -t 0 -c 0 -w 800 -h 600 -z 16 -a 0 map.vxl
On GNU/Linux, if you have a missing library error, try launching the program like this to use the included libs :
Code: Select all
LD_LIBRARY_PATH=./libs ./cubegl map.vxl
Controls are WASD / ZQSD to move, shift to go down, space to go up. Esc to exit.

Links to version 0.4a download :
GNU/Linux 32 bits (2 MB)
GNU/Linux 64 bits (2 MB)
Windows (2 MB)
Last edited by melchips on Sun Apr 14, 2013 7:31 pm, edited 1 time in total.
Semper
Deuced Up
Posts: 627
Joined: Thu Nov 01, 2012 6:41 pm


Oh my god this is amazing.
HoboHob
Winter Celebration 2013
Winter Celebration 2013
Posts: 979
Joined: Mon Nov 05, 2012 5:02 pm


Shut up and take my $0.20!

Plz can haz src.
44 posts Page 1 of 3
Return to “Add-ons & Tools”

Who is online

Users browsing this forum: No registered users and 1 guest