Skip to content

Question about rendering normals with BSDF normalmap awareness #1261

Answered by saeedhd96
saeedhd96 asked this question in Q&A
Discussion options

You must be logged in to vote

Thanks to @tizian, the correct answer is:

class NormalIntegrator(mi.SamplingIntegrator):
    def sample(self: mi.SamplingIntegrator, scene: mi.Scene, sampler, ray: mi.RayDifferential3f, medium: mi.Medium = None, active: bool = True):
        si:mi.SurfaceInteraction3f = scene.ray_intersect(ray, mi.RayFlags.All, True, active)
        valid_ray = active & si.is_valid()
        result = mi.Spectrum(0)
        def frame(si, active):
            n = self.normal_map.eval_3(si, active) * 2 -1

            result = mi.Frame3f()
            result.n = dr.normalize(n)
            result.s = dr.normalize(result.n * dr.dot(result.n, si.dp_du) - si.dp_du)
            result.t = dr.cross(result.n, result.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by saeedhd96
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant