Closed CaffeineViking closed 5 years ago
Done! Estimated using a filtered version of finite differences. Below are some examples of the AO and normals.
float dx = filter(volume, P + vec3(epsilon, 0, 0)) - filter(volume, P + vec3(epsilon, 0, 0));
float dy = filter(volume, P + vec3(0, epsilon, 0)) - filter(volume, P + vec3(0, epsilon, 0));
float dz = filter(volume, P + vec3(0, 0, epsilon)) - filter(volume, P + vec3(0, 0, epsilon));
vec3 normal = normalize(vec3(dx, dy, dz)); // estimated point normal using finite differences
If we have some sort of SDF we can find the normal N by taking the gradient ∇S of the scalar field S. The idea is to do something similar with our volume, so we can find the normals of our contour. According to the Pixar paper, we should be able to get close to Kajiya-Kay without using the tangent, so it should be possible with a bit of trickery to find a shading model that follows the same highlights as Kajiya-Kay (actually the Kajiya-Kay model was meant to be used for volume rendering). "Volumetric Methods for Simulation and Rendering of Hair" is the Pixar paper. Maybe we can find the tangent by e.g
cross(N,V)
like in Scheuermann's shader?