It is currently Sat Aug 22, 2020 3:40 am


All times are UTC




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: [WIP project] Using polyvox marching cubes and ogre
PostPosted: Wed Feb 20, 2013 11:43 pm 

Joined: Sat Feb 09, 2013 10:30 pm
Posts: 3
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 10301 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 10301 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 10301 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.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: [WIP project] Using polyvox marching cubes and ogre
PostPosted: Thu Feb 21, 2013 5:22 am 
User avatar

Joined: Wed Feb 06, 2013 4:06 pm
Posts: 20
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.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: [WIP project] Using polyvox marching cubes and ogre
PostPosted: Thu Feb 21, 2013 10:20 am 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
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.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: [WIP project] Using polyvox marching cubes and ogre
PostPosted: Sat Feb 23, 2013 5:03 am 

Joined: Sat Feb 09, 2013 10:30 pm
Posts: 3
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.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: [WIP project] Using polyvox marching cubes and ogre
PostPosted: Sat Feb 23, 2013 7:43 am 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
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.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: [WIP project] Using polyvox marching cubes and ogre
PostPosted: Mon Mar 04, 2013 9:08 pm 

Joined: Wed Feb 29, 2012 12:35 am
Posts: 25
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?


Top
Offline Profile  
Reply with quote  
 Post subject: Re: [WIP project] Using polyvox marching cubes and ogre
PostPosted: Tue Mar 05, 2013 6:24 am 

Joined: Sat Feb 09, 2013 10:30 pm
Posts: 3
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.


Top
Offline Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Theme created StylerBB.net