Jump to content
Mario Marengo

The SSS Diaries

Recommended Posts

Jens, interesting idea but don't get me started on HSV! That's 70's colour technology! (which is worst than 80's euler tumbling.) HSV should be removed altogether and replaced with Uniform Perceptual Lab.

Share this post


Link to post
Share on other sites

Hi Edward,

I'm not too keen on the HSV part either, but the "hue" part roughtly allows a "color to wavelength" mapping and though not perfect a rgbtohsv conversion can be done easily and since I only care for the hue part it doesn't matter much anyway; For testing purposes it might be good enough anyhow.

I started a bit to "analyse" the complex model suggested by the paper you pointed out and I hope that I can linearise a bit those equations (as long as it still behaves somewhat similar it'll be fine with me). Don't know the proper english terms but at times it is possible to 'unfold the Faltungsintegral' or plot the function / transfer function into an table and approximate the actual non-linear interrelationship. No matter how I actually do this, in the end I just want some kinda 'spread/range' and 'strength' attribute for this and hopefully this will somewhat estimate the physically correct version. Well 'Ultra posse nemo obligatur' ;)

Jens

Share this post


Link to post
Share on other sites

It often amuses me that so much work has gone it creating functions that accurately simulate the real world, and now the cutting edge research is in sampling the real world and then using the samples as look up tables. I always wondered whether there wasn't some milage to be had from a shader that uses a "keyframed" curve or even a 3D surface to specify specular response etc. rather than trying to force a mathematical function to mimick it. Of course you need some simple/cheap way of obtaining some data to map it from, but maybe that is out there on the web already.

Share this post


Link to post
Share on other sites

They did something similar for the cloth rendering in the matrix

Click Me

Dunno about 'simple and cheap' though :rolleyes:

Doesn't have much with the initial SSS subject to do, but I think there is an increasing problem with complexitiy and computer graphics in general. Complex Shading models require a whole bunch of parameters and it's neither easy to get 'real world' data for those as reference nor does the general artist know much about their meaning, unless he spends a considerable amount of time on learning about the theory behind these. Same aplies for CFD Simulations, ... and even ignoring the mass of parameters and the usually higher complexity of the algorithms (i.e. they take longer to evaluate), those complex models get more and more difficult control / they are somewhat static. No FX company wants to hire a lab of scientists to come up with the proper parameter settings for event X to happen. To make it worse many companies try to find 'flashy' or 'artist-friendly' names to parameters and in the end it's almost impossible to find out what is actually going on under the hood (luckily sidefx likes to stick to the technical/proper names and has no specialised 'super OP's' that are only good for one single very specific task).

Anyhow we'll see soon enough what the future of CG brings.

Jens

Share this post


Link to post
Share on other sites
It often amuses me that so much work has gone it creating functions that accurately simulate the real world, and now the cutting edge research is in sampling the real world and then using the samples as look up tables. I always wondered whether there wasn't some milage to be had from a shader that uses a "keyframed" curve or even a 3D surface to specify specular response etc. rather than trying to force a mathematical function to mimick it.

14503[/snapback]

You bet! :)

Problem is how to store those measurements so that you don't need terabytes of storage just to keep a few hundred BRDFs kicking around! (I'm exagerating of course :P ).

One of the first things I did in Mantra/VOPs (oh...'bout a year ago now?) was to implement Homomorphic Factorization, which condenses a full measured BRDF into two tiny texture maps. Very efficient, and there is a huge database of measured materials that can be converted into this format. So here at Axyz we have a nice little library of "real" BRDFs to choose from. But I know there have been improvements to the method since then; so now it's likely better and takes less space! :)

Share this post


Link to post
Share on other sites

Hi all,

Unfortunately, my "play time" is quickly drawing to an end :(

I will try to continue to enhance this model, but there will necessarily be quite a gap between updates... c'est la vie.

I've now put everything in a single VOP.

My original thought was that both multi- and single-scattering could share some parameters, like surface color, pointcloud file, light mask, scattering length, etc. But then I thought:

*) It'd probably be cool if we are allowed the ability to assign separate colors to each...hmmmm... could make for some interesting effects.

*) Single scattering is a much higher-frequency effect and needs, on average, a point cloud that is about two to three times as dense as the one for multiple scattering.... so maybe I should let single scattering have it's own "pointcloud file" parameter.

*) You'd likely want to tie single scattering to your key light only, whereas you'd probably want multiple scattering to react to a wider range of lights. So maybe I'll give single scattering its own light mask...

And so on. In the end, I ended up giving each one a full compliment of parameters. So what I originally envisioned as a single VOP, should really be two separate VOPs -- but I haven't split them yet, so it's one big block right now.

Here is a list of things I've tweaked for this update (in no particular order). All changes (unless I state otherwise), relate to the implementation for Single Scattering.

1. Removed a chunk'o'code that was accidentally left behind from one of my many tests . The effect was that intensity would gradually decrease as scattering length increased... sorry about that. (I'm shocked that nobody caught this! :o Wake up people! :P )

2. The ICDF lookup was wrong -- or rather, the mapping of the maximum trace length along To, to the maximum range used in the ICDF lookup was wrong (it was always lower than it should have been). I've corrected this. For anyone interested in the details, spoMax is converted to the maximum value in the ICDF by first going through the CDF, like this: icdfmax=cdfSingle(spoMax/lu1). This then is the correct maximum value for the range of the ICDF lookup.

3. Changed random sampling along To to "stratified" sampling. So now the interval is first divided into equal-length segments, and the random values are picked from the range covered by each cell. Better results.

4. I didn't like how the original Henyey-Greenstein phase function was "boosting" the final outgoing radiance -- this is because it is built to maintain an integral of 1 regardless of the phase value.

I reworked it so that its highest value is now always 1 (its integral however, is no longer constant). This means that now the outgoing "hot spot" of a back-lit object shouldn't be brighter than the intensity of the light that originated it. To get the old boost, you now have to either increase the light's intensity, or increase the single scattering output using the "Intensity Dimmer" parameter.

I just found the old behaviour "unexpected"; but if you prefer the old behaviour, you can un-comments the line #define USEHG in the file AV_sss.h.

5. I'm including an "include" subdirectory in the bundle because once my packager turns it into a VOP, all comments are gone, making things hard to follow if you're interested in looking at the code. (You'll still need to rebuild the VOP if you want to make any changes to those files, naturally).

6. The calculation for single scattering is pretty fast, and it doesn't really depend on having a pointloud available. So what I've done is implement it so that if you leave the "Pointcloud File" parameter empty (for single scattering only), it will then compute it for every shade point.

However; there are two problems with this right now:

*) There are a significant amount of missed rays for NURB surfaces -- the rayhittest() function fails quite a bit for that surface type. This is thankfully masked when using the pointcloud due to the filtering that goes on in that case. Other surface types seem to be OK though....

Regardless; I found it really hard to circumvent the NURB problem (tried a few things and failed). If anyone has ideas, please let me know.

*) Pointclouds don't have derivatives, so I never bothered to sample the projected surface patch along To (instead of just the line). To do raw sampling properly, I should sample the projected patch with lengths dPds and dPdt. Come to think of it; I should do the same for the pointcloud-based method, except in that case, it would be a projected circle of radius 0.5*ptarea... and I'd have to derive my own perpendiculars off No... one more TODO...

7. Sorry Jason, but I didn't get a chance to look at rest positions... you'll have to deform the pointcloud in the same way you deform the geometry for now.... :(

8. I started thinking of ways to tie the scattering length of single scattering to the one for multiple scattering, but in the end, I decided that we're better off having complete control over how much of each one we want, so I left them as independent controls. Just keep in mind that single scattering is soubtle effect compared to multiple scattering.

OK. I think that's all for now.

Here are a few images showing the difference between multiple scattering alone, versus multi- and single-scattering combined.

post-148-1098918094.jpg post-148-1098918111.jpg

post-148-1098918125.jpg post-148-1098918139.jpg

And here's a reverse view of the rabbit with the same settings. Notice how single scattering has almost no influence on the illumination when viewed from the direction of the light (only if the phase is set to "forward scattering", of course). In this case, I assigned it a phase of 0.7 and IOR of 1.3. There's a tiny bit of lateral spill (because 0.7 is not *fully* forward scattering), but it's very subtle. But when you render the full 360 turntable, the effect of the single-scattering component is quite dramatic... well worth the effort, I think.

post-148-1098922536.jpg post-148-1098922558.jpg

Here's the latest bundle:

SSSfull2.zip

Again, the updates will likely slow down to a trickle, but I'm not leaving this model behind yet! For one thing, I still need to write a help card for it, lol!

And, as always, if anyone finds a problem or has some suggestions please let me know! I may not get to it right away, but I'll try to address it eventually.

Lastly; if anyone uses this code to build on and improve, then I'd only like to ask that you share your enhancements with the community in the same spirit as this was shared.

Enjoy! :)

Share this post


Link to post
Share on other sites

Very nice update.. I just wanted to say a huge thank you from all of us here at odforce for bringing such high quality development to us all. This makes a massive difference to our Houdini community.

Hope to see you back!

Share this post


Link to post
Share on other sites

Yeah Mario, I don't really understand the whole thread, only words like bunny & teapot & of course, the pictures of bunny & teapot! :P But seriously, thank you!

When I get a bit more time, I'll read up different papers before reading through this thread again & hopefully I'll know more than bunny & teapot. Maybe "chromatic". :ph34r:

Cheers!

steven

Share this post


Link to post
Share on other sites

Ditto, Mario! Much thanks for all these! Including those regarding Matrices and Spaces. Though I still don't fully understand, but it makes a heck of a lot more sense now . :D I am sure others would agree here too, perhaps you can write a book? :rolleyes:

Share this post


Link to post
Share on other sites
Very nice update.. I just wanted to say a huge thank you from all of us here at odforce for bringing such high quality development to us all. This makes a massive difference to our Houdini community.

Hope to see you back!

14554[/snapback]

Agreed! It's amazing, yet again showing off what creative people can do with Houdini, showing off it's power. So much is possible, even without custom code.

I haven't had time to really read this thread, but those example renders are amazing. i3d itself is pretty cool, but like this it makes it even better!

Share this post


Link to post
Share on other sites

Thanks for the kind words, guys! :)

And it's definitely not one-sided; I've benefited a great deal from this exercise! A few things that were a little fuzzy before, are a lot clearer now, thanks to having had to explain them to others... so thank you!

In any case, as I said earlier, I'm not closing this file quite yet. My immediate plan is to split it into two VOPs, add the help cards, clean up any of the obvious left-over bugs (I just noticed one a few minutes ago, lol), and upload it to Exchange as "version 1.0Beta" :P

This won't take much work so I can probably get it done by sometime next week.

Ditto, Mario! Much thanks for all these! Including those regarding Matrices and Spaces.

14560[/snapback]

Thanks Alex :) However, I feel I should make a very important clarification: That *wonderful* page on Matrices at the wiki was written entirely by Mike Cronin (Mcronin here at od[force]) -- I had absolutely nothing to do with that one. (and I'm sure that once he can come up for air, he'll be able to finish it :lol: )

A question for anyone who's been testing out these SSS ops...

It occurs to me that this whole business with the automatic determination of the pointcloud density (in the SOP HDA), while a nice idea in theory, seems to be turning out to be not so useful in practice. Is anyone using it, or does everyone go "manual" with it?

I certainly don't want to keep it around if it just confuses the interface (though I still need the HDA for the normalization that it does inside)... comments?

Thanks again! :)

Share this post


Link to post
Share on other sites
Thanks Alex :) However, I feel I should make a very important clarification: That *wonderful* page on Matrices at the wiki was written entirely by Mike Cronin (Mcronin here at od[force])  -- I had absolutely nothing to do with that one. (and I'm sure that once he can come up for air, he'll be able to finish it :lol: )

Eeeeps! My memories REEELY has gotten bad.... :cry2:

Regardless, it's great stuff on the wiki. :) I sure do wish those info exist back when I was playing with Houdini. But then again, I probably won't understand a single word of it back then. :D

Share this post


Link to post
Share on other sites
Mike Cronin (Mcronin here at od[force])  -- I had absolutely nothing to do with that one. (and I'm sure that once he can come up for air, he'll be able to finish it :lol: )

14567[/snapback]

Heh .... you know he's away this week getting married, eh? :)

Share this post


Link to post
Share on other sites
Heh .... you know he's away this week getting married, eh? :)

14570[/snapback]

Get out! ... That's GREAT!!!! :D

That's it then; we all have to get together for lunch when he gets back!

BTW.... is Jim (Woolfwood) still breathing in there?... you should really check for a pulse every now and then... it's just the polite thing to do...

:lol:

Share this post


Link to post
Share on other sites
BTW.... is Jim (Woolfwood) still breathing in there?... you should really check for a pulse every now and then... it's just the polite thing to do...

:lol:

14576[/snapback]

:lol: I've always wondered that myself. The Master Chief has been taking his time all right.

Anyways, please do give Cronin my congrats when you see him. :)

Share this post


Link to post
Share on other sites

yeah...Jim is still breathing...right beside Ben Simons... :)

we should all get together for lunch again......

Share this post


Link to post
Share on other sites

Hey Mario, what an awesome thread - cant say I understood any of the maths, but just wanted to say thanks for your effort and for donating something like this to the houdini community. Alot of the params and how they work together are still a little bit of a mystery to me so I look forward to reading you Help.

ps - if the Webby Awards had a catergory for thread of the year I'm sure this would be a stong contender.

Thanks :)

Share this post


Link to post
Share on other sites

Ditto on the many thanks, I'm already using your code to improve a shader of my own, great stuff. :D

You bet! :)

Very efficient, and there is a huge database of measured materials that can be converted into this format.

14539[/snapback]

Any chance of a hint about where to find this stuff? Is it mentioned in the paper?

Share this post


Link to post
Share on other sites
Jim is only dead on the inside:)

14601[/snapback]

I had a dream last night I was fired.

It was the most happy dream I've had in ages.

:D

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×