Glass diffraction?

   16870   23   5
User Avatar
Member
856 posts
Joined: Oct. 2008
Offline
Is there a glass shader implementing diffraction (chromatic abberation) in Houdini? I can't find one.

It's dead easy to build one in XSI but I can't get find the corresponding vex nodes (do separate refractive indexes for R G and B and then overlay together again)
--
Jobless
User Avatar
Member
257 posts
Joined: Nov. 2007
Offline
I don't know if anyone has got an implementation lying around, but Mario did a really interesting presentation on this a while back:
http://www.sidefx.com/index.php?option=com_content&task=view&id=1240&Itemid=310 [sidefx.com]
Cg Supervisor | Effects Supervisor | Expert Technical Artist at Infinity Ward
https://www.linkedin.com/in/peter-claes-10a4854/ [www.linkedin.com]
User Avatar
Member
606 posts
Joined: May 2007
Offline
His glass shader [forums.odforce.net] does it, so you could cop^H^H^H use that as an inspiration..

eetu.
User Avatar
Member
856 posts
Joined: Oct. 2008
Offline
Yes, I've seen that before but it's apparently not working in H10.
--
Jobless
User Avatar
Member
606 posts
Joined: May 2007
Offline
Soothsayer
Yes, I've seen that before but it's apparently not working in H10.

Well then, that means you'll have to get your hands dirty, right?

As a starting point here's a super simple RGB diffraction vop shader, it just makes 3 traces with a different IOR.

If you watch Mario's presentation video or read the above linked post,
you will know that this is not really the right way to do it.
You'll need to take several samples with different wavelengths and combine
them in XYZ color space.. watch the video

eetu.

Attachments:
rgb_diffraction.hipnc (512.0 KB)
rgb_diffraction.jpg (74.5 KB)

User Avatar
Member
856 posts
Joined: Oct. 2008
Offline
Ha, I noticed 3 colors aren't giving nice results and now it makes perfect sense!

There's a couple of things though:

Why does this shader (and some others I noticed) not work in PBR? Do they need special treatment?

Also, in mental ray there are the refract nodes which I find quite straightforward to use but the mantra ones, errr… :shock: :?: What would be the simplest refraction setup with IOR?
--
Jobless
User Avatar
Member
1390 posts
Joined: July 2005
Offline
Soothsayer
Yes, I've seen that before but it's apparently not working in H10.

It definitely works in H10. The problem is a change in how gui treats empty light/object scope fields which are present in mario's shader interface. You need to put wild card ( * ) into all of these fields (or any other reasonable light/object scope). Empy fields means none or “nothing” for H9/10.


As to question about PBR and not working shaders: PBR is a different engine using different set of illumination functions in vex, thus any shader needs to be prepared to be used with that. Mario's super glass shader was written prior H9. On the other hand it's one of the best glass shader out there (at least publicly available) , so I wouldn't be too fussy.

As to refraction node in xsi: in RenderTree Refraction is a shading component, which you simply plug with others into material but you can't for example specify direction for it, like in vex. So basically in xsi you can work without knowing what refraction does and in vex you should know what dir, nn, is expected to be and and use both RefractVOP and RefactLightVOP. This is more or less 2 minutes of investigation and pretty much the must to work with vop/vex successfully, so I encourage you to try it

cheers!
skk.
User Avatar
Member
856 posts
Joined: Oct. 2008
Offline
I watched the mantra rendering video. If I understand correctly :shock: PBR shaders need to have something slotted into the BRDF (a diffuse shader?)

I will try to get Marios shader working. It looks very clever, very good. Thanks Symec.
--
Jobless
User Avatar
Member
948 posts
Joined: April 2008
Offline
Any tips how to do that in H12?
https://vimeo.com/user2163076 [vimeo.com]
User Avatar
Member
948 posts
Joined: April 2008
Offline
Anyone got this diffraction work in H13?
https://vimeo.com/user2163076 [vimeo.com]
User Avatar
Member
948 posts
Joined: April 2008
Offline
Anyone?
https://vimeo.com/user2163076 [vimeo.com]
User Avatar
Member
606 posts
Joined: May 2007
Offline
What diffraction do you mean? At least that old hip of mine works for me. It's not a complete shader by any means, but you could use the same idea to modify an existing one. (You need to set up the sampling parameters again as the mantra node in there is quite ancient and gives noisy results)
User Avatar
Member
948 posts
Joined: April 2008
Offline
Thanks for the feedback!

eetu
What diffraction do you mean?

I know as chromatic aberration

http://en.wikipedia.org/wiki/Chromatic_aberration [en.wikipedia.org]

eetu
At least that old hip of mine works for me. It's not a complete shader by any means, but you could use the same idea to modify an existing one. (You need to set up the sampling parameters again as the mantra node in there is quite ancient and gives noisy results)

I couldn't make your shader work with PBR, as far as I know your shader works with raytrace VEX functon which uses RGB and not BSDF functions I don´t know how to mix both efficiently and since I want to use PBR and the PBR surface model my thought is that in order to create the chromatic effect it needs to calculate it inside the surface model itself but I don´t know how to do it, In other render engines like Mental Ray and Vray I get this effect very easily I am just trying to find a way to get the same effect in mantra. I hope that makes sense.

So any ideas would be welcome.

Sorry for the bad English.

Cheers!
Edited by - April 25, 2014 09:37:10
https://vimeo.com/user2163076 [vimeo.com]
User Avatar
Member
606 posts
Joined: May 2007
Offline
Ok, here's a version of the naive setup I had above, but this time working with PBR. Same caveats apply.

Attachments:
ee_pbr_dispersion.hip (1.0 MB)
ee_pbr_dispersion.jpg (176.7 KB)

User Avatar
Member
948 posts
Joined: April 2008
Offline
WOW Dude, Your naive setup turn out to be awesomely cool!

You really put some love on the setup I even feel bad for making you have all this trouble ;D

Just a question, is there a reason for why you also put the reflection component into the mix, in my little head I though if I just work with the refraction component I´d get the trick, maybe and probably I am wrong right?

Anyway thanks again dude, I´ll test and post the result here later.
https://vimeo.com/user2163076 [vimeo.com]
User Avatar
Member
606 posts
Joined: May 2007
Offline
mzigaib
Just a question, is there a reason for why you also put the reflection component into the mix, in my little head I though if I just work with the refraction component I´d get the trick, maybe and probably I am wrong right?

Umm, actually you are right, the reflection probably should not diffract like refraction does

I just wanted to have the reflective component in there so it doesn't look weird, I guess I just copypasted that along with the refractive components without thinking..

Here's the same with just one reflection, without the color diffraction.

Attachments:
ee_pbr_dispersion2.hip (1019.3 KB)

User Avatar
Member
948 posts
Joined: April 2008
Offline
Oh man! Me again making you go through all the trouble, I am a such annoying dude! ops:
But thanks again, you are awesome!

Cheers!
https://vimeo.com/user2163076 [vimeo.com]
User Avatar
Member
14 posts
Joined: May 2010
Offline
Hey there eetu, I've just started playing with your pbr dispersion shader and notice there's substantial noise in both the red and blue channels, but not the green - any idea why this might occur?? From what I see in the shader the only difference is the slight variation in the ior being fed to the fresnel… that to me doesn't seem to account for such huge differences in noise…

I've also checked my lightsource (an HDR) for major differences in the color channels and there really doesn't seem to be anything noticable in them…
User Avatar
Member
606 posts
Joined: May 2007
Offline
Yeah, I can see that too, interesting. In a way that's how it should be - if you check out the relative luminances [en.wikipedia.org] of RGB components, they are calculated as Y = 0.2126 R + 0.7152 G + 0.0722 B. Looking at this, it makes sense to allocate samples according to the weight of the RGB component. What surprises me here is that Mantra is smart enough to figure out that the different refraction functions in the shader actually only affect certain components, and assigns samples to them accordingly..



… Or maybe it's something else
User Avatar
Member
383 posts
Joined:
Offline
Hi Everyone,

I just tried the “rgb_diffraction.hipnc” provide by Etuu;
The render with my houdini version is very diferent with lot of black part.
Is it Happen to aswell ?
http://vimeo.com/vbkstudio [vimeo.com]
  • Quick Links