Bump mapping/computing normal derivatives

Starting easy.
Post Reply
olliej
Posts: 13
Joined: Fri Aug 08, 2014 9:03 pm

Bump mapping/computing normal derivatives

Post by olliej » Thu Feb 21, 2019 8:10 am

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)

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.

olliej
Posts: 13
Joined: Fri Aug 08, 2014 9:03 pm

Re: Bump mapping/computing normal derivatives

Post by olliej » Thu Feb 21, 2019 7:07 pm

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)

Post Reply