
My adventures getting Disney’s Moana island scene to render well with Pbrt - dsr12
http://pharr.org/matt/blog/2018/07/16/moana-island-pbrt-all.html
======
Smerity
I love these stories of engineering and science from the trenches. Prefacing
the story with "the early Pixar renderer was stupidly slow for silly archaic
(and at the time sensible reason) X" followed by "luckily no-one is that silly
anymore - except me, as an expert, did Y, which geez looks a lot like X" is a
perfect start :) Not only is it an adventure you can join an expert in their
field on but when told honestly it's a lovely reminder that everyone stumbles
and drops the proverbial hammer on their foot occasionally.

It's also a loving testament to our era of content generation that a frequent
task in creating a children's film is solving complex scientific or
engineering problems. They recreate so many of the strange nuances and hidden
beauty of our world (anisotropic rendering, Navier–Stokes equations,
subsurface scattering, caustics, flocking, dendritic growth of snowflakes,
global illumination, ...) just so they can render the purest representation of
it for us.

I genuinely am so glad for the time I spent in art[1] and computer graphics,
though neither have much relevance to my career now, simply as it changed the
way I look at the world. When you want to try to recreate a real life scene
from scratch you realize just how much happens in the real world without you
ever appreciating it[1].

[1]: Even after the physics and science above: Do people frequently travel
down this path? Might it become a holloway[2]? Does the roof guttering drain
out here? There'll likely be moss or wearing paint. Old stone steps of an
ancient tavern? The stone will likely be worn away at the center or on either
side of the door. The background scenery in a modern computer graphics film
has dozens or hundreds of hours in them and will be filled with nuance and/or
in-jokes. If you need to create a background world in any appreciable detail,
why not use it as a canvas to keep telling a story?

[2]:
[https://en.wikipedia.org/wiki/Sunken_lane](https://en.wikipedia.org/wiki/Sunken_lane)

~~~
yoodenvranx
> I love these stories of engineering and science from the trenches.

I wish there was a website collecting all these stories and articles. They
could also ask the authors for permission and offer epub/pdf downloads of
these stories. That would be a nice read while traveling

~~~
theoh
"all these stories and articles"? There are millions of people working in
software, the number of interesting war stories just within computer science
is (conservatively) in the thousands. A distributed system of blogs is the
only efficient way to publish that breadth of material, bearing in mind that
each reader's interests are different, you can't curate a feed to suit
everyone.

With all due respect, one convenient website aggregating all that material is
not a practical idea. It's like asking for one huge magazine to exist which
contains everything worth reading about a huge field like CS.

Edit: I mean, it would be convenient, but there's no royal road to finding
stuff that's worth reading. [https://queue.acm.org](https://queue.acm.org) is
pretty good, for example

~~~
whatshisface
It sounds like you're arguing that Netflix is not only impossible, but that it
would be more impossible if it served text.

~~~
lmm
Netflix for text would be impossible. Netflix for movies is only possible
because the overwhelming majority of decent movies are produced with the
involvement of a relatively small number of production companies, and that in
turn is the case because making a good movie is a much bigger exercise than
making a good piece of text. It's highly unusual for one person to make a
high-quality movie on their own and publish it directly on the internet,
whereas this is entirely normal and common for text.

~~~
cuckcuckspruce
Your public library and services like Overdrive are "NetFlix for text".

NetFlix for text != zero curation, NetFlix curates their selection.

~~~
thaumasiotes
> NetFlix curates their selection

Judging by the stuff that comes up when you browse categories, or when NetFlix
wants to suggest something to you, the only "curation" involved is whether
they were able to get rights to display the content. There's no quality
standard, and there's no logical standard (like "if we offer the second film
in this series, maybe we should offer the first one too") either.

~~~
cuckcuckspruce
You've clearly never been to my local public library - this is often how
things are there - second and fourth book in a four book series there, first
and third nowhere to be found.

~~~
thaumasiotes
In the case of a library, I would tend to suspect one of these scenarios:

\- The first and third book are currently checked out.

\- The library acquired all four books, but the first and third have been
destroyed / lost / stolen by customers.

\- The library didn't acquire any of the books, but the second and fourth were
donated and the library chose to absorb them rather than selling or destroying
them.

None of those are even conceptually applicable to NetFlix. I definitely would
_not_ expect

\- The library has a limited budget, and considered that it would be better
spent buying the second book than the first book.

Note that NetFlix's inventory of physical discs doesn't suffer from the same
problems that its streaming inventory does. That is (most likely) because it's
trivial to obtain the legal right to distribute the physical discs -- you just
buy them on the open market, the same way a library does with its books.
NetFlix's streaming inventory isn't "curated", it's not under NetFlix's
control at all.

------
jugg1es
This made me chuckle.

"However, some earlier phase of the production pipeline used a fixed-size
buffer for storing object names and would shorten any longer names, keeping
only the end and helpfully adding a few periods to show that something had
been lost: “…year/LeftArm/Hand/IndexFinger/Knuckle2”.

Thence, all of the object names the renderer saw were of that form, the hash
function hashed all of them to the bucket for ‘.’, and the hash table was
actually a big linked list. Good times. "

------
erikbye
If you'd like to learn more about pbrt (the renderer), I can recommend his
comprehensive book Physically Based Rendering. It's used as a textbook in a
lot of courses and doesn't assume CG knowledge above an introductory level.

------
bpicolo
How close are the renders to movie-accurate (that is, what's missing?)?
Looking at e.g. [0], it seems to be missing a lot vs what is seen in the film.
Are features missing compared to the original, were things missing from the
scene description, or something else? The shorelines from screen stills in
particular seem much more sophisticated [1].

[0] [http://pharr.org/matt/blog/images/pbrt-moana-
beach.jpg](http://pharr.org/matt/blog/images/pbrt-moana-beach.jpg) [1]
[https://vignette.wikia.nocookie.net/moana/images/e/e3/How_Fa...](https://vignette.wikia.nocookie.net/moana/images/e/e3/How_Far_I%27ll_Go.jpg/revision/latest?cb=20161128042412)

~~~
trishume
The documentation Disney posted about the data set has an explanation:
[https://www.disneyanimation.com/technology/datasets](https://www.disneyanimation.com/technology/datasets)

Basically they have a few different techniques that couldn't be directly
translated into PBRT, like lights that only hit certain objects, so the
lighting is not as good in the PBRT renders, along with a few other things.
Nothing super advanced, just some things that were added to their renderer for
artistic control reasons that PBRT doesn't have.

------
aorth
Wow, this actually makes me want to go watch _Moana_. Great to see
collaboration between big animation studios and the open-source software
community. Also, Matt's analysis of his own code is unabashed and honest. In
the end he managed to make some solid performance wins for pbrt!

~~~
KaiserPro
you _should_ watch Moana, its a great movie with fun music.

then watch it a second time for the animation and rendering....

~~~
Angostura
Then watch it with the Director's commentary, which has fun nuggets like Maui
spends a lot of time in the film with his hair tied up, because his
unencumbered hair proved _very_ expensive to render.

~~~
laken
They also originally made Maui bald (for that same reason: cost), but their
cultural consultants said it may be offensive to native Polynesians, as Maui
was known for his long hair.

------
electricslpnsld
> It was a huge amount of work on Disney’s side to extract the scene from
> their internal scene representation and convert it to a format that’s
> generally accessible

Is this something that Pixar's USD [1] format would help with?

[1]
[https://github.com/PixarAnimationStudios/USD](https://github.com/PixarAnimationStudios/USD)

~~~
angus-g
From their readme, USD was considered but OBJ was chosen "for expediency."

------
taeric
For those that don't know, pbrt is worth checking out. One of the go to
examples for Literate Programming and something I hope to someday read.
[http://www.pbrt.org/](http://www.pbrt.org/) :)

If folks around here have experience with it, I'd love to see a discussion on
that.

~~~
iforgotpassword
We used it (as primarily intended) for teaching in class, extending it etc.
Didn't actually read the book but worked along the slides from the lecture,
the structure of pbrt makes it really easy to dive in and get your hands
dirty.

------
red75prime
Each triangle is an object with two v-tables? That's gross indeed.

~~~
magicalhippo
Pbrt was made to teach how to write a physically-based ray tracer. As such it
is not focused on raw speed, and the ability to extend it easily is important.

Implementing better mesh handling is an excellent exercise for the reader.

As an aside, the book "Physically Based Rendering", which is the source of
pbrt, is _by far_ the best programming book I've ever read.

So many books spend a lot of time on trivial stuff, while others dive into the
difficult theory and math but doesn't show how to translate it into code.

PBR goes through the difficult theory and math in detail while also showing
how to implement it in code, explaining potential pitfalls and tricks along
the way. And it does so in an elegant and easy to understand way.

And if you got some questions, the authors answers questions in a Google
Group.

~~~
weavie
Turns out Matt Pharr, the author of this article, is also the author of this
book.

~~~
magicalhippo
Yes, thanks for pointing that out. I so easily forget to mention things that
seem obvious to me :(

~~~
Micoloth
Ahah, not good for a programmer :D

I'm joking, thanks for suggesting that book, I don't know much about this
stuff but i might actually read it!

~~~
magicalhippo
Tell me about it :P

Since a physically-based ray tracer involves a lot of different theory and
math, it can be quite interesting even if your not in it for the actual ray
tracing. For example there's sampling low-discrepancy sequences, kd-trees and
other bounding volumes, color representation and conversion etc.

------
electricslpnsld
> Looking at the profile, roughly 60% of rendering time is spent in ray–object
> intersections (most of it in BVH traversal), and 25% is spent in ptex
> texture lookups.

Did Disney release these stats for their Hyperion renderer? I would be curious
where they spend all their time.

------
de_watcher
Ok, Part 4 confirmed that I'm not insane and most of these std::shared_ptr
should go.

------
floatboth
Has anyone tried that scene with Blender Cycles?

~~~
thedaemon
I have yet to attempt it in Cycles or Non-Commercial RenderMan for Blender
yet. It's on my to do list. If I do it or find someone else that has.. I will
make a new post.

------
mhd
I wonder whether someone converted that scene to PovRay…

