normal_map_shade — GFX2D light op

• Data kinds: normalmap → rgb

• Call: import fullseye as fs; fs.ledger.normal_map_shade(normals, light_dir=(0.0, 0.0, 1.0), ambient=0.1, diffuse='reference', specular=0.0, shininess=32.0, view_dir=(0.0, 0.0, 1.0), scheme='okabe_ito') (implementation को सीधे call करना हो तो import gfx2d; gfx2d.normal_map_shade(normals, light_dir=(0.0, 0.0, 1.0), ambient=0.1, diffuse='reference', specular=0.0, shininess=32.0, view_dir=(0.0, 0.0, 1.0), scheme='okabe_ito'), registry से लेना हो तो opsgfx2d.get("normal_map_shade"))

उपयोग

2-D normal map को एक directional light से shade करता है (Lambert + Blinn 1977)।

> नीचे का विस्तृत विवरण मूल text में है — सारांश और headings का अनुवाद हो चुका है।

normals is a normalmap: (H, W, 3) unit vectors, as normal_map_decode returns. Non-unit input raises rather than being normalised for you — a normal map that is not normalised is usually a map that was never decoded, and quietly fixing it hides the mistake.

out = diffuse * (ambient + max(n·l, 0)) + specular * max(n·h, 0)^shininess with h the normalised halfway vector between light and view.

Directions are (x, y, z) with +x right, +y down, +z out of the screen — the same handedness as the pixel grid, so a light at (0, -1, 1) comes from above the screen. Getting the sign of y wrong flips the perceived relief (bumps become dents) without raising anything; that is the one thing to check on first render.

संदर्भ (sample data, साहित्य)

• Sample data catalog (DL URL / license) — 2-D के लिए skimage.data (BSD/public) + synthetic, 3-D के लिए real data sources (Stanford/PDS आदि) के DL URL।

• Operators का स्रोत और संदर्भ — इस op family के मूल research/methods के स्रोत।

• Algorithm का मानक स्रोत (लेखक, वर्ष) और उपयोग ऊपर की family usage guide में दिए गए हैं।

चलाए जा सकने वाले उदाहरण (verified samples जो सच में यह op call करते हैं)

• gfx2d_scene — py -3.11 examples/gfx2d_scene.py

वे अगले ops जिनसे type जुड़ता है (rgb को input के रूप में लेते हैं)

srgb_to_linear · linear_to_srgb · blend_mode · light_mask · normal_map_decode · bloom · vignette · chromatic_aberration

इसी category के (light)

radial_light · light_mask · normal_map_decode · shadow_cast_2d


*Provenance: gfx2d.py — GFX2D operator registry. यह per-op note tools/opdocs.py md से अपने-आप generate होता है (हाथ से edit न करें)।*

© 2026 Kazufumi Furuse — Fullseye operator documentation. Licensed under Apache-2.0.