It is currently Wed Nov 20, 2019 4:00 am


All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: CubicSurfaceExtractor + keep corner vertices separated
PostPosted: Fri May 29, 2015 7:17 pm 

Joined: Wed Jul 23, 2014 7:54 pm
Posts: 7
Hey there.

I am currently trying to use CubicSurfaceExtractor, and the fact that I can't pre-generate normals has been daunting so far. I'm trying to do it in the shader the way it's suggested:

float3 worldNormal = cross(ddy(inWorldPosition.xyz), ddx(inWorldPosition.xyz));
worldNormal = normalize(worldNormal);

But that is not perfect, and a straight wall that is made from, say, 3 rectangles is not lit consistently (one of the quads will be brighter, for example).

Is there a way to prevent CubicSurfaceExtractor from merging corner vertices? That way I could simply generate vertices the good old way and have consistant lighting.

Cheers.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: CubicSurfaceExtractor + keep corner vertices separated
PostPosted: Fri May 29, 2015 8:10 pm 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
kamac wrote:
But that is not perfect, and a straight wall that is made from, say, 3 rectangles is not lit consistently (one of the quads will be brighter, for example).


Can you elaborate on why this is a problem, and or show a picture? We use this approach in Cubiquity without any problems.

kamac wrote:
Is there a way to prevent CubicSurfaceExtractor from merging corner vertices? That way I could simply generate vertices the good old way and have consistant lighting.


There is no method of doing this, but I guess you could take the generated mesh and then split it up in your own code. You'll need to calculate you own normals though as the CubicSurfaceExtractor doesn't generate any.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: CubicSurfaceExtractor + keep corner vertices separated
PostPosted: Fri May 29, 2015 9:23 pm 

Joined: Wed Jul 23, 2014 7:54 pm
Posts: 7
Well, I'm basically using it with unity 5 physically based shading, which is smooth, not flat and that probably causes the lighting errors.

Nevermind me though. For my purpose (simple, colored voxels) it was just better & easier to write the thing using internet resources myself (it's just 130 lines anyway).

Polyvox seems like a good idea as long as you don't want optimized, colored voxels :S (for everything else it's very nice)


Top
Offline Profile  
Reply with quote  
 Post subject: Re: CubicSurfaceExtractor + keep corner vertices separated
PostPosted: Mon Nov 09, 2015 4:49 pm 
User avatar

Joined: Sun May 18, 2014 10:52 pm
Posts: 43
kamac wrote:
Polyvox seems like a good idea as long as you don't want optimized, colored voxels :S (for everything else it's very nice)


Clearly I've got a better grasp on shaders than you do, I've been coding them for 1 day.

I thought I had the same problem with texturing, however you're doing this for lighting, so I'm not so sure I can help you with the code, but I assure you it can be corrected. It's probably related to the way you're handling the texture.

Perhaps this post sheds some light on the subject? (no pun in ten did)

viewtopic.php?f=14&t=659

particularly have a look at the bugs I discuss there, could be related?


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 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