Jump to content

PBR experiments


Recommended Posts

did some testing to see whether a BSDF based shader using the PBR rendering engine is "equivalent" in terms of how it computes illumination for both direct lights and indirect lighting

the latter was tested by using emmissive objects with a shader set to put some value into the Ce output variable which is apparently all PBR needs to treat something as emmissive

one of my initial assumptions when setting this up was that there really wasn't any equivalence and that specular BSDFs in particular would give quite different results - seems that I was wrong about that in some aspects at least :)

given an emmissive object the same size, shape and position as an area light, if you modulate its brightness (ie multiply Ce in the shader) so that it gives roughly the same diffuse illumination as the area light using one bounce PBR, then both this object and the area light actually give very similar results across a broad range of BSDF values (I tested diffuse and various roughness settings on a phong) - ie the results from indirect path tracing seems to approximately match those from direct lighting. I had kinda reckoned they were divergent, but apparently not.

in the following images I set up a sphere with an emmissive shader so that it matched precisely the size and position of a spherical area light

web.jpg?ver=12770716750001

I then rendered EITHER the sphere OR the area light to see how the results differed

for the diffuse test bounces were limited to 1 for the sphere (otherwise it doesn't illuminate at all) and 0 for the area light - ie there are no additional bounces to give secondary illumination amongst the test objects themselves and the shader used for the test objects was literally just a diffuse BSDF

1. sphere only at sizes of 3, 9 and 20 units (it was matched in terms of brightness to the area light at 3 units - note the white clamping point is different in all 3 images to account for the increased amount of illumination as it gets bigger and that the difference in brightness is roughly linearly coupled to the size of the sphere)

web.jpg?ver=12770721120001

web.jpg?ver=12770721140001

web.jpg?ver=12770721160001

we can also see here that the sampling required to effectively eliminate noise gets progressively more expensive as size decreases - which was to be expected, given that a diffuse BSDF should be sampling the entire hemisphere above each shading point equally and only a few rays are going to hit the emmissive sphere itself - the images above used about 16,000 samples per pixel and were quite slow - only on the 20 unit sphere was that number of samples really enough

same set of test for the area light at the same range of sizes - the illumination stays at the same intensity regardless of size:

web.jpg?ver=12770726120001

web.jpg?ver=12770726140001

web.jpg?ver=12770726170001

direct lighting is a lot more efficient noise wise, again expected - though I think I like the shadows in the indirect test:

web.jpg?ver=12770763470001

and just to prove that sampling quality doesn't really have any effect on how the illumination is actually being computed for direct lights the following image used only 1 sample per pixel:

web.jpg?ver=12770738540001

there's no way to do something similar on the indirect tests without just ending up with total noise (ie so indirect sampling is definitely different from calculating direct lighting)

Link to comment
Share on other sites

next set of test - same thing but with a phong BSDF on the test objects rather than a diffuse

this time the sequence shows results with the same size of sphere/area light (ie 3 units) but with varying roughness values of 1.0, 0.1 and 0.01:

indirect tests are on the left (sampling was significantly reduced to speed things up), direct lighting on the right:

web.jpg?ver=12770744450001web.jpg?ver=12770744390001

web.jpg?ver=12770744430001web.jpg?ver=12770744370001

web.jpg?ver=12770744410001web.jpg?ver=12770744340001

I was somewhat surprised to see that both sets of tests showed quite similar results (given matched brightnesses of source illumination)

interestingly (and this is actually what inspired all of this) given that the area light has a 'real world' brightness of 230 for its size and position compared to an equivalent emissive object neither set of tests show specular reflections that are brighter than the respective light sources

I did the same set of tests at a sphere/area light size of 9 units but have omitted the results here for brevity :)

the only significant thing to note was that the results matched again with the caveat that the indirect tests were 3 times brighter than before whereas the direct light tests showed no change in luminosity - again presumably because area lights are 'fixed' at a constant brightness regardless of area whereas the effect of the emissive sphere is directly proportional to its size relative to the shaded point

I'm not sure this behavior of area lights is really desirable in a PBR context - as it doesn't match with how anything effects indirect lighting (ie returned luminosity is a function of the proportion of 'light' across the entire sampled environment and thus the relative size of a luminous object is important - this seems more physically correct at any rate)

...anyway this had cleared up a fair few things in my understanding of whats going on under the hood of PBR - or it had until I cranked roughness way down to 0.0001 (indirect test first on the left, direct lighting on the right):

web.jpg?ver=12770752750001web.jpg?ver=12770752730001

2 things puzzled me here:

1) at very small roughness values the indirect sampling is starting to diverge significantly from the direct lighting in terms of reflected luminosity - maybe the similarities are only approximately equivalent at non-extreme values of roughness? (next time I'll try different BSDF functions to see if they behave similarly)

2) the indirect test shows reflected luminosity roughly twice as bright as the actual light source (the info box is picking out the brightest spec hit I could find on the torus - a value of 427 is almost twice as bright as the actual emission value of 230)

the latter result is really weird as I had assumed that all the indirect rays were simply averaged and that the BSDF function in an indirect lighting context was only determining which direction they were sent off in (ie it biases the samples along the direction of incidence) - if they are then simply averaged that would mean the reflection could NEVER be brighter than the thing its reflecting

this result suggests that the BSDF is also modulating the intensity of the sampled values and in extreme cases magnifying it somehow?

Link to comment
Share on other sites

next up was looking at whether an environment light was equivalent to an inverted sphere (entirely encompassing the test objects, again with an emissive shader applied)

the quick the answer appears to be yes :)

there was a big difference on this test though in that both the sphere and the light were mapped with the same HDRI image and had exactly the same intensity (ie both were set to 1.0) - the small difference in colour (they seem to be equivalent in terms of luminosity) is probably down to the env light using some kind of fancy box mapping and my emissive sphere being simply spherically mapped, thus different bits of the image are showing up in reflected light across either set of tests:

(indirect tests with sphere on left, direct test with env light on the right, diffuse tests top row, phong tests (roughness at 0.01) bottom - bounces constrained to remove additional secondary illumination)

web.jpg?ver=12770796350001web.jpg?ver=12770796270001

web.jpg?ver=12770796320001web.jpg?ver=12770796300001

so it seems where the emissive object covers the entire sampling hemisphere its luminosity is exactly equivalent to an env light set to the same intensity value in relative terms

next up are 3 tests with bounces increased to 4 for all 3 terms in the PBR rop options and a test shader set to: (diffuse BSDF * 0.65) + (phong BSDF * 0.05)

the first image is the indirectly sampled emissive sphere, the second image the equivalent environment light, and the third image the original area light at 9 units size:

web.jpg?ver=12770796220001

web.jpg?ver=12770796250001

web.jpg?ver=12770796200001

these images help throw into relief the original issue I was struggling with - namely trying to balance overall global illumination (given an env light and an emissive sphere are pretty much equivalent it doesn't matter which is used for that) with a more direct light source - a very common approach to general shot lighting here at least

to be more exact the relative difference in brightness between specular and diffuse illumination with a direct light source seems to be much greater than that with a 'global' type light source used for ambient GI (inc ambient specular reflections) and the lack of any ability to separate out this behavior given that a surface can only have a single ultimate BSDF and lights can't be set to spec or diffuse only under PBR

what this (long) set of experiment has shown though is that I would get pretty much the same results with an equivalently bright emissive object instead of the area light doing the "direct lighting" (but with far more noise) and that there isn't really the big difference between indirect path tracing and direct lighting under PBR that I had originally assumed to be the issue

Its obviously more 'physcially correct' than I had thought and I guess I have relied so much on 'fix it in post with independant AOV control' type methods that actually addressing how one should properly balance global and direct illumination within one shader and without resorting to "cheating" at light level is something I've not had to deal with recently :D

this series of tests also threw up what looks to be a bug with PBR on H10 at least - ie the image on the left is the emissive sphere plus the area light visible at the same time, whereas the one one the right is the env light and the area light both turned on:

web.jpg?ver=12770796170001web.jpg?ver=12770796140001

the latter image should look much like the former but there's something very strange going on in terms of how the PBR engine is attempting to sum both light sources in the image on the right

given that PBR only ever evaluates one light and one indirect ray per sample, one would expect the test using the sphere to be better resolved noise wise (since its making better use of the samples) but the test with the two lights still looks F*!ked up to me :)

Link to comment
Share on other sites

finally (yes I promise) I found this link really interesting - it's a short paper comparing the 'accuracy' of various popular BSDF's (most if them bundled with Houdini's PBR, if only accessible by code in some cases) in terms of replicating measured values from real world samples:

BSDF comparison

download the presentation (its a pdf as well despite the description) rather than the paper

Link to comment
Share on other sites

Hey Stu, interesting, I assume you use H11 for this? (otherwise, I'm a bit confused about the Ce variable)

No this was in H10 (.643) - you just pump a value into an exported attribute called Ce in the shader for anything that needs to have its own luminosity and it works, you don't need to actually connect anything to either Cf or F in the shader output (unless you want to see the actual object of course) - I think that Ce has always been the default for emission?

the shader for the environment sphere is posted below

web.jpg?ver=12771226330001

also attached is the hip file for the test scene (character geo removed)

engineTest3.zip

Link to comment
Share on other sites

see below for the test shader

the lambert and specular nodes create a BSDF of diffuse or phong respectively

the specular or the lighting model nodes can also create Ashikmhin (set it to anistropic), matchvex_blinn (set it to blinn), matchvex_specular (set it to glossy or VEX specular) BSDF's

to access Lafortune and other models You need to write some code rather than just use VOPs right now

available BSDF's (not all of them though) are described in the docs here: http://www.sidefx.com/docs/houdini10.0/vex/pbr

web.jpg?ver=12771230800001

the two "exp" parameters are just for me to quickly adjust the contribution of either BSDF in the shader

Link to comment
Share on other sites

Oh thanks, I didn't know that. I'll play around with it a little. But I wonder if we shouldn't just wait for H11 and the new geometry lights to make serious investigations like this?

Yes, indeed. There are game-changing improvements in this area in H11 :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...