Simple voxel environment for Ogre3D

A place to show off your latest screenshots and for people to comment on them. Only start a new thread here if you have some nice images to show off!
Post Reply
User avatar
neam
Gnoblar
Posts: 9
Joined: Tue Aug 14, 2012 3:40 pm
x 6

Simple voxel environment for Ogre3D

Post by neam »

It makes just six months that I've discovered Ogre3D and I am really impressed by how far an opensource project could go !!!
I would just show something that I've developed for Ogre. It's a part of a game, and this could be considered like a very important part of this game: A voxel map. (a minecraft like world)
At the start, my idea was to create a simple map, nothing fancy, and I've followed a tutorial on how ones could create a voxel map with Ogre3D.
But, at this time, the code was everything but generic and flexible, and a lot of operations on the voxel map couldn't be done.
And I spent a lot of time creating something that I could use as I wish and that could be as generic as possible. (and this is my point of view, but I think the code has enough features for a finite voxel environment)

Now I think the code is quite good for a public "release" (the code, not the comments :mrgreen: . I am not a native English speaker, and my English is really really poor :( )

Some screenshots of some tests of this voxel map :)
(technical notes: I use the deferred shading sample; there is no reflection, just transparency; sorry for the mouse pointer :mrgreen: )
Image
Image

and a link to a GIT repo for a demo: https://bitbucket.org/neam/cr-chunk_map/src (only tested on GNU/Linux, gcc 4.7.2, ogre 1.8.1. If you want to try it on windows, you must have a c++11 compiler)

What features make this code special:
  • - The ability to change the material of some blocks (in the screenshots, there is the lava and the lights blocks that have a different material)
    - The creation of hooks on some blocks type is possible (the different lights blocks in the screenshots), plus the information if the block is visible or not
    - An A* implementation (even though it is not heavily optimised :? )
    - Constant time access and modification of the map (but not to update its graphical representation)
    - Really simple to use !!
And things that remain to do:
  • - The time to update the ManualObjects is really too slow, and as I add some new features, its complexity increase and thus the time to update the map...
    - No shadows, no lights, no ambient occlusion. (nothing specialized for the voxels, but some features of Ogre3D could address those lacks)
    - Finite (although big) environment only.
I am thinking about updating the ManualObjects in another thread, but I do not know how Ogre3D (and openGL) will react to this, and this will not solve the complexity problem...

I am open for every suggestions, improvements and everything that could be constructive :) (especially about the speed improvements that could be done !)

I've released this code because, before creating my own voxel environment, I have searched for something that could fit my needs, and be usable with Ogre3D, but the only libs that I have found are
really too much for my simple needs or couldn't be used easily for what I wanted to do.

With this code, I've also released some classes/functions that could be really nice for beginners, and others that could simplify a lot some repetitive things.

So, feel free to use this code in your project :)

Keep also in mind that I am a third year IT student, and that I've discovered Ogre3D 6 months ago.

I hope this will be useful !!
bstone
OGRE Expert User
OGRE Expert User
Posts: 1920
Joined: Sun Feb 19, 2012 9:24 pm
Location: Russia
x 201

Re: Simple voxel environment for Ogre3D

Post by bstone »

Very nice! Thanks for sharing. I believe many Ogre users will find that very useful because the minecraft theme simply... doesn't... want... to die :D

I'm judging by the number of times the "manual object cubes" stuff has been brought up.
User avatar
neam
Gnoblar
Posts: 9
Joined: Tue Aug 14, 2012 3:40 pm
x 6

Re: Simple voxel environment for Ogre3D

Post by neam »

thanks :)

I think too, I've ran across some of these topics on the forums.. (and that's a reason why I share this ;) )
nico008
Gnoblar
Posts: 15
Joined: Sun Mar 21, 2010 2:55 pm

Re: Simple voxel environment for Ogre3D

Post by nico008 »

This is exactly what I was looking for!

Except that I'm using Mogre so I will have to convert it to C# ;-)
User avatar
neam
Gnoblar
Posts: 9
Joined: Tue Aug 14, 2012 3:40 pm
x 6

Re: Simple voxel environment for Ogre3D

Post by neam »

A link where you can download win32 binaries of the demo: https://bitbucket.org/neam/cr-chunk_map ... map.tar.xz

edit: on the demo, the left click place a particle block, and the right click remove a block.
Last edited by neam on Sun Mar 17, 2013 11:03 pm, edited 1 time in total.
User avatar
AlexeyKnyshev
Goblin
Posts: 213
Joined: Sat May 26, 2012 10:37 am
Location: Russia
x 13

Re: Simple voxel environment for Ogre3D

Post by AlexeyKnyshev »

Looks great! It would be interesting to make with you Linux game project or something like that)
Voltage Engine - boost your ogre project with realtime physics and interactive scripting!
OgreBullet & CMake - easy to use bullet physics integration.
User avatar
neam
Gnoblar
Posts: 9
Joined: Tue Aug 14, 2012 3:40 pm
x 6

Re: Simple voxel environment for Ogre3D

Post by neam »

thanks !!! (is that a proposition ? :D )
User avatar
AlexeyKnyshev
Goblin
Posts: 213
Joined: Sat May 26, 2012 10:37 am
Location: Russia
x 13

Re: Simple voxel environment for Ogre3D

Post by AlexeyKnyshev »

neam wrote:thanks !!! (is that a proposition ? :D )
As you wish ;-)
Voltage Engine - boost your ogre project with realtime physics and interactive scripting!
OgreBullet & CMake - easy to use bullet physics integration.
User avatar
neam
Gnoblar
Posts: 9
Joined: Tue Aug 14, 2012 3:40 pm
x 6

Re: Simple voxel environment for Ogre3D

Post by neam »

AlexeyKnyshev wrote:As you wish ;-)
hum... why not :)
Treon
Kobold
Posts: 37
Joined: Mon Mar 07, 2011 2:30 pm

Re: Simple voxel environment for Ogre3D

Post by Treon »

Looks very nice ! I look forward to see more updates from you, will definitely follow this :)
crashtua
Gnoblar
Posts: 15
Joined: Wed Aug 03, 2011 6:21 pm

Re: Simple voxel environment for Ogre3D

Post by crashtua »

Hello. How did you use different materials? Did you create new mesh for non default material? And, windows demo question - where to get proper OpenAL.dll? :)
User avatar
neam
Gnoblar
Posts: 9
Joined: Tue Aug 14, 2012 3:40 pm
x 6

Re: Simple voxel environment for Ogre3D

Post by neam »

hi. sorry for this late reply...
the openal.dll is here https://mega.co.nz/#!xRl13YbC!YVW-Zmpya ... nu-dAQ8_Js (it was added by mistake to the link dependencies...)

for the materials question, you can assign material to a block type using

Code: Select all

set_additional_material("my-material", {12, 42, 13, 5}, false)
the

Code: Select all

{12, 42, 13, 5}
list is the block on which the material will be applied. (the uv texture coords are set following the block number in the code but you can override it in your material script.)
the last parameter (false) specify if the block is transparent or not. a transparent block will force around blocks to render there faces as if this block doesn't exist. (useful for glass for example.).
I suggest you to not create underground transparent objects as this will increase the number of created triangles, and could lead to performance issues.

I have wrote a full doc (but in french) and if you're interested in it, I could sent it to you.
my next step on this project is to write doxygen comments for every public functions...

Hope I could've been helpful !!
Post Reply