-
Notifications
You must be signed in to change notification settings - Fork 42
Description
Excellent writeup on this technique there Matt. I've really enjoyed working through it and building a few of my own using python. I'm running into one issue though and I'm curious what you think of it. There's no issue bringing in an image and getting the pixels sized based on the brightness, etc. Where I run into an issue is on generating the heightmap. The heights it generates seem to be not focusing the light at the distance I set. When looking at the code I'm curious if it needs to have provisions to take into account the change in x and y spacing of the pixels when calculating the divergence for the heightmap. As I see it the function findsurface() sets up a divergence based on the gradient of the surface needed to map uv locations to the original xy locations. But when you add the heightmap back in it wouldn't calculate the normals exactly right as you're uv locations are not constant.
The initial idea behind N_x and N_y calcs make sense. But once you've moved the lens grid around via marchmesh I don't believe the mapping of heights is actually accurate. From pixel to pixel the heights would not map to the same normals because the horizontal distances are not constant. Has anyone else noticed this?