It is currently Sat Aug 22, 2020 4:29 am


All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Problem with normals at edges of marching cubes mesh
PostPosted: Tue Mar 26, 2013 8:46 am 

Joined: Mon Mar 25, 2013 1:50 pm
Posts: 3
Hi,

I'm trying to generate a large landscape, but split it into chunks for rendering so I can have an unlimited landscape size. The problem I have is that when generating a mesh using the MarchingCubesSurfaceExtractor, the normals for the vertices at the edge of each chunk are incorrect.

For each chunk, I populate a SimpleVolume with values generated using a noise function, so I think the problem is that the surface generator doesn't have access to data outside the chunk and therefore can't produce the correct normal.

Actually, I've just spotted that I could generate a SimpleVolume which is slightly larger than the volume I want to generate, and then pass a slightly smaller volume to the MarchingCubesSurfaceExtractor, so I get neat edges.

I'll leave this question here in case I'm wrong - if I'm right I'll post back with screenshots :)


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Problem with normals at edges of marching cubes mesh
PostPosted: Tue Mar 26, 2013 9:54 am 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
Hi, actually this is a common problem - have a read of this entry in the documentation: http://www.volumesoffun.com/polyvox/doc ... aller-ones

Also, if you choose to continue with your current approach of using multiple SimpleVolumes then you might want to grab the version of PolyVox from Git Develop branch as this has support for setting the wrap mode for when you sample outside a volume. Setting this to 'clamp' might help in your case.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Problem with normals at edges of marching cubes mesh
PostPosted: Tue Mar 26, 2013 1:52 pm 

Joined: Mon Mar 25, 2013 1:50 pm
Posts: 3
Awesome, I switched my implementation over to using a LargeVolume and the seams are gone. Thanks for the documentation link, I'd actually already glanced over the docs and missed that - I'd been focussing on the page about lighting and normal.

Anyway, as promised here's a screenshot. I'm using Cinder as the rendering library which I'm really enjoying. I'll try to post some more information as I go along - I'm very impressed with Polyvox, I'd started cobbling together my own voxel engine before I found it so I appreciate how much time it's saved me :D


Attachments:
File comment: Landscape screenshot
260313_landscape.jpg
260313_landscape.jpg [ 30.71 KiB | Viewed 4166 times ]
Top
Offline Profile  
Reply with quote  
 Post subject: Re: Problem with normals at edges of marching cubes mesh
PostPosted: Tue Mar 26, 2013 8:09 pm 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
Looking good! That's a nice texture, and do you have some kind of AO/shadowing going on (the hole in the centre looks dark)?


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Problem with normals at edges of marching cubes mesh
PostPosted: Tue Mar 26, 2013 9:16 pm 

Joined: Mon Mar 25, 2013 1:50 pm
Posts: 3
I've just got a point light attached to the camera in that shot :) I'm using two textures, sand for the top and rock for the sides, planar mapped on and blended based on the normals.


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


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