Volumes Of Fun
http://www.volumesoffun.com/phpBB3/

[WIP project] Using polyvox marching cubes and ogre
http://www.volumesoffun.com/phpBB3/viewtopic.php?f=18&t=486
Page 1 of 1

Author:  Sarcen [ Wed Feb 20, 2013 11:43 pm ]
Post subject:  [WIP project] Using polyvox marching cubes and ogre

I've been working on a "little" project using PolyVox's marching cubes surface extractor to build my terrain, which is working very well so far. I've had some issues trying to get it to work with multithreading but I've decided on a workaround in which I just create multiple PolyVox Volumes, one for each thread, and allow each Volume to hold a very low number of blocks. Inside the LargeVolume dataRequiredHandler I fill the world from a threadsafe source (with shared mutex's). This does increase my memory obviously, but so far my memory usage is very acceptable. And the building speed is great.

Anyway, reason I'm posting here is because there is a lack of nice MarchingCubesSurfaceExtractor pics! (everyone seems to be liking cubes more!)

(all art (textures, models) is temporary borrowed from ogre or other free art sources)

Basic terrain screen, there are still quiet allot none smooth edges, but this has more to do with the way density is being generated since i can make a perfect sphere aswell...)
Attachment:
terrain1.jpg
terrain1.jpg [ 50.24 KiB | Viewed 10305 times ]

Terrain with some grass and trees (still allot of performance things to be done here, currently there is no lods or billboards being used, and viewdistance of grass not limited (goes as far as the terrain goes. Still, performance seems ok :P)
Attachment:
grass1.jpg
grass1.jpg [ 90.95 KiB | Viewed 10305 times ]

Some water, which was more tricky to implement then initially thought about, since you cant really extract only the water surface.
Attachment:
water3.jpg
water3.jpg [ 66.62 KiB | Viewed 10305 times ]


And a vid of me flying\walking through it
http://www.youtube.com/watch?v=qs_U-hCiKo0



---
One thing to david, I've made a minor change in the MarchingCubesSurfaceExtractor which seemed more logical to me. Which is changing
Code:
typename Controller::MaterialType uMaterial = (std::max)(uMaterial000, uMaterial100);

to
Code:
const typename Controller::MaterialType uMaterial = m_controller.convertToDensity(v000) > m_controller.convertToDensity(v100) ? uMaterial000 : uMaterial100;

Because density is always present in marching cubes doesn't it make more sense to have a higher density have more influence over the material displayed? (I changed this because 0 density material was showing which made no sense to me)
Unless I'm missing something why this wouldn't make more sense?

--
Also, I'm 99% sure there is a memory leak in largevolume when you turn off compression. I haven't looked much into the reason behind it, but my memory skyrockets when turning it off. Especially with a very low max loaded block amount.

Author:  holocronweaver [ Thu Feb 21, 2013 5:22 am ]
Post subject:  Re: [WIP project] Using polyvox marching cubes and ogre

Very nice! How did you go about breaking the terrain up into multiple LargeVolumes? How are they positioned relative to one another?
BTW, love the blue fashlight proximity lighting effect.

Author:  David Williams [ Thu Feb 21, 2013 10:20 am ]
Post subject:  Re: [WIP project] Using polyvox marching cubes and ogre

Very nice, it looks like you've got a decent size terrain complete with lighting and shadowing.

Just two days ago I started working on threading in Cubiquity. At the moment I'm using SimpleVolume because it's easier from multiple threads, but I intend to switch over to LargeVolume in the coming weeks. I expect to be starting some discussions on paging and threading issues so watch out for that.

Sarcen wrote:
One thing to david, I've made a minor change in the MarchingCubesSurfaceExtractor which seemed more logical to me. Which is changing
Code:
typename Controller::MaterialType uMaterial = (std::max)(uMaterial000, uMaterial100);

to
Code:
const typename Controller::MaterialType uMaterial = m_controller.convertToDensity(v000) > m_controller.convertToDensity(v100) ? uMaterial000 : uMaterial100;

Because density is always present in marching cubes doesn't it make more sense to have a higher density have more influence over the material displayed?


That probably does make sense, but actually I've gone a step further in the Cubiquity branch of PolyVox and allowed the user to provide a blending function as part of the Controller. See here:

https://bitbucket.org/volumesoffun/poly ... ion#cl-457

Using this you could implement the behaviour you describe but also other approches.

Sarcen wrote:
Also, I'm 99% sure there is a memory leak in largevolume when you turn off compression. I haven't looked much into the reason behind it, but my memory skyrockets when turning it off. Especially with a very low max loaded block amount.


This may be true, but the LargeVolume is the part of PolyVox which is getting the most attention at the moment so hopefully this gets fixed with the on going changes. I've implemented plugable compression support (supporting zlib and RLE), and am also wondering whether it should be impossible to disable compression as this might simplify the code. Again I will create a discussion or issue for this soon.

Author:  Sarcen [ Sat Feb 23, 2013 5:03 am ]
Post subject:  Re: [WIP project] Using polyvox marching cubes and ogre

Quote:
That probably does make sense, but actually I've gone a step further in the Cubiquity branch of PolyVox and allowed the user to provide a blending function as part of the Controller. See here:

https://bitbucket.org/volumesoffun/poly ... ion#cl-457

I see the code is as follows now:
Code:
const typename Controller::MaterialType uMaterial = m_controller.blendMaterials(uMaterial000, uMaterial100, fInterp);

Shouldn't this be,
Code:
const typename Controller::MaterialType uMaterial = m_controller.blendMaterials(v000, v100, fInterp);

then, so you still have access to the rest of the voxel? because my implementation wouldn't be possible with just materials.

Author:  David Williams [ Sat Feb 23, 2013 7:43 am ]
Post subject:  Re: [WIP project] Using polyvox marching cubes and ogre

Ah, yes, that is a bit more flexible. I've added this to the Cubiquity bug tracker (which isn't public I'm afraid) so it will get changed in the Cubiquity branch of PolyVox and eventually merged back into the main branch.

Author:  xelons [ Mon Mar 04, 2013 9:08 pm ]
Post subject:  Re: [WIP project] Using polyvox marching cubes and ogre

Pretty nice, would you mind telling us a little bit about your lighting model? are you using a lighting method similar to minecraft? Like calculating the lighting levels of each voxel at the volume generation?

Author:  Sarcen [ Tue Mar 05, 2013 6:24 am ]
Post subject:  Re: [WIP project] Using polyvox marching cubes and ogre

xelons wrote:
Pretty nice, would you mind telling us a little bit about your lighting model? are you using a lighting method similar to minecraft? Like calculating the lighting levels of each voxel at the volume generation?


Nope, at the moment its just one directional light with cascaded shadow mapping and deferred lightning for the point lights. Its far from finished, still more work to be done there. I have considered it tho, because at the moment i don't have any good global illumination, the area under a terrain overhang is just as black as the one deep underground.

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/