Comments (4)
Interestingly, this fixes a number of errors in other scenes that use normal mapping; compare the curb, bistro glass doors, and menu to the left of the doors.
from pbrt-v4.
Very interesting. Thanks for reporting this!
The underlying issue comes from pbrt being a little weird in how it handles shading normals: it wants to have surface partial derivatives that, when you take their cross product, you get the desired shading normal. Then the way it handles normal maps is a bit unusual as well: by the time the normal map is evaluated, we no longer have access to the full object space->rendering space transformation, which would be nice to have around to bring the normal map's object-space normal into rendering space...
For this case, the problem comes from this line in src/pbrt/materials.h
:
Line 98 in 425faa0
It constructs a coordinate frame about the pre-normal mapped shading normal and then calls
Frame::FromLocal()
to bring the normal mapped shading normal out of the tangent space coordinate system (with the normal aligned with (0,0,1)) into rendering space. The problem is that FromZ
chooses arbitrary basis vectors for x and y, while we'd like at least x to be aligned with (1,0,0) in tangent space.
Sooooo..... Replacing that line with:
Frame frame = Frame::FromXZ(Normalize(ctx.shading.dpdu), Vector3f(ctx.shading.n));
gives this image:
which is at least consistent regardless of the rotations, though it doesn't match blender.
I'm not sure what the discrepancy is (pbrt being left handed and blender right-handed?) and would like to figure that out, but will at least check in that fix after testing it with more scenes.
from pbrt-v4.
I can tested on Blender since I have a full operative plugin. BTW.. in Blender, Z is up
from pbrt-v4.
Hello, thank you for your reply, the updated line works just fine now :)
No need to look deeper into the light orientation, the blender cycles render was a way to highlight the normal map bug.
I'm closing the issue, thanks !
from pbrt-v4.
Related Issues (20)
- Request: support light source definition via IES data HOT 1
- using --pixelstats in conjunction with --outfile do not work as expected
- Specify Volume with Transform and Camera Inside Volume in a Scene File
- PBRT hangs while rendering certain scenes with subsurface materials from a certain sample rate and higher
- Spectral range in SpectralFilm is overruled by constants in spectrum.h
- [Ubuntu] Unable to build TEV; uintptr_t not declared in scope.
- Apple M3 raytracing acceleration HOT 4
- Illegal memory was encountered when mixed textures are used.
- build pbrt in Windows with CUDA errors HOT 3
- Denoiser not being initialized for OptiX 8.0.0
- GPU compiling error with -DPBRT_FLOAT_AS_DOUBLE HOT 1
- Periodic Radiance Values for Spectral Render
- spectrum.h not defined in the pbrt/base
- gpu runs failing: Invalid PTX input HOT 1
- Build issue vs 2022 cuda 12.5 optix 7.7 win 11 HOT 3
- Final image is black when using GPU HOT 2
- GPU rendering not working with MSCV Version 14.40 and newer
- A question about CUDA constant memory initialization. HOT 1
- Trouble replicating Radiance results with diffusive materials HOT 2
- Compiling Error aggregate.cpp with optix7 and NVCC 12.5 and GCC 11.4 in Ubuntu 22.04 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pbrt-v4.