Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / What exactly are Voxels... And can DBPro use them?

Author
Message
SamKM
17
Years of Service
User Offline
Joined: 25th May 2009
Location:
Posted: 3rd Sep 2013 03:08
Ok, I have a feeling I'm asking a stupid question here, sorry in advance for that
I've heard Voxels mentioned before in game development, as a way of simulating terrain, especially deformable terrain. I did check out the Wikipedia article, but to be honest, it didn't make much sense to me...
So I was just wondering, can anyone give me a (fairly) simple explanation of what Voxels are, compared to other methods of creating terrain, and whether it's actually possible to use them in DBPro?
Thanks
Mage
Valued Member
19
Years of Service
User Offline
Joined: 3rd Feb 2007
Location:
Posted: 3rd Sep 2013 05:32 Edited at: 3rd Sep 2013 05:38
Without getting too technical, as it pertains to gaming it refers to building objects out of little 3D blocks. Like minecraft terrain in a sense. Technically minecrafts terrain is a little different under the hood.

Any time you've seen a 3D model built out of little cubes, those are voxels.

It is difficult in any scenario to use voxels since you always need a lot of them. So in DBP you need to do like Minecraft and use deformed meshes to essentially make one or several objects appear like many on screen cubes in an effort to be efficient. Having thousands of onscreen cubes will kill performance on any platform. So a big mesh modified to look like your blocky terrain is the best way.

It's possible to do all of this mesh "optimization" automatically with lots of code.

baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 3rd Sep 2013 13:10
I love Wikipedia sometimes: http://en.wikipedia.org/wiki/Voxel

"Here I am trying to do some good for the world..." - Fluffy Rabbit
Wolf
18
Years of Service
User Offline
Joined: 8th Nov 2007
Location: Luxemburg
Posted: 3rd Sep 2013 13:36 Edited at: 3rd Sep 2013 13:36
Quote: " can anyone give me a (fairly) simple explanation of what Voxels are, compared to other methods of creating terrain,"


A voxel terrain is made out of a lot of little cubes (these usually contain information such as color and opacity aswell) while a normal 3D terrain is a mesh with a single/multiple texture(s) on it.
This is a triangulated terrain
(Lowpoly and performance saving)

In relation to a dark basic project: Go with normal terrain. If you are inexperienced with 3D Modeling packages, there are quite a few neat terrain editor that make great landscapes with just a few mouseclicks.

If you are curious, you can google image search "voxel" so you have some more visual information in order to further understand the concept (but really: think lego)



-Wolf

http://www.serygalacaffeine.com
"absurdity has become necessity"
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 3rd Sep 2013 15:08
Quote: "and whether it's actually possible to use them in DBPro?"


It is possible to use them, but you'd have to write the code for the way you handle them yourself.

GPUs can only render meshes, so the idea of voxels is a little abstract anyway, because you have to convert them to a mesh at some point to see them on the screen.

TheComet

Chris Tate
DBPro Master
17
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 3rd Sep 2013 15:46
I am sure someone has already done it in DBP

TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 3rd Sep 2013 16:02 Edited at: 3rd Sep 2013 16:02
SamKM
17
Years of Service
User Offline
Joined: 25th May 2009
Location:
Posted: 4th Sep 2013 22:46
Thanks for all the replies!
Ok, so I thiiiiiink I'm getting what Voxels are... I'm still pretty hazy on how you'd code them in DBPro though :s
Thanks for sending me the Minecraft engine Comet! Is that an example of Voxels then? I just thought that was clever vertexdata manipulation... But maybe that's Voxels...
Quote: "A voxel terrain is made out of a lot of little cubes (these usually contain information such as color and opacity aswell) "

Ok, I think I get that... But we're talking about abstract cubes here, right? Not 'make object cube' style cubes
I'm just interested because a little while back I was trying to make a Minecraft-style sandbox game, but with actual terrain instead of cubes... I gave up because I couldn't figure any way to make the terrain deformable, but maybe Voxels would have been the answer...
Chris Tate
DBPro Master
17
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 4th Sep 2013 23:06 Edited at: 4th Sep 2013 23:07
Quote: "A voxel terrain is made out of a lot of little cubes (these usually contain information such as color and opacity aswell) while a normal 3D terrain is a mesh with a single/multiple texture(s) on it. "


Technically this description of normal terrains is closer to Minecraft voxels than the initial.

It is possible for a single object to contain a large number of textures blended together along a large series of vertices.

Consider that Minecraft textures are notoriously low resolution, this makes plenty of room for many texture atlases.

The guy who made SoulHunter with Dark Basic Classic, ironically also from the same country as Notch, created his own voxel game which used more detailed segments. He created it in Unity.

It would be nice to come up with something else on your own; something that you can bring to the table; that will be more valuable for you in the long run. Why not make a robot creator or galaxy creator or a side scroller with levels made out of hexagons...

Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 6th Sep 2013 14:33
I just refer to voxels as 3D pixels.

Mobiius
Valued Member
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 6th Sep 2013 14:40
Pixels: picture elements
Voxels: volume elements

Clonkex
Forum Vice President
16
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 7th Sep 2013 09:34
Technically, voxels are an abstract concept. They're basically just data in a 3D array (or rather they ARE the 3D array). Most commonly they're visualised as cubes in a landscape (Minecraft, for example).

SPEAKING OF voxels.... I might have a little present for everyone sometime in the next few weeks Just something I've been working on for the last month or so...

TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 8th Sep 2013 03:11
Quote: "I might have a little present for everyone sometime in the next few weeks"

Did you port MineCraft to C++ and fix all of the crappy bugs and lag issues?

Your opinion and the incorporation of thermal noise equations in a high-voltage oscillator circuit are mutually equivalent in relevance.
Clonkex
Forum Vice President
16
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 8th Sep 2013 07:29
Quote: "Did you port MineCraft to C++ and fix all of the crappy bugs and lag issues?"


Not yet - that is something I'm genuinely planning to do in the future, though Well, not so much port it as re-write it from scratch. I started it some time ago but put it off because I found a better project to work on, but trust me it WILL be finished one day.

SamKM
17
Years of Service
User Offline
Joined: 25th May 2009
Location:
Posted: 8th Sep 2013 23:04
Sorry, just checked back on here... Thanks for all the replies on Voxels, I think I understand them now... Mostly :3
I'm still kind of hazy on how you might implement them though... Would it be possible to set up a voxel system using arrays?
Checked out your blog, Clonkex, and... a voxel terrain plugin?! o.O
Wow, that sounds amazing, be great to see what happens with that, and your 3d sandbox game
thenerd
17
Years of Service
User Offline
Joined: 9th Mar 2009
Location: Boston, USA
Posted: 9th Sep 2013 02:39
Quote: "I'm still kind of hazy on how you might implement them though... Would it be possible to set up a voxel system using arrays?
"


The big problem to solve when creating a voxel system is how to render it. It's pretty easy to create some sort of 3d array to store all the voxels, which are pretty much just points in space. The hard part is creating a system which will dynamically create vertices in 3d space surrounding the voxel points.

In the case of Minecraft, the rendering isn't complicated - it just renders each voxel as a cube. Simple. If you're okay with having a square world, this would be pretty simple to implement. But if you want to use a voxel system to create a smooth object, such as terrain, you must have a way to blend the voxels together and generate a mesh from it. The common solution for this is something called the "marching cubes" algorithm. And that is where my knowledge ends. I haven't figured out how to implement this algorithm in dbpro yet here's some resources explaining the concepts though:

The Marching Cubes Algorithm
Polygonising a scalar field
Meshing in a Minecraft Game

Chris Tate
DBPro Master
17
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 9th Sep 2013 02:55
Good points.

I haven't put much thought into voxel level programming because it is not a big deal for me; but if I had to make a voxel system in a week or die; then I would produce a concept in 2D and then translate that into 3D.

I think the FPSC map editor illustrates how voxels can work using segmental map elements, each cube or plane adapts to what is adjacent to it. We can't use geometry shaders in DBP, so we lost out there; the next best thing is multi-pass vertex shading.

It will be interesting to see what you come up with.

Clonkex
Forum Vice President
16
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 9th Sep 2013 03:59 Edited at: 9th Sep 2013 04:32
No one need work on voxels themselves...that's kind of my semi-secret project (it was secret until I realised I'd said what I was making on my blog). It will support smooth and cubic worlds. And yes, rendering voxel terrain is complicated, to say the least. I just have to get the shader working and then I'll release a demo in the WIP forum.

I've just realised I might have implied I was releasing the plugin for free by saying "I might have a little present for everyone", but it'll be a paid plugin (sorry guys, I need the cash rather desperately) with a free version, in much the same way as BlitzTerrain. Won't be expensive though.

Quote: "Wow, that sounds amazing, be great to see what happens with that, and your 3d sandbox game "


I'm glad, because I was wondering just how much people might want a plugin like this

Chris Tate
DBPro Master
17
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 9th Sep 2013 18:14
Sounds good

Login to post a reply

Server time is: 2026-07-08 02:16:27
Your offset time is: 2026-07-08 02:16:27