For someone new, this was a really interesting read. Thanks for the effort. The picture of how the sky looks from underwater was so surprising to learn.
Regarding the 'first-principles' discussion, it is a relative term in usage despite the name. Explaining from a layer of abstraction below normal explanations.
Someone explaining how a computer works starting with machine instructions is doing first-priniciples, even if they wont explain details of atoms. The literal meaning would be almost impossible to implement, for instance none of Newton's work would be first principles given today's knowledge. Similarly, current physics can be subsumed in future 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. The reason the other scientific communities cringe is because either (most likely case) it's being used improperly and someone is about to demonstrate their nativity, or they know they're about to dive into a pedantic nightmare of nuances and they might never escape the rabbit holes that are about to follow.
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. Worst of all, it is usually subtle, making it difficult to find and catch. This makes them a terrible place to begin, even when one already has expertise and is discussing with another expert. But it definitely should not be the starting place for an expert to teach a non-expert.
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]. This is why you shouldn't start at first principles, its simplicity is too complex. You'd need to start with subjects more complicated than QED. The rest derive out of whatever a grand unified theory is.
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. In particular, they define how the goal of PBR is to make things indistinguishable from a real photograph, which is a subtle but important distinction from generating a real photograph.
That said, I still think there's nice things about this post and the author shouldn't feel ashamed. It looks like they put a lot of hard work in and there are some really nice animations. It's clear they learned a lot and many of the animations there are not as easy as they might appear. 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.
[1] In a degree you end up "learning physics" multiple times. Each time a bit deeper. By the end of an undergraduate degree every physicist should end up feeling like they know nothing about physics.
Thanks for the constructive criticism! A few points I'd like to discuss:
Let's suppose the aim of the article was indeed to learn PBR from first principles, what would it look like? Quantum electrodynamics?
I think there is merit in exploring different physical models for fun and scientific curiosity (like I mentioned in the first chapter).
I (personally) feel that it's boring to just dump equations like Snell's law without exploring the deeper meaning behind it. I also feel that it's easier to grasp if you have some surface knowledge about more complex physical models.
I agree however that I probably made many mistakes since I didn't study physics, I'd appreciate any feedback to improve that.
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]
Maybe I skimmed too much but Chapter 1 seemed mostly irrelevant to me. It'd be like taking a car mantainence class and them starting at atoms and how atoms work in metals and how metals are magnetic or whatever, before finally getting to things that car mechanics actually care about. Maybe that's helpful to some.
I know this is going to sound critical, but part of me wondered if this wasn't a vibe coded project. The visuals are impressive, but you can go ask gemini canvas to make them and it will. Here's an example
PS: you need to close the banner at the top I think in order to be able to see the roughness slider.
It needs a little TLC but it works. Even if they weren't vibe coded, I mostly wanted to pass on they probably can be, for anyone who might find that useful for making more articles like this. Even if they just get you started.
I wonder if part of the problem is that starting from electromagnetism doesn't necessarily lead naturally to classic PBR style raytracing; getting there requires fair amount of conceptual leaps, like going from waves to ray optics, or (usually) going from spectrums to rgb triplets. Many things in graphics rendering relies on scenes being well-behaved and relatively simple in a way that might not be obvious when coming from first principles.
It is also interesting to look what you can do if you make your rendering even more physically based. One example is wave_tracer which combines wave optics with path tracing to enable simulating wider range of phenomenons. They have nice theory writeup on their webpage:
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.
I think the idea is supposed to be to go back to the "first principals [that you would have been taught]." Which, yes, sometimes you will learn things that show these early teachings were wrong. Often, though, you can get far more mileage out of the naive models than people want to admit.
To that end, I think used judiciously, this has merit. Rarely does anything go against early teaching. It should lean on the specific assumptions and why they do or do not apply anymore, though.
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
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.
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.
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.
The discussion of the difference between metal and non-metal is a bit unclear. When he says that metal has no "diffuse reflection" but non-metals do, I think what he might mean is that metals have no subsurface scattering. Rough (not mirror-like) reflections do certainly also look "diffuse".
Yes, in rendering when we talk about “diffuse” reflection we implicitly mean fuzzy reflections due to light penetrating the material and exiting a small distance away from the entry point (less than a pixel far)
The term subsurface scattering is used for light that exits further away (more than a pixel) like in simulations of human skin
However that part of the article isn’t clear enough and warrants a rewrite
I really like the interactive elements and animations.
Small nit on the wording: "This continuous cycle enables self-sustaining, self-propagating electromagnetic waves"
The term “self-propagating” makes it sound like the fields are somehow pushing each other forward, but really they’re just coupled solutions of Maxwell’s equations.
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.
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.
enugu|6 months ago
Regarding the 'first-principles' discussion, it is a relative term in usage despite the name. Explaining from a layer of abstraction below normal explanations.
Someone explaining how a computer works starting with machine instructions is doing first-priniciples, even if they wont explain details of atoms. The literal meaning would be almost impossible to implement, for instance none of Newton's work would be first principles given today's knowledge. Similarly, current physics can be subsumed in future principles.
godelski|6 months ago
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. Worst of all, it is usually subtle, making it difficult to find and catch. This makes them a terrible place to begin, even when one already has expertise and is discussing with another expert. But it definitely should not be the starting place for an expert to teach a non-expert.
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]. This is why you shouldn't start at first principles, its simplicity is too complex. You'd need to start with subjects more complicated than QED. The rest derive out of whatever a grand unified theory is.
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. In particular, they define how the goal of PBR is to make things indistinguishable from a real photograph, which is a subtle but important distinction from generating a real photograph.
That said, I still think there's nice things about this post and the author shouldn't feel ashamed. It looks like they put a lot of hard work in and there are some really nice animations. It's clear they learned a lot and many of the animations there are not as easy as they might appear. 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.
[0] Well that and a lack of discussion of higher order interference patterns because physicists love to show off {Hermite,Laguerre}-Gaussian mode simulations https://en.wikipedia.org/wiki/Gaussian_beam#Higher-order_mod...
[1] In a degree you end up "learning physics" multiple times. Each time a bit deeper. By the end of an undergraduate degree every physicist should end up feeling like they know nothing about physics.
imadr|6 months ago
Let's suppose the aim of the article was indeed to learn PBR from first principles, what would it look like? Quantum electrodynamics?
I think there is merit in exploring different physical models for fun and scientific curiosity (like I mentioned in the first chapter). I (personally) feel that it's boring to just dump equations like Snell's law without exploring the deeper meaning behind it. I also feel that it's easier to grasp if you have some surface knowledge about more complex physical models.
I agree however that I probably made many mistakes since I didn't study physics, I'd appreciate any feedback to improve that.
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]
[0] https://www.youtube.com/watch?v=j-A0mwsJRmk
delta_p_delta_x|6 months ago
You couldn't have been any closer. I emerged feeling extremely stupid after doing physics at uni. My rather mediocre marks didn't help...
jiggawatts|6 months ago
socalgal2|6 months ago
I know this is going to sound critical, but part of me wondered if this wasn't a vibe coded project. The visuals are impressive, but you can go ask gemini canvas to make them and it will. Here's an example
https://jsbin.com/webudilaha/edit?html,output
PS: you need to close the banner at the top I think in order to be able to see the roughness slider.
It needs a little TLC but it works. Even if they weren't vibe coded, I mostly wanted to pass on they probably can be, for anyone who might find that useful for making more articles like this. Even if they just get you started.
Still, cool article!
zokier|6 months ago
It is also interesting to look what you can do if you make your rendering even more physically based. One example is wave_tracer which combines wave optics with path tracing to enable simulating wider range of phenomenons. They have nice theory writeup on their webpage:
https://wavetracer.dev/theory.html
taeric|6 months ago
I think the idea is supposed to be to go back to the "first principals [that you would have been taught]." Which, yes, sometimes you will learn things that show these early teachings were wrong. Often, though, you can get far more mileage out of the naive models than people want to admit.
To that end, I think used judiciously, this has merit. Rarely does anything go against early teaching. It should lean on the specific assumptions and why they do or do not apply anymore, though.
unknown|6 months ago
[deleted]
deadbabe|6 months ago
MangoToupe|6 months ago
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.
asdaqopqkq|6 months ago
[deleted]
smusamashah|6 months ago
amelius|6 months ago
imadr|6 months ago
Anyways thanks for the feedback I’ll look into it
sabellito|6 months ago
FF: 142.0.1
OS: Android 15
all2|6 months ago
jupitr|6 months ago
imadr|6 months ago
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. 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.
cubefox|6 months ago
imadr|5 months ago
The term subsurface scattering is used for light that exits further away (more than a pixel) like in simulations of human skin
However that part of the article isn’t clear enough and warrants a rewrite
prathje|6 months ago
Small nit on the wording: "This continuous cycle enables self-sustaining, self-propagating electromagnetic waves"
The term “self-propagating” makes it sound like the fields are somehow pushing each other forward, but really they’re just coupled solutions of Maxwell’s equations.
avereveard|6 months ago
sidcool|6 months ago
Eduard|6 months ago
kelseyfrog|6 months ago
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.
corysama|6 months ago
https://www.researchgate.net/figure/Picture-of-the-BRDF-meas...
https://www.iosb.fraunhofer.de/en/projects-and-products/sig_...
imadr|6 months ago
Real life measures are also useful for inverse rendering.
dabla|6 months ago
snarfy|6 months ago
ingen0s|6 months ago
kanakenfresse|6 months ago
[deleted]