mmp / pbrt-v3

Source code for pbrt, the renderer described in the third edition of "Physically Based Rendering: From Theory To Implementation", by Matt Pharr, Wenzel Jakob, and Greg Humphreys.
http://pbrt.org
BSD 2-Clause "Simplified" License
4.86k stars 1.18k forks source link

Cloth Material - Incorrect Texture Values #311

Closed namedtoaster closed 2 years ago

namedtoaster commented 2 years ago

I am doing one of the exercises from the book and trying to implement a cloth material using a BTF as described by https://cg.cs.uni-bonn.de/aigaion2root/attachments/sattler-2003-efficient.pdf

I have created a new cloth material which allocates a new BTF as part of the ComputerScatteringFunction instance of the cloth material. Inside reflection.cpp, the f method of the BTF loads the correct BTF texture sample based on the incoming and outgoing ray directions.

I am just testing with a simple plane right now, but I am getting weird results. I am not sure how to proceed. Any thoughts?

image

mmp commented 2 years ago

It's unlikely that this is a pbrt bug.. One suggestion would be to add enough printing/logging statements to understand what is happening differently in that dark patch vs pixels right next to it. i.e. if you render a single pixel image in the dark region (e.g. using --cropwindow) and then one a few pixels away where it's lighter, it may become clear why it's behaving so differently even though it, presumably, shouldn't be...

namedtoaster commented 2 years ago

Thanks @mmp. I determined it was because of how I calculated which BTF to load. Got it working now, thanks 👍