惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
Threatpost
博客园 - 叶小钗
T
The Blog of Author Tim Ferriss
Recent Announcements
Recent Announcements
D
DataBreaches.Net
The Cloudflare Blog
阮一峰的网络日志
阮一峰的网络日志
罗磊的独立博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
N
Netflix TechBlog - Medium
Microsoft Azure Blog
Microsoft Azure Blog
Microsoft Security Blog
Microsoft Security Blog
B
Blog
U
Unit 42
有赞技术团队
有赞技术团队
博客园 - 聂微东
GbyAI
GbyAI
宝玉的分享
宝玉的分享
F
Full Disclosure
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
MyScale Blog
MyScale Blog
Jina AI
Jina AI
Martin Fowler
Martin Fowler
IT之家
IT之家
酷 壳 – CoolShell
酷 壳 – CoolShell
D
Docker
P
Proofpoint News Feed
A
About on SuperTechFans
I
InfoQ
博客园 - 【当耐特】
C
Check Point Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
P
Privacy & Cybersecurity Law Blog
T
Threat Research - Cisco Blogs
Y
Y Combinator Blog
Project Zero
Project Zero
WordPress大学
WordPress大学
小众软件
小众软件
AWS News Blog
AWS News Blog
博客园 - 司徒正美
T
The Exploit Database - CXSecurity.com
L
LINUX DO - 热门话题
I
Intezer
Engineering at Meta
Engineering at Meta
C
CXSECURITY Database RSS Feed - CXSecurity.com
J
Java Code Geeks
T
Tenable Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Last Week in AI
Last Week in AI
C
CERT Recently Published Vulnerability Notes

Henri Sivonen’s pages

Parin vuoden tutkimattomuus crates.io: Rust Package Registry Asiakirjatonta toimintaa It’s not wrong that "🤦🏼‍♂️".length == 7 Koulutartuntojen tilastointimenettely Perusteasiakirjoja hallussapitämättä ikärajoitettu Asiantuntijat ja nukkuva vallan vahtikoira Koronapassilausunto Suppealla tietopohjalla ohimeneväksi väitetty Text Encoding Menu in 2021 The Text Encoding Submenu Is Gone An HTML5 Conformance Checker Not Part of the Technology Stack Browser Technology Stack Bogo-XML Declaration Returns to Gecko A Look at Encoding Detection and Encoding Menu Telemetry from Firefox 86 Why Supporting Unlabeled UTF-8 in HTML on the Web Would Be Problematic Rust Target Names Aren’t Passed to LLVM Toimintamalli Activating Browser Modes with Doctype Johtopäätöksiä mallin rakenteesta Tehtävänmäärittelyä kirjoittamatta ja kuolemia laskematta laumasuojamallinnettu Character Encoding Menu in 2014 Erillissuosituksen tarpeettomuudesta yleissuosituksen poikkeukseksi? STM:n maskiaikajana Rust 2021 Oma-aloitteisesti mallinnettu Kokopinovaatimuksin kilpailutettu chardetng: A More Compact Character Encoding Detector for the Legacy Web Varauksia paisutellen tiedotettu Perusteasiakirjoitta tiedotettu Always Use UTF-8 & Always Label Your HTML Saying So IME Smoke Testing The Validator.nu HTML Parser About the Hiragino Fonts with CSS It’s Time to Stop Adding New Features for Non-Unicode Execution Encodings in C++ Rust 2020 The Last of the Parsing Quirks About about:blank Rust 2019 a Web-Compatible Character Encoding Library in Rust How I Wrote a Modern C++ Library in Rust Using cargo-fuzz to Transfer Code Review of Simple Safe Code to Complex Code that Uses unsafe A Rust Crate that Also Quacks Like a Modern C++ Library #Rust2018 No Namespaces in JSON, Please A Lecture about HTML5 Julkisesti luotettu varmenne ikidomainille TLS:ää (SSL:ää) varten -webkit-HTML5 Lists in Attribute Values The Sad Story of PNG Gamma “Correction” If You Want Software Freedom on Phones, You Should Work on Firefox OS, Custom Hardware and Web App Self-Hostablility HTML5 Parser Improvements ARIA in HTML5 Integration: Document Conformance (Draft, Take Two) Schema.org and Pre-Existing Communities Lowering memory requirements by replacing Schematron HTML5 Parsing in Gecko: A Build Introducing SAX Tree NVDL Support in Validator.nu HOWTO Avoid Being Called a Bozo When Producing XML An Unofficial Q&A about the Discontinuation of the XHTML2 WG Thoughts on HTML5 Becoming a W3C Recommendation Four Finnish Banks Training Users to Give Banking Credentials to Another Site Unimpressed by Leopard Sergeant Semantics The Content Sink Inheritance Diagram – 2006-06-30 What is EME? About Points and Pixels as Units The Performance Cost of the HTML Tree Builder Social Media Impression Management The spacer Element Is Gone Openmind 2006 Performance Mistake XHTML and Mobile Devices WebM-Enabled Browser Usage Share Exceeds H.264-Enabled Browser Usage Share on Desktop (in StatCounter Numbers) HTML5 Parser-Based View Source Syntax Highlighting Vendor Prefixes Are Hurting the Web Accept-Charset Is No More Dualroids Writing Structural Stylable Document in Mozilla Editor ISO-8859-15 on haitallinen Hourglass The Scientific Method According to Hixie Maemo Source Code Karpelan lukkovertaus ontuu Digitaalisesta arkistoinnista ARIA in HTML5 Integration: Document Conformance (Draft) XHTML—What’s the Point? (Draft, incomplete) Mac OS X Browser Comparison HOWTO Spot a Wannabe Web Standards Advocate An Idea About Intermediate Language Trees and Web UI Generation Thoughts on Using SSL/TLS Certificates as the Solution to Phishing Bureaucracy Meets the Web Europe Day HOWTO Establish a 100% Literacy Rate What to Do with All These Photos? Charmod Norm Checking Validator Web Service Interface Ideas DTDs Don’t Work on the Web EFFI’s Day in Court
Imitating Reflective Caustics in POV-Ray
Henri Sivonen · 2011-12-22 · via Henri Sivonen’s pages

Every now and then there is a question on comp.graphics.rendering.raytracing about light beams not reflecting from mirrors. So why don't light beams reflect off mirrors and what to do to make them appear as if they did?

Note: This page describes one workaround for a special case when using the official distribution of POV-Ray. For a more complete solution, try photon mapping by Nathan Kopp in MegaPov.

Reflected spotlight

No reflectionWhen a spotlight is aimed at a nonreflective surface, everything looks correct. (Note: Strong media scattering used to make the light visible.)

Light not reflectingWhen the floor is turned reflective, mirror images of the objects and media above the floor plane become visible. However the light emitted by the spotlight doesn't reflect up from the floor and illuminate the wall.

This occurs because of the way POV works. If the direct (not reflected or refracted) lighting needs to be calculated at a given point, the ray tracer can check whether there are any obstacles on the segments of lines connecting the point and each of the light sources in the scene. If a ray of light doesn't get reflected or refracted, its passage from the light source to the lit surface is a segment of line.

Discovering the possible paths of reflected or refracted rays from a light source to a given point is not as straigthforward and is not implemented in POV, although POV provides a simplified implementation of refractive caustics that occur in the shadow cast by a refractive object. (See section 4.6.5 of the POV-Ray 3.1 documentation.)

Light coming through the floorThere is a way to work around this problem if the reflecting surface is planar and there is plenty of space behind it.

A ray of light doesn't carry information of its origin. When a ray of light reflected from a planar mirror is perceived, it appears as if it had come from a source behind the mirror. The unreal light source from where the rays appear to be coming is on the same normal line of the planar mirror as the real light source. Both are at the same distance from the mirror, but on different sides of the mirror.

So the solution is to place another light source at the point from where the reflected rays should come. The easiest way to do this is to place the mirroring surface on a plane refined by two of the coordinate axes. In this example the floor is on the xz-plane. Then making the secondary light source is only a matter of scaling the coordinates of the third axis by -1. In this case scale <1,-1,1>. (The picture shows only the mirrored light.)

Usually the mirror would block the light coming behind it. To let the light through the mirror object modifier no_shadow needs to be added to the definition of the object. The modifier no_shadow does not affect the object's ability of being lit or having shadows cast onto it. The modifier only prevents the object from blocking lighting rays. (Note: The light coming from below the floor does not illuminate visible side the floor plane.)

Both lightsNow the result looks like the light was reflected from the floor. The secondary light can be made less bright when the mirror is not supposed to be perfect. (Here the primary light is color rgb 1 and the secondary light is color rgb .5.)

Blocking the primary lightBut something is still wrong. If the primary light is blocked, the reflect light is unaffected.

Final The solution is make mirrored copies of the objects that may possibly block the light. It is easier to make copies of all the objects than to select only the ones that are needed. The copies of opaque objects don't need to have any texturing. They can be just as well have pigment{color rgb 0} to reduce parsing time.

What's really thereHere you can see how the scene works. As stated above, the easiest way is placing the mirror on a plane defined by two of the coordinate axes. If the mirror is located elsewhere objects can be rotated and translated so that the can be mirrored about such plane and then translated and rotated back. Alternatively a matrix can be used. (Matrices are out of the scope of this document.)

Here is an animation of the result (in the WebM format):

Related files

See also for answers to other very frequently asked POV related questions