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

CubicSurfaceExtractor + keep corner vertices separated
http://www.volumesoffun.com/phpBB3/viewtopic.php?f=14&t=640
Page 1 of 1

Author:  kamac [ Fri May 29, 2015 7:17 pm ]
Post subject:  CubicSurfaceExtractor + keep corner vertices separated

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.

Author:  David Williams [ Fri May 29, 2015 8:10 pm ]
Post subject:  Re: CubicSurfaceExtractor + keep corner vertices separated

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.

Author:  kamac [ Fri May 29, 2015 9:23 pm ]
Post subject:  Re: CubicSurfaceExtractor + keep corner vertices separated

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)

Author:  Midnight [ Mon Nov 09, 2015 4:49 pm ]
Post subject:  Re: CubicSurfaceExtractor + keep corner vertices separated

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?

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