Essential insights from Hacker News discussions

Physically based rendering from first principles

This discussion covers a range of topics related to a web article explaining rendering concepts, with a particular focus on the interpretation and application of "first principles" in scientific and technical explanations, as well as the technical implementation and user experience of the article itself.

Cross-Browser and Cross-Device Compatibility

A recurring theme is the inconsistent rendering of the article's interactive elements across different browsers and operating systems. While some users reported success, others encountered issues, particularly on Firefox for Android.

  • "Webpage doesn't work in Firefox/Android." - amelius
  • "Chrome seems to function, at first glance." - all2
  • "Seems fine on Firefox on Mac" - godelski
  • "Can confirm, latest Firefox on S24 doesn't render the interactive elements. Chrome does, however, and it's a beautiful article." - danielbln
  • "Android Chrome on Pixel 7a. None of the interactive demos show up. Just blank white." - Eduard

The Concept and Misuse of "First Principles"

A significant portion of the discussion revolves around the concept of "first principles," its meaning in scientific contexts, and how it's often misused, particularly in popular discourse. Godwin, a prominent voice on this topic, argues that starting from true first principles can be overly pedantic and overwhelming for learners, and that even physicists are still searching for fundamental first principles.

  • "I'm not a fan of how people talk about "first principles" as I think it just leads to lots of confusion. It's a phrase common in computer science that makes many other scientific communities cringe. First principles are things that cannot be reduced and you have to have very good justifications for these axioms." - godelski
  • "In fact, I'd like to argue that you shouldn't learn things from first principles, at least in the beginning. Despite the article not being from first principles, it does illustrate some of the problems of first principles: they are pedantic. Everything stems from first principles so they have to be overly pedantic and precise. Errors compound so a small error in one's first principles becomes enormous by the time you look at what you're actually interested in." - godelski
  • "The author went down to the electromagnetic wave theory of light. How much more ā€œfirst principlesā€ could this article be!?" - jiggawatts
  • "I think you've answered your own question and demonstrated my point. See my third sentence. The notion of "more 'first principles' is like asking who's before the first person in line. If there's more people in front, then they aren't the first person in line and if there aren't, well you're right, how can you be more first? But I think we both know this isn't the start of the line..." - godelski
  • "I think Musk was the first person I noticed to really abuse this phrase. Not that it's not a useful phrase—of course it is. But it seems like it's an abuse of what should be called "core agreed assumptions" or something." - MangoToupe
  • "It isn't just computer science people that do this, either. My gut is it was a common thing in MBA style classes as a way to approach a topic in a field you are not expert in. Specifically, it is common among management talkers, from my experience." - taeric
  • "I think the phrase "first principles" mentioned I'm safe in expecting something that is very high level to follow. I'm glad nerds have (kinda) been pushed into celebrity status but I also think there's a lot of cargo culting that has followed." - godelski
  • "All models are wrong, but some models are useful, right? I'm a big fan of this phrase so much because I think it helps us remember that it's okay to be wrong." - godelski

Depth of Physics Explanation and Physical Realism in PBR

Users debated the appropriate level of physics knowledge required for the article and the author's depth of understanding. There was a discussion about what a true "first principles" explanation of Physically Based Rendering (PBR) would entail, with a consensus that it would delve into quantum mechanics and solid-state physics. The author also responded to these criticisms, defending their choices and clarifying their intent.

  • "What makes it clear that the author isn't a physicist is that they don't appear to understand the underlying emergent phenomena[0]. It's probably a big part of why this post feels so disordered. All the phenomena they discussed are the same, but you need to keep digging deeper to find that (there's points where even physicists know they are the same but not how or why). It just feels like they are showing off their physics knowledge, but it is well below that which is found in an undergraduate physics degree[1]." - godelski
  • "But as someone who's done a fair amount of physical based rendering, I'm just uncertain what this post has to do with it. I would highly recommend the book "Physically Based Rendering: From Theory To Implementation" by Pharr, Jakob, and Humphreys that the author says the post is based on. It does a much better job at introducing the goals and focusing on getting the reader up to speed." - godelski
  • "Let's suppose the aim of the article was indeed to learn PBR from first principles, what would it look like? Quantum electrodynamics?" - imadr
  • "A truly from-first-principles treatment of photon-surface interactions would involve an extremely deep dive into quantum numbers, molecular orbitals, solid state physics and crystal lattices (which are metals), including a discussion about how electron waves superpose to produce various conduction/valence bands with various band gaps, and then discuss how photons interact with these bands." - delta_p_delta_x
  • "You couldn't have been any closer. I emerged feeling extremely stupid after doing physics at uni. My rather mediocre marks didn't help..." - delta_p_delta_x
  • "The raw mathematics isn't the hardest; most of this is settled by the end of the second year of undergraduate physics—things like Taylor series, ODEs, PDEs, special functions, a bit of linear algebra (no proofs needed, just use the results); perhaps complex analysis which leads to Fourier transforms and all. Maybe a treatment of tensors. The issue is the sheer complexity of micro systems, and the unintuitive nature of going deeper than 'EM wave reflects off electrons'." - delta_p_delta_x
  • "But I'd like to argue that you shouldn't learn things from first principles, at least in the beginning. ... Everything stems from first principles so they have to be overly pedantic and precise. Errors compound so a small error in one's first principles becomes enormous by the time you look at what you're actually interested in." - godelski
  • "I dislike "Physically Based Rendering: From Theory To Implementation", I personally think that the literate programming approach of the book is way too confusing and disorganized. I prefer the SIGGRAPH talk by Naty Hoffman[0]" - imadr
  • "I agree with OP and find the literal programming in that book incredibly distracting and annoying. I prefer the theory up front and the code later. "Ray Tracing From the Ground Up" does a much better job in my opinion (although it also only covers a fraction of the topics in the PBR book.)" - grg0
  • "Well given the title I at least expected the article to explain or derive things like why and how metals and their alloys have the color (wavelenght-dependent complex index of refraction) that they do, why and how say quartz crystals have different colors, birefringence, fluorescence (makes T-shirts appear extra bright) etc." - magicalhippo
  • "There have been decades of research into generalized BRDF measurement of real materials. Usually it starts with capturing calibrated images of the combination of all camera angles and all lighting angles on the hemisphere. [links to measurement devices]" - corysama

Article Structure, Clarity, and Author's Voice

The author received both praise for their effort and constructive criticism regarding the organization and clarity of the article. The discussion also touched upon the challenge of finding one's voice as a writer and teacher.

  • "Love the attention to details,the read is seamless" - sabellito
  • "I developed this article on firefox desktop and tested it on safari ios, and here I was thinking my testing was exhaustive! I just hope it’s not some obscure webgl bug on android. Anyways thanks for the feedback I’ll look into it" - imadr
  • "I'm being critical but I want them to know to keep it up, but that I think it needs refinement. Finding the voice of a series of posts can be quite hard and don't let stumbles in the beginning prevent you from continuing." - godelski
  • "First, tell "them" what you're going to tell them, then tell them, then tell them what you told them. It's dumb, but it helps. This is your intro, it is your hook. I think there's places for these ideas but early on they almost feel disconnected. This is really hard to get right and way too easy to overthink." - godelski
  • "I wrote this article in part because I got inspired by the "What I cannot create, I do not understand" quote by Feynman." - imadr
  • "But at your stage it means you have an advantage, that the topics you are struggling with and have overcome are much more fresh. When learning things we often learn from multiple sources (you yourself shared overlapping material), and that's because multiple perspectives give us lots of benefits. But at this point, don't try to be a physicist. If you want to work towards that direction, great! If you don't, that's okay too. But let your voice speak from where you are now." - godelski
  • "I really like the interactive elements and animations." - prathje
  • "Love the detailed interactive visual explanations, https://samwho.dev/ is another one like Ciechanow.ski" - smusamashah

Technical Implementation and User Experience of Interactivity

There was a specific discussion about how the interactive elements were implemented and the challenges faced. The author shared details about their custom JavaScript and WebGL implementation, acknowledging its disorganization but also highlighting the benefits of a ground-up approach.

  • "How was the interactivity achieved? Could you maybe link to the source so I can learn? I have been trying to get something like this working with quarto, but it is getting way too complicated." - jupitr
  • "I wrote everything from scratch in javascript and webgl. You can check the entire source code of the article here: https://imadr.me/pbr/main.js. Beaware though, it's a 8000+ lines of code js file that is very badly organized, it's by no mean a reference for good quality code." - imadr
  • "However I find writing everything by hand easier in the long term than using already existing libraries for example. The code includes all the math functions, mesh primitive generation, shaders and even a sketchy text renderer using sdf fonts. If I had to make it again I would use typescript, type errors were the biggest source of bugs." - imadr

Data-Driven Approaches vs. First Principles in PBR

The conversation extended to the role of empirical data and real-world measurements in developing and validating PBR models, prompting a discussion on the merits of data-driven approaches compared to theoretical derivations.

  • "Are there any data driven approaches to physically based rendering? Can't we measure micro-facet depth and angle distribution of real world materials using laser speckle and use it to inform the normal distribution function? Deriving ideals from first principles is great and all, but verifying them against real world measurements seems like the bare minimum." - kelseyfrog
  • "If i’m not mistaken that’s in part how they came up with micro facet models, or at least to verify their accuracy. Take this paper for example [link to paper]. Real life measures are also useful for inverse rendering." - imadr
  • "It looks like a good model for lower incident angles but begins to diverse at higher angles. There's also one huge caveat - it relates the GGX model to real world ground glass. Obviously it's important to compare like to like. However, very few materials in the real world are ground glass. Looking around my surroundings, I see painted drywall, wood, paper, plastics, and textiles. It would seemingly be a mistake to assume each of these materials behaved optically like ground glass. I hope that similar measurements are carried out on other materials." - kelseyfrog
  • "The same Cornell group has done more research in this area. Here is one for capturing the microgeometry of metals [link]. Here's another paper from a different group on capturing the microgeometry using a lot of LED lights [link]." - tzumaoli