cinera_handmade.network/cmuratori/hero/ray/ray04.hmml

190 lines
13 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[video member=cmuratori stream_platform=twitch stream_username=handmade_hero project=ray title="Loading sampled BRDF data" vod_platform=youtube id=iHXYFbHAmlw annotator=Miblo]
[0:01][Welcome to the stream][:speech]
[0:26][Reacquaint ourselves with the ray tracer][:research]
[1:26][Default LANE_WIDTH to 8 if not defined on our build line]
[1:47][Check out our 2017_10_22_Day01.txt :performance dump][:admin]
[2:37][Admire our 2017_11_19_Day08_8x.bmp image][:drawing]
[3:34][Determine to add some importance :sampling and / or material properties][:lighting :research]
[4:27][Try to :run the ray caster]
[5:59][Reacquaint ourselves with CastSampleRays()][:research]
[10:06][Consider adding some exposure control][:research]
[10:57][Try increasing the redness of the 4th material's EmitColor from 4 to 20]
[11:22][:Run the program]
[11:37][Admire our image with more red emittance][:drawing]
[12:45][Try increasing the redness of the 4th material's EmitColor from 20 to 50]
[12:52][:Run the program]
[13:02][Admire our image with yet more red emittance][:drawing]
[14:17][Introduce a second plane]
[14:47][:Run the program]
[15:06][Admire our image with two planes][:drawing]
[15:52][Try decreasing the d of the 2nd plane from 10 to 2]
[15:57][:Run the program]
[16:29][Admire our image with the second plane cutting through the blue hemisphere][:drawing]
[17:11][Determine to vary the light based on direction][:drawing]
[17:44][Try adding some Green and Blue to the 4th material's EmitColor, and take RaysPerPixel as a command line argument]
[18:13][:Run the program with and without passing a RaysPerPixel]
[18:32][Admire our image with orange emittance][:drawing]
[19:02][:Research Disney's standard BRDF (Bidirectional Reflectance Distribution Function)[ref
site="Disney Animation"
page="BRDF Explorer"
url=https://www.disneyanimation.com/technology/brdf.html][ref
author="Brent Burley"
title="Physically-Based Shading at Disney"
publisher="Walt Disney Animation Studios"
url=https://disney-animation.s3.amazonaws.com/library/s2012_pbs_disney_brdf_notes_v2.pdf][ref
site=ShaderToy
page="Disney Principled BRDF"
url=https://www.shadertoy.com/view/XdyyDd]][:lighting]
[25:10][:Research reference implementations of Disney's Principled BRDF[ref
site=GitHub
page="brdf/src/brdfs/disney.brdf"
url=https://github.com/wdas/brdf/blob/master/src/brdfs/disney.brdf][ref
site=Shih-Chin
page="Implementing Disney Principled BRDF in Arnold"
url=http://shihchinw.github.io/2015/07/implementing-disney-principled-brdf-in-arnold.html][ref
site="Rendering Equations"
page="Rendering the Moana Island Scene Part 1: Implementing the Disney BSDF"
url=https://schuttejoe.github.io/post/disneybsdf/]][:lighting]
[27:34][Prepare to proceed, reading 2 "The microfacet model"[ref
author="Brent Burley"
title="Physically-Based Shading at Disney"
publisher="Walt Disney Animation Studios"
url=https://disney-animation.s3.amazonaws.com/library/s2012_pbs_disney_brdf_notes_v2.pdf]][:lighting :research]
[31:21][Read 3 "Visualizing measured BDRFs",[ref
author="Brent Burley"
title="Physically-Based Shading at Disney"
publisher="Walt Disney Animation Studios"
url=https://disney-animation.s3.amazonaws.com/library/s2012_pbs_disney_brdf_notes_v2.pdf] describing a gonioreflectometer[ref
site=Wikipedia
page=Gonioreflectometer
url=https://en.wikipedia.org/wiki/Gonioreflectometer] and checking out MERL's BRDF database[ref
site="MERL - Mitsubishi Electric Research Laboratories"
page="MERL BRDF Database"
url=https://www.merl.com/brdf/]][:lighting :research]
[39:21][Read 'A Data-Driven Reflectance Model'[ref
author="Wojciech Matusik, Hanspeter Pfister, Matt Brand and Leonard McMillan"
title="A Data-Driven Reflectance Model"
url=http://www.csbio.unc.edu/mcmillan/pubs/sig03_matusik.pdf]][:lighting :research]
[46:56][Consult the BRDF reference implementation in MERL's BRDF database[ref
site="MERL - Mitsubishi Electric Research Laboratories"
page="BRDFRead.cpp"
url=http://people.csail.mit.edu/wojciech/BRDFDatabase/code/BRDFRead.cpp]][:lighting :research]
[47:52][Embark on our BRDF loader, introducing brdf_table and LoadMERLBinary()[ref
site="MERL - Mitsubishi Electric Research Laboratories"
page="BRDFRead.cpp"
url=http://people.csail.mit.edu/wojciech/BRDFDatabase/code/BRDFRead.cpp]][:"file io" :lighting]
[54:27][Organise our MERL .binary files][:admin]
[55:28][Set up to call LoadMERLBinary(), changing it to handle three colour channels[ref
site="MERL - Mitsubishi Electric Research Laboratories"
page="BRDFRead.cpp"
url=http://people.csail.mit.edu/wojciech/BRDFDatabase/code/BRDFRead.cpp]][:lighting]
[1:00:19][:Run the program, to see no progress printout][:lighting]
[1:03:33][:Run the program with 16 RaysPerPixel][:lighting]
[1:03:55][Admire our test.bmp][:drawing :lighting]
[1:04:12][Determine to sample the BRDF values, first learning about the colour scaling values[ref
site="MERL - Mitsubishi Electric Research Laboratories"
page="BRDFRead.cpp"
url=http://people.csail.mit.edu/wojciech/BRDFDatabase/code/BRDFRead.cpp][ref
author="Wojciech Matusik, Hanspeter Pfister, Matt Brand and Leonard McMillan"
title="A Data-Driven Reflectance Model"
url=http://www.csbio.unc.edu/mcmillan/pubs/sig03_matusik.pdf]][:lighting :research]
[1:08:41][Change LoadMERLBinary() to read in the colour channels as per the reference implementation[ref
site="MERL - Mitsubishi Electric Research Laboratories"
page="BRDFRead.cpp"
url=http://people.csail.mit.edu/wojciech/BRDFDatabase/code/BRDFRead.cpp]][:lighting]
[1:11:09][Upgrade CastSampleRays() to attenuate by the BRDF-sampled reflectance colour, introducing BRDFLookup()][:lighting :sampling]
[1:15:26][Implement BRDFLookup(), informed by the reference implementation[ref
site="MERL - Mitsubishi Electric Research Laboratories"
page="BRDFRead.cpp"
url=http://people.csail.mit.edu/wojciech/BRDFDatabase/code/BRDFRead.cpp] and 'A Data-Driven Reflectance Model'[ref
author="Wojciech Matusik, Hanspeter Pfister, Matt Brand and Leonard McMillan"
title="A Data-Driven Reflectance Model"
url=http://www.csbio.unc.edu/mcmillan/pubs/sig03_matusik.pdf]][:lighting :sampling]
[1:29:05][Coordinate System on a Sphere[ref
site=Wikipedia
page="Spherical cow"
url=https://en.wikipedia.org/wiki/Spherical_cow][ref
site=Wikipedia
page="Hairy ball theorem"
url=https://en.wikipedia.org/wiki/Hairy_ball_theorem]][:blackboard :geometry :lighting]
[1:33:14][Make CastSampleRays() generate a coordinate system for our :sampling sphere, to pass to BRDFLookup()][:geometry :lighting]
[1:37:14][Consult our documents[ref
site="MERL - Mitsubishi Electric Research Laboratories"
page="BRDFRead.cpp"
url=http://people.csail.mit.edu/wojciech/BRDFDatabase/code/BRDFRead.cpp][ref
author="Wojciech Matusik, Hanspeter Pfister, Matt Brand and Leonard McMillan"
title="A Data-Driven Reflectance Model"
url=http://www.csbio.unc.edu/mcmillan/pubs/sig03_matusik.pdf] on computation of the diff vector][:geometry :lighting :research]
[1:39:22][Make BRDFLookup() compute ThetaHalf and PhiHalf, after mapping the LightDir and HalfVector in to the tangent space of the reflection][:lighting]
[1:43:36][Make BRDFLookup() compute ThetaDiff[ref
author="Wojciech Matusik, Hanspeter Pfister, Matt Brand and Leonard McMillan"
title="A Data-Driven Reflectance Model"
url=http://www.csbio.unc.edu/mcmillan/pubs/sig03_matusik.pdf]][:lighting]
[1:45:44][Come to understand the PhiDiff computation[ref
site="MERL - Mitsubishi Electric Research Laboratories"
page="BRDFRead.cpp"
url=http://people.csail.mit.edu/wojciech/BRDFDatabase/code/BRDFRead.cpp][ref
author="Wojciech Matusik, Hanspeter Pfister, Matt Brand and Leonard McMillan"
title="A Data-Driven Reflectance Model"
url=http://www.csbio.unc.edu/mcmillan/pubs/sig03_matusik.pdf][ref
author="Szymon Rusinkiewicz"
title="A New Change of Variables for Efficient BRDF Representation"
url=https://www.cs.princeton.edu/~smr/papers/brdf_change_of_variables/brdf_change_of_variables.pdf]][:geometry :lighting :research]
[1:49:30][Rename Bitangent to Binormal in plane][:"data structure" :lighting]
[1:51:45][Locating a (Light) Vector in a Transformed Coordinate System[ref
site="MERL - Mitsubishi Electric Research Laboratories"
page="BRDFRead.cpp"
url=http://people.csail.mit.edu/wojciech/BRDFDatabase/code/BRDFRead.cpp]][:blackboard :geometry :lighting]
[1:57:52][Efficiently locating a (Light) Vector in a Transformed Coordinate System[ref
author="Szymon Rusinkiewicz"
title="A New Change of Variables for Efficient BRDF Representation"
url=https://www.cs.princeton.edu/~smr/papers/brdf_change_of_variables/brdf_change_of_variables.pdf]][:blackboard :geometry :lighting]
[2:04:37][Make BRDFLookup() efficiently compute the PhiDiff][:geometry :lighting]
[2:10:10][Introduce ExtractF32() for BRDFLookup() to call[ref
site=Intel
page="Intel Intrinsics Guide"
url=https://software.intel.com/sites/landingpage/IntrinsicsGuide/]][:simd]
[2:13:51][Make BRDFLookup() look up the colour values[ref
site="MERL - Mitsubishi Electric Research Laboratories"
page="BRDFRead.cpp"
url=http://people.csail.mit.edu/wojciech/BRDFDatabase/code/BRDFRead.cpp]][:lighting]
[2:21:57][Begin to make BRDFLookup() index in to the BRDF table[ref
site="MERL - Mitsubishi Electric Research Laboratories"
page="BRDFRead.cpp"
url=http://people.csail.mit.edu/wojciech/BRDFDatabase/code/BRDFRead.cpp]][:lighting]
[2:25:26][Wonder if the squaring and rooting is correct[ref
site="MERL - Mitsubishi Electric Research Laboratories"
page="BRDFRead.cpp"
url=http://people.csail.mit.edu/wojciech/BRDFDatabase/code/BRDFRead.cpp]][:mathematics :research]
[2:28:34][I = √t × R²][:blackboard :mathematics]
[2:30:14][Finish making BRDFLookup() index in to the BRDF table[ref
site="MERL - Mitsubishi Electric Research Laboratories"
page="BRDFRead.cpp"
url=http://people.csail.mit.edu/wojciech/BRDFDatabase/code/BRDFRead.cpp]][:lighting]
[2:37:16][:Run the program to find uninitialised Values][:lighting]
[2:38:41][Introduce NullBRDF()][:lighting]
[2:40:25][:Run the program][:lighting]
[2:40:39][Admire our test.bmp][:drawing :lighting]
[2:41:06][Q&A][:speech]
[2:41:48][@xxthebigfoxx][Q: When computing the sphere bitangent, could you just NOZ the tangent before computing the Bitangent so you don't have to NOZ the Bitangent afterwards?][:lighting]
[2:42:22][Save BRDFLookup() from performing NOZ() on the DiffX, and make it perform NOZ() when initialising SphereTangent to save doing in on the SphereBinormal][:lighting]
[2:43:28][@somebody_took_my_name][Q: Talking about ray and Linux and more beautiful code, there is still a GitHub issue about :memory loading in :SIMD]
[2:43:40][@pythno][Q: Is the BRDS essentially a function that tells us which rays within the hemisphere to use?][:lighting]
[2:43:53][@smack_ssbm][Q: Do you get "uncanny valley" impressions sometimes when looking at raytraced images? If so, what strategies might you have to mitigate that?]
[2:44:28][@pythno][Q: BRDF, yes, typo, sorry][:lighting]
[2:45:21][@xxthebigfoxx][Q: Will you finish this tomorrow?][:lighting]
[2:45:31][@sagian2005][Q: The sound was fine and it was synced. Your camera frame rate seems low, though]
[2:45:53][@tocsin16][Q: Have you thought about implementing GGX for [~hero/ray Handmade Ray]?][:lighting]
[2:46:52][@tinspin][Q: How much of modern skin mesh :animation did you contribute to?]
[2:47:24][@tocsin16][Q: Haha, this is what I'm talking about[ref
author="Bruce Walter, Stephen R. Marschner, Hongsong Li and Kenneth E. Torrance"
title="Microfacet Models for Refraction through Rough Surfaces"
url=https://www.cs.cornell.edu/~srm/publications/EGSR07-btdf.pdf]][:lighting]
[2:49:26][@pythno][Q: Alright, thanks. But what function chooses the outgoing rays to use? Because it will affect the outcome of the picture. It gets fuzzier if the rays spread in more directions][:lighting]
[2:49:50][Equally vs BRDF weighted :sampling][:blackboard :lighting]
[2:53:21][@tinspin][Q: Did shader weighted skin mesh :animation exist before you started meddling with it? How did it evolve, and do you see any future improvements possible on it?]
[2:56:36][@tocsin16][Q: I see missed the start of the stream so didn't realize the dataset was a requirement. I don't know if there is set of measured GGX BRDFs. It is a very common BRDF used in offline pathtracing for film (and I think gaining popularity in the realtime world too). Thanks for the education streams!][:lighting]
[2:57:14][@ryanfleury][Was the game Messiah?]
[2:58:26][Wrap it up][:speech]
[/video]