dilevin / computer-graphics-shader-pipeline

Computer Graphics Assignment about the Shader Pipeline
2 stars 5 forks source link

bump map artifacts #63

Open AlekseyPanas opened 8 months ago

AlekseyPanas commented 8 months ago

My bump map normals seem to be acting very strange:

image

Here is the noise I am using:

(smooth_heaviside(

    clamp((improved_perlin_noise(s*1.3) + improved_perlin_noise(s*2.5)) * 0.25, 0, 1), 

  50) + (improved_perlin_noise(s * 15) * 0.3)) * 0.1;

where s is the unit sphere point. Here is how the noise looks when draw onto the sphere, where green shows positive, black shows 0, and red shows negative output:

image

I multiplied the noise by 10, otherwise its very dim. The noise does not seem to reflect the unusual patches of weird normals. Those normals cause the dark side of the planet to light up, almost as if they are pointing opposite. I tried hardcoding some check if ensure the cross product wasn't bugging out, but it appears the normal is still point outward, just very sharply compared to the original. I am at a loss at this point and looking for suggestions

EDIT: Some additional digging led me to discover that a delta/epsilon of 0.1 for the finite difference calculation seems to fix the issue. A delta of 0.01 or less starts making the artifacts more an more noticeable right up until everything just breaks completely.

I also displayed the noise color onto the sphere with the tangent vector shifts, seeing what the noise looks like some small amount to the side. You would expect that the entire noise image would simple shift along the sphere in the tangent direction. It does this pretty much for delta = 0.1, but for delta=0.001, it keeps the same in most places except in the artifact locations it makes a drastic change:

image image image

If you look closely between the first two images, where the artifacts are there is a significant change in the noise, while the rest stays mostly the same (especially noticeable where a red patch completely disappears)

wenzhi-guo commented 8 months ago

It's really hard to tell from the images what's wrong exactly with your implementation, but a small delta for finite difference calculation shouldn't cause any issues. I can take a look at your implantation and try to identify some possible causes of the issue if you send us an e-mail.

AlekseyPanas commented 8 months ago

I figured it would be hard to tell the issue by just looking. I will save it for next office hours then