PIXELBANKv9.1.0
Menu

Recover Albedo from Normal

Recover surface albedo given known surface normal and light observation.

From the Lambertian equation: I=ฯโ‹…(nโ‹…l)I = \rho \cdot (\mathbf{n} \cdot \mathbf{l})

where:

  • II is the observed intensity
  • ฯ\rho is the surface albedo (reflectance)
  • n\mathbf{n} is the unit surface normal vector
  • l\mathbf{l} is the unit light direction vector

We can solve for albedo: ฯ=Inโ‹…l\rho = \frac{I}{\mathbf{n} \cdot \mathbf{l}}

This is only valid when nโ‹…l>0\mathbf{n} \cdot \mathbf{l} > 0 (the surface faces the light). For backlit surfaces where the dot product is zero or negative, albedo cannot be recovered from that observation.

In practice, we average albedo estimates from multiple light sources for robustness.

Example:

Input:
recover_albedo(0.4, [0, 0, 1], [0, 0, 1])
Output:
0.4
Reasoning:

Normal parallel to light: dot(n, l) = 1.0

  • albedo = 0.4 / 1.0 = 0.4
  • When nยทl = 1, intensity equals albedo.

Constraints:

  • intensity: observed intensity
  • normal: surface normal [nx, ny, nz]
  • light_dir: light direction [lx, ly, lz]
  • Return albedo rounded to 4 decimal places, or 0 if dot product โ‰ค 0
๐Ÿ”’

Editor locked

The code editor is locked for Pro problems. It is only available for free problems. Please upgrade to gain access to the code editor for all problems.

solution.py

Test Results

0/0
Run code to see test results.
Recover Albedo from Normal - Easy | PixelBank