Jump to content


Photo

The art of programming Voxels


  • Please log in to reply
27 replies to this topic

#1 duke_Qa

duke_Qa

    I've had this avatar since... 2003?

  • Network Staff
  • 3,837 posts
  • Location:Norway
  • Division:Revora
  • Job:Artist

Posted 08 January 2012 - 11:43 PM

So, since I'm an idiot that goes with the flow, I'm looking into voxels.

Terrain voxels to be precise, or symmetric 3d dataclouds rendered with polygons. More minecraft than 3d-scanner surface dataclouds or super-realistic rendering(not this but its very nice for some troubling puzzles I'm trying to wrestle under control), or whatever else voxels have stood for before.

Right now I'm just spending a lot of time looking into the different things I need to know about these things. Right now an octree data-tree to store relevant voxels in is pretty mandatory. Symmetric voxels every 25cm is my current guess, Having a octree storage system on the saved files is also a nice compression right off the bat(if everything in a block is of the same type, stop splitting and define that block as "all X").

But my main problem right now is how to take these clouds of data and apply "filters" to them. If you got an 3d array of booleans in the shape of terrain, and you want to add a displacement to it or smooth it down in x/y/z or drag it around.
I guess one might even say what I'm grumbling about is less about the voxels and more about the random terrain generation. Is it easier to write your own algorithms or is it better and easier find finished ones?
Other things I wonder about are noise-generators. Since repetitiveness is important seeds will be vital. Most noise generators support them anyway, but I'll probably have a look around for something else than perlin noise, or at least a possibility to tweak it.

Anyway, if you have some generic tips for me about the topic feel free to post about it. I'm looking for books and articles about map generation and voxel manipulation, but anything halfway relevant worth a read is welcome.

"I give you private information on corporations for free and I'm a villain. Mark Zuckerberg gives your private information to corporations for money and he's 'Man of the Year.'" - Assange


#2 Pasidon

Pasidon

    Splitting Hares

  • Network Admins
  • 9,127 posts
  • Location:Indiana
  • Projects:Writing Words With Letters
  •  I Help
  • Division:Community
  • Job:Community Admin

Posted 09 January 2012 - 12:20 AM

Hope that pretty new computer of yours can handle such a feat. I used terrain rendering programs similar to voxels... some sort of GIS program that looked pretty simular. I did that... two years ago, to try and calculate ancient terrains before fluvial processes and glaciation. I'm not sure how to accomplish all the things you want, but that pricey program called Maya may have the services you need. I recall hearing of a voxel incorporation with one of the latest versions.

#3 duke_Qa

duke_Qa

    I've had this avatar since... 2003?

  • Network Staff
  • 3,837 posts
  • Location:Norway
  • Division:Revora
  • Job:Artist

Posted 09 January 2012 - 08:06 AM

Well its all about optimization. Doing like Notch did in minecraft by splitting it up in chunks and calculating them one by one drastically reduces the loading times. if you have to spend 10-30 seconds the first time you create a map, it isn't that bad.
Also, I bought Maya last year, not cheap and the release was crap, but at least I've paid for it(got student discount of 50% too). But its not the engine of choice for something like this.
A game engine that does occlusion culling and camera cutout culling should be able to handle many polygons. Also, different mesh-generation algorithms for different LODs should reduce the troubles of mountains and high-up camera angles. Besides, you only generate mesh for the elements that have air/transparent materials around them.

Alas, its still quite a bit of information to chug through. notch's chunks of 16x16x256 contain 65536 points, if I wanted a chunk the same size with 25cm bits, it would be 1.04mill datapoints per 16m^2. of course you only need to go through that once and filter out the stuff that doesn't show, but its still going to take a bit of energy. I had a theory that you could store these datapoints in vertical columns instead of numbers though. so instead of [1,2,3,4,5,6...,256] you go [rock:128, dirt:132, air:256]... but I fear its redundant with an octree and the need for going through the data anyway to find surfaces.

Edited by duke_Qa, 09 January 2012 - 08:07 AM.

"I give you private information on corporations for free and I'm a villain. Mark Zuckerberg gives your private information to corporations for money and he's 'Man of the Year.'" - Assange


#4 Pasidon

Pasidon

    Splitting Hares

  • Network Admins
  • 9,127 posts
  • Location:Indiana
  • Projects:Writing Words With Letters
  •  I Help
  • Division:Community
  • Job:Community Admin

Posted 09 January 2012 - 05:17 PM

You may find this helpful:

http://www.minecraft...iki/Data_values

#5 duke_Qa

duke_Qa

    I've had this avatar since... 2003?

  • Network Staff
  • 3,837 posts
  • Location:Norway
  • Division:Revora
  • Job:Artist

Posted 09 January 2012 - 07:01 PM

Yeah I've noticed the system he uses there. terrain is pretty easy to split into numbers like that. But I'm a bit more ambivalent about items, I think it might be more interesting to have a system that stores transform, rotation and scale on more custom items, maybe even custom tint as well. Mostly because I'm planning on adding sound-effects like echo and lights in stranger colors.

With a good parser of data in a octree system, it shouldn't be hard, just create different tags with different info about the items. { blockXYZ: [terrain:air;][items:torch(rgb:FBFBBA; decay:1;strength:1; rot:0,90,20;scale:2,2,2)],table,painting } might be one coord.

The big questions are the map generators. I suspect it involves tons of calculus. Here we have another link, and I suspect the examples it brings up are assignments made by crazy people doing crazy maths for titles.

"I give you private information on corporations for free and I'm a villain. Mark Zuckerberg gives your private information to corporations for money and he's 'Man of the Year.'" - Assange


#6 Pasidon

Pasidon

    Splitting Hares

  • Network Admins
  • 9,127 posts
  • Location:Indiana
  • Projects:Writing Words With Letters
  •  I Help
  • Division:Community
  • Job:Community Admin

Posted 10 January 2012 - 05:22 AM

Neh... stuff I don't do. I'll let you handle the math there. ... Unless you learn my true name and force me to be your math thrall.

#7 duke_Qa

duke_Qa

    I've had this avatar since... 2003?

  • Network Staff
  • 3,837 posts
  • Location:Norway
  • Division:Revora
  • Job:Artist

Posted 10 January 2012 - 02:45 PM

It's parts of the math that I find fascinating. Well, the logic at least, I'm rusty and/or mediocre at math and I don't recall 75% of the math I learned my final year of senior high. Not that it was very advanced math to begin with, but its all gone now.

This vid seems to explain calculus in 20 minutes, its mentioned in some articles that a few drops of calculus might be needed at times, but hopefully you can get away from it :p.

Right now I like the theory of using some sort of liquid simulation to erode and smooth terrain. Combining it with tectonic movements to create mountains where those are supposed to be and so forth.

"I give you private information on corporations for free and I'm a villain. Mark Zuckerberg gives your private information to corporations for money and he's 'Man of the Year.'" - Assange


#8 Pasidon

Pasidon

    Splitting Hares

  • Network Admins
  • 9,127 posts
  • Location:Indiana
  • Projects:Writing Words With Letters
  •  I Help
  • Division:Community
  • Job:Community Admin

Posted 10 January 2012 - 06:19 PM

Ooo... now that I doo-doo. Geological processes, fluvial terrains, aerobic erosions... I'm sure that program you use can do all that stuff.

#9 duke_Qa

duke_Qa

    I've had this avatar since... 2003?

  • Network Staff
  • 3,837 posts
  • Location:Norway
  • Division:Revora
  • Job:Artist

Posted 11 January 2012 - 03:41 PM

I'd use realflow or terragen/vue to do that sort of stuff for realism and/or pictures. But games need to be quick mofo's, so you need to improvise and find ways to get a quick and good result.

I guess Notch doesn't use anything but 3d-noise effects with tweaked input settings. and still its a bit delayed at times, so adding 20-50 000 years of simulation for every block you need to create isn't going to be entertaining.

"I give you private information on corporations for free and I'm a villain. Mark Zuckerberg gives your private information to corporations for money and he's 'Man of the Year.'" - Assange


#10 Pasidon

Pasidon

    Splitting Hares

  • Network Admins
  • 9,127 posts
  • Location:Indiana
  • Projects:Writing Words With Letters
  •  I Help
  • Division:Community
  • Job:Community Admin

Posted 11 January 2012 - 04:49 PM

t all depends on the level of ridiculousness you choose for their alteration.

#11 duke_Qa

duke_Qa

    I've had this avatar since... 2003?

  • Network Staff
  • 3,837 posts
  • Location:Norway
  • Division:Revora
  • Job:Artist

Posted 12 January 2012 - 02:42 PM

I could end up like the guy who made dwarf fortress then. He got a doctorate in mathematics while building that game as a hobby, but then realized that he would rather produce games than produce dry scientific papers. So he lives in a small dorm off donations, having very few friends and just building that game year by year, drinking soda and generally being very unsocial :)


The problem with these systems is that I rather would have liked to have finished methods/classes that contain the building blocks/simulation codes. Also, with the wrong API/script language, you are looking at a 20x for simple loops run internally compared to dedicated code. I liked that first article I linked because it seemed to have ready-made functions that would instantly manipulate the arrays using the GPU.

I am still a bit of a sucker for unity3d, but I dunno how effective it would be at that. I've seen examples for it so it should be possible, but more research is required.

"I give you private information on corporations for free and I'm a villain. Mark Zuckerberg gives your private information to corporations for money and he's 'Man of the Year.'" - Assange


#12 Pasidon

Pasidon

    Splitting Hares

  • Network Admins
  • 9,127 posts
  • Location:Indiana
  • Projects:Writing Words With Letters
  •  I Help
  • Division:Community
  • Job:Community Admin

Posted 12 January 2012 - 03:07 PM

I'm not that thrilled to hear that people would rather make games than contribute to science... but as long as I like the game, I suppose it's worth never knowing what could have been learned.

Unity 3D? Didn't the good people of Unreal design that, or am I thinking of another design program?

#13 duke_Qa

duke_Qa

    I've had this avatar since... 2003?

  • Network Staff
  • 3,837 posts
  • Location:Norway
  • Division:Revora
  • Job:Artist

Posted 12 January 2012 - 10:45 PM

That would probably not be the same since unreal has the udk which is in semi-competition with it.

Unity3d Is mainly Danish I believe, even got mahself a subforum for it here, but its been somewhat dead since nobody really uses it(me included right now, but I'm spending free time reading up on tuts and doing some small scripts).

A shame though, since I honestly believe unity3d is one of the better 3d engines for indies out there.

Edited by duke_Qa, 12 January 2012 - 10:46 PM.

"I give you private information on corporations for free and I'm a villain. Mark Zuckerberg gives your private information to corporations for money and he's 'Man of the Year.'" - Assange


#14 Pasidon

Pasidon

    Splitting Hares

  • Network Admins
  • 9,127 posts
  • Location:Indiana
  • Projects:Writing Words With Letters
  •  I Help
  • Division:Community
  • Job:Community Admin

Posted 12 January 2012 - 11:03 PM

Oh. Guess I never even heard of it then.

#15 duke_Qa

duke_Qa

    I've had this avatar since... 2003?

  • Network Staff
  • 3,837 posts
  • Location:Norway
  • Division:Revora
  • Job:Artist

Posted 13 January 2012 - 12:12 PM

http://unity3d.com/g...unity/game-list

List of the more famous games made in it. Battlestar galactica online is probably the one I've heard most of in mainstream media, and Zombieville.
The good part about it is that its a bit more intuitive than the udk, and has good document references, question-site, forums and so forth.

Edited by duke_Qa, 14 January 2012 - 02:59 PM.

"I give you private information on corporations for free and I'm a villain. Mark Zuckerberg gives your private information to corporations for money and he's 'Man of the Year.'" - Assange


#16 Pasidon

Pasidon

    Splitting Hares

  • Network Admins
  • 9,127 posts
  • Location:Indiana
  • Projects:Writing Words With Letters
  •  I Help
  • Division:Community
  • Job:Community Admin

Posted 13 January 2012 - 05:17 PM

Linky broke.

#17 duke_Qa

duke_Qa

    I've had this avatar since... 2003?

  • Network Staff
  • 3,837 posts
  • Location:Norway
  • Division:Revora
  • Job:Artist

Posted 15 January 2012 - 08:04 PM

Or just bad paste, should be working now. Beyond that, there are people who've made voxel engines for unity3d. Here's one very minecrafty.
http://www.youtube.com/watch?v=Xt75w7cwKXo

Here's one a bit more organic. It is also available so I could buy the source-code and modify it to fit my needs. Which is something I could have done, but I want something less organic and more optimized.

Edited by duke_Qa, 15 January 2012 - 08:05 PM.

"I give you private information on corporations for free and I'm a villain. Mark Zuckerberg gives your private information to corporations for money and he's 'Man of the Year.'" - Assange


#18 Pasidon

Pasidon

    Splitting Hares

  • Network Admins
  • 9,127 posts
  • Location:Indiana
  • Projects:Writing Words With Letters
  •  I Help
  • Division:Community
  • Job:Community Admin

Posted 15 January 2012 - 08:58 PM

PPPPPHHHH... what a tease. I thought he was actually making something interesting in that video and he ends up just falling into a hole. But that pretty much was Minecraft... And yea, that more organic one looks amazing.

Here's a recent Voxel game:



It was featured on the Yogscast in that video... it's quite a horrible looking game, but it is indeed Voxel.

#19 Pasidon

Pasidon

    Splitting Hares

  • Network Admins
  • 9,127 posts
  • Location:Indiana
  • Projects:Writing Words With Letters
  •  I Help
  • Division:Community
  • Job:Community Admin

Posted 23 January 2012 - 08:45 PM

I thought you may also find his interesting:



This just doesn't apply to Minecraft... you can make anything voxel and make 3D prints of them. You gotta' be pretty money funny to afford such a thing, but I found the technology very cool.

#20 duke_Qa

duke_Qa

    I've had this avatar since... 2003?

  • Network Staff
  • 3,837 posts
  • Location:Norway
  • Division:Revora
  • Job:Artist

Posted 23 January 2012 - 11:07 PM

Been planning to invest in a professional 3d printer, but right now I think the cost of plastic is brutal, its like syndicated ink*2000 and there is a ton of innovation going on. So within a year or two a proper printer with relatively cheap plastic will be the one to go for.

"I give you private information on corporations for free and I'm a villain. Mark Zuckerberg gives your private information to corporations for money and he's 'Man of the Year.'" - Assange





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users