kubabuk Posted January 25, 2008 Share Posted January 25, 2008 Hello everyone, Please have a look at the attached image, I don't understand in this case how the glass works (I am using the Glass material form the gallery). It looks like everything which is just behind the glass is completely or almost black. But far test cube I place behind, viewed through the glass looks fine! The glass has its thickness, there is enough reflection/refraction. I have no idea what is wrong. thank you kuba Quote Link to comment Share on other sites More sharing options...
Andz Posted January 25, 2008 Share Posted January 25, 2008 Are you using the PBR render? Quote Link to comment Share on other sites More sharing options...
Mario Marengo Posted January 25, 2008 Share Posted January 25, 2008 It looks like everything which is just behind the glass is completely or almost black. Shadows? Exclude the glass from all occlusion tracing scopes and shadow masks and test again. You're likely just seeing the glass pane's shadow on the building. Quote Link to comment Share on other sites More sharing options...
Andz Posted January 25, 2008 Share Posted January 25, 2008 I read a lot on FryRender's and Maxwell's forum about how light needs a lot more time to cook in cases like these on Physically Based renderers. Is that the why you'd exclude the glass Mario? Quote Link to comment Share on other sites More sharing options...
Allegro Posted January 25, 2008 Share Posted January 25, 2008 Shadows?Exclude the glass from all occlusion tracing scopes and shadow masks and test again. You're likely just seeing the glass pane's shadow on the building. Yup, likely there's going to be a need for Caustic Photons if there are shadows being cast by the glass. Quote Link to comment Share on other sites More sharing options...
Mario Marengo Posted January 25, 2008 Share Posted January 25, 2008 I read a lot on FryRender's and Maxwell's forum about how light needs a lot more time to cook in cases like these on Physically Based renderers. Is that the why you'd exclude the glass Mario? I suppose that's true, but my reason for suggesting doing away with the shadows was that, if you don't (and as Allegro points out), you'd need to get into caustic calculations, which would clearly be overkill in a scene like this (where it seems to me that you can get away with just dimming down the interior a little and call it a day). Quote Link to comment Share on other sites More sharing options...
Andz Posted January 25, 2008 Share Posted January 25, 2008 I suppose that's true... For this, since they (fry and maxwell users) usually need the reflections on windows, they have to use a special glass shader that they call Ghost Glass. Reflections but no refractions/shadows. Making it only usable for thin surfaces. Quote Link to comment Share on other sites More sharing options...
kubabuk Posted January 26, 2008 Author Share Posted January 26, 2008 Thanks for feedback Andz: PBR is used here. Mario: I'm just using shelf env light with casting shadows switched off. When do I switch off occlusion tracing? in the vops of the glass material? Cheers kuba Quote Link to comment Share on other sites More sharing options...
Mario Marengo Posted January 26, 2008 Share Posted January 26, 2008 Andz: PBR is used here.Mario: I'm just using shelf env light with casting shadows switched off. When do I switch off occlusion tracing? in the vops of the glass material? Aaahhhh.... PBR. Sorry. For some reason I was thinking raytracing. The glass material that comes with Houdini (at least the one I'm looking at now, which is from H9.1.133), has a "Faux Caustics" parameter. Toggle this on, and set "Minimum Shadow" to 0 and "Maximum Shadow" to something small like 0.1, and you should see those shadows dissappear from the building. Here's a quick test using an env light like in your scene, first without, and then with that shader's "Faux Caustics" feature, setting [min,max] shadows to [0,0.1]: But if you're like me, then you probably want to know how the heck that "faux caustics" thing works. If so, then read on... In PBR, your only recourse for producing transparent shadows from glass (outside of a full photon solution) is to test for a shadow ray, and if true, then modify its opacity, mimicing as much as possible what the optics of the glass might do (yes, it's a fake because there's no refraction going on in the shadow ray's case). There is no concept of tracing scopes or shadow masks in PBR (that I'm aware of). For example, here's the simplest possible PBR glass shader I can come up with: surface testPBR_glass ( float ior = 1.5; ) { vector wo = -normalize(I); vector n = normalize(N); float eta = 1.0/ior; // get fresnel weights and directions float kr,kt; vector wr,wt; fresnel(-wo,n,eta,kr,kt,wr,wt); // calc the BSDF (specular reflection + specular transmission) Fr = specular(wr)*kr; Ft = specular(wt)*kt; F = Fr+Ft; } The problem is that opacity (Of) has to be set to 1 (default) for the camera rays to work, else transmissions will get mixed up with plain transparency and you'll end up with a big mess. But that also means that when shadow rays are cast from objects that are occluded by the glass, they always resolve to full occlusion, i.e: black. So the trick is to test for the case when the shader is being called by a shadow ray (using the isshadowray() function) and then (and *only* in that specific case) set Of to some other value... presumably less than 1. A shadow ray would have been cast from the surface testing for occlusion, not from the camera. But we can pretend that the observer is now at the origin of that shadow ray, and decide that the amount of light that s/he would receive is proportional to the transmission factor at that shadow ray's incidence to the glass (the "kt" value returned by fresnel(), based on the incident ray I, or "wo" in my code). But opacity is the complement of transmission, so we use (1-kt) instead of plain kt; and since, by implementation, (1-kt) is the same as the reflection factor "kr", we can just use kr (because kr==(1.0-kt) in VEX). Like this: surface testPBR_glass ( float ior = 1.5; ) { vector wo = -normalize(I); vector n = normalize(N); float eta = 1.0/ior; // get fresnel weights and directions float kr,kt; vector wr,wt; fresnel(-wo,n,eta,kr,kt,wr,wt); // opacity defaults to 1 vector opac = 1; bsdf Fr=0,Ft=0; if(!isshadowray()) { // if not shadow ray, then calc the BSDF Fr = specular(wr)*kr; Ft = specular(wt)*kt; } else { // else, muck about with the opacity opac = kr; } Of = opac; F = Fr+Ft; } Then you can get a little fancier and map kr (whose natural range is [0,1] ) to some user-specified "shadow range" like the [shadowMin,shadowMax] controls in Houdini's glass material. You can also play with the rate at which we transition from one extreme to the other happens, etc, etc. Hopefully this will get you experimenting. Cheers! Quote Link to comment Share on other sites More sharing options...
Symbolic Posted January 26, 2008 Share Posted January 26, 2008 Thanks Mario, Once again, thats a great article... Quote Link to comment Share on other sites More sharing options...
kubabuk Posted January 30, 2008 Author Share Posted January 30, 2008 Cheers Mario for such a deep explanation tons of very useful info! Thanks kuba Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.