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

What am I doing wrong with these.... normals?
http://www.volumesoffun.com/phpBB3/viewtopic.php?f=14&t=598
Page 1 of 2

Author:  petersvp [ Mon Jul 14, 2014 9:28 pm ]
Post subject:  What am I doing wrong with these.... normals?

What is actually going here?
How can I get rid of these artifacts?

Attachment:
Clipboard01.jpg
Clipboard01.jpg [ 197.27 KiB | Viewed 5566 times ]

Attachment:
Clipboard02.jpg
Clipboard02.jpg [ 243.58 KiB | Viewed 5566 times ]

Attachment:
Clipboard03.jpg
Clipboard03.jpg [ 225.52 KiB | Viewed 5566 times ]


There is the shader:
http://sourceforge.net/p/kitten-platform/code/108/tree/trunk/game-wd/smooth.cg

Author:  David Williams [ Tue Jul 15, 2014 8:26 am ]
Post subject:  Re: What am I doing wrong with these.... normals?

It's hard to say exactly... you'll need to use some debugging tricks. For example, is it really the normals which are the problem? How does it look if you write the normals out as colours?

Also, what happens if you look at just one of the textures at a time? Is it always the same one which is stretched or do they all have that problem? Or what if you write out texture coordinates as colours - does this show you anything?

Author:  petersvp [ Tue Jul 15, 2014 8:35 am ]
Post subject:  Re: What am I doing wrong with these.... normals?

They all have this stretch problem.
I have no idea what and why. I will post a screen shot of normals as colors... Also I'm not sure that problem comes from normals.

The problem is only seen on SOME perfectly horizontal or perfectly vertical planes and not all.

Author:  David Williams [ Tue Jul 15, 2014 11:35 am ]
Post subject:  Re: What am I doing wrong with these.... normals?

This line looks odd:
Code:
float4 c1 = float4(VertexNormal.x, VertexNormal.x, VertexNormal.x, 1) * 0.5 + 1;

Did you really mean to use the .x component three times?

Author:  petersvp [ Tue Jul 15, 2014 3:52 pm ]
Post subject:  Re: What am I doing wrong with these.... normals?

Yes. This is only a directional light so terrain looks more 3Dish. Without this line there is no lighting and still have artifacts :)

Author:  David Williams [ Wed Jul 16, 2014 8:52 am ]
Post subject:  Re: What am I doing wrong with these.... normals?

Ok, then I think you're going to need to visualize your normals and/or texture coordinates to see what's going on, and also try just applying a single texture at a time.

Author:  petersvp [ Wed Jul 16, 2014 9:43 am ]
Post subject:  Re: What am I doing wrong with these.... normals?

The splatting code is perfect.

... and when I smoothed the density field with convolution kernel filter (own implementation), the "bleeding" has gone.

Author:  David Williams [ Fri Jul 18, 2014 9:06 am ]
Post subject:  Re: What am I doing wrong with these.... normals?

petersvp wrote:
and when I smoothed the density field with convolution kernel filter (own implementation), the "bleeding" has gone.


Then it does sound like it could be a problem with the normals, but you'd still need to visualize it to really understand what is going on. PolyVox uses a central-difference method by default which can fail in certain situations. For example, I think that if you have voxels in a checkerboard pattern then it will have issues. I now know you actually have a binary volume, and I'm sure this will make computing normals from the volume data more difficult.

Of course, you don't have to use the provided normals, you could instead compute then yourself from the surrounding faces.

Author:  TheSHEEEP [ Mon Jan 19, 2015 1:21 pm ]
Post subject:  Re: What am I doing wrong with these.... normals?

Hey, as our projects seem to be somewhat similar concerning terrain graphics, I wondered if or how you resolved this problem :)

I guess it could be resolved by manually fixing the normals the extractor outputs before creating an engine mesh out of it, but that would be very performance heavy.

Author:  petersvp [ Mon Jan 19, 2015 2:22 pm ]
Post subject:  Re: What am I doing wrong with these.... normals?

I never resolved it :D I left them as is. smoothing the volume with custom low-pass filter made these artefacts not sooo noticeable. Also, I played with these hardcoded values in my shader.

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