(L) [2019/02/21] [ost
by olliej] [Bump mapping/computing normal derivatives] Wayback!I've been working on bump mapping in my RT (technically not my first, but definitely my first attempt to create an actually capable one). A lot of basic googling seems to imply the use of ray differentials, but I'm not sure I understand why that is necessary - obviously they have benefits for other purposes, but I'd like to understand the behavior of each individual part.
Anyway, I'm computing the standard dpdu/dpdv vectors on triangles analytically but I get the following crytek sponza scene (normals rendered as (normal + [1,1,1]) / 2)
[IMG #1 Image]
Now on the back wall, above the arch it is super obvious that the bump map is being inverted on one half. I can't work out why this is occurring, and wanted to know if my attempt to compute normal derivatives directly is flawed, and this is a symptom, or whether I've just got a bug in how I'm translating wavefront material/texture coord into the actual mapping of uv to bump map.
[IMG #1]:
(L) [2019/02/21] [ost
by olliej] [Bump mapping/computing normal derivatives] Wayback!And as is the nature of such posts, it made me think of a potential issue, and I discovered it computed inverted dpdu/dpdv for clockwise vs counterclockwise triangle definitions (I think w.r.t triangles with explicitly specified normals)