geneome Posted December 16, 2008 Share Posted December 16, 2008 Hi Guys, I have a custom illuminance loop that extracts certain passes for each light (spec, spec color, diffuse, etc.) but isn't contributing to the final color information of the shader (I just wanted the passes separate). It works great, however I noticed that when using an area light I don't get that information but I do with the point, spot, and directional. I've looked through the help put don't see any special limitation for area lights in illuminance loops so I was wondering if maybe there was some special VOP that needs to be added to built-from-scratch illuminance loops to make area lights work in them. The area light I'm using has all the selections turned on (show spec and the like) and in the final image, the area lights contribution shows up fine. Any thoughts? Quote Link to comment Share on other sites More sharing options...
Jason Posted December 16, 2008 Share Posted December 16, 2008 Hi Guys,I have a custom illuminance loop that extracts certain passes for each light (spec, spec color, diffuse, etc.) but isn't contributing to the final color information of the shader (I just wanted the passes separate). It works great, however I noticed that when using an area light I don't get that information but I do with the point, spot, and directional. I've looked through the help put don't see any special limitation for area lights in illuminance loops so I was wondering if maybe there was some special VOP that needs to be added to built-from-scratch illuminance loops to make area lights work in them. The area light I'm using has all the selections turned on (show spec and the like) and in the final image, the area lights contribution shows up fine. Any thoughts? Hi there, You've run into a bona fide limitation in Mantra, lightexports can't work with area lights; because the light shader is executed multiple times, the accumulated result is unavailable. Hopefully SESI manage to figure out a way to do this in a future version? We can only hope Quote Link to comment Share on other sites More sharing options...
geneome Posted December 16, 2008 Author Share Posted December 16, 2008 because the light shader is executed multiple times, the accumulated result is unavailable. I was thinking it might have something to do with the area light implementation (area light = many point lights on a grid/line/circle). Thanks for the information and I hope we can get the accumulated result in the future, but I am certainly aware of more pressing matters for the next releases . Quote Link to comment Share on other sites More sharing options...
kensonuken Posted December 16, 2008 Share Posted December 16, 2008 Is ur code something similar to this? surface sssLightID( // DECLARE PARAMETERS #pragma annotation "grouping" "overall/overall_color;" #pragma annotation "grouping" "overall/overall_intensity;" color overall_color = 1; float overall_intensity = 1; #pragma annotation "grouping" "key/keyColor;" #pragma annotation "grouping" "key/key_intensity;" color keyColor = 1; float key_intensity = 1; #pragma annotation "grouping" "kick/kickColor;" #pragma annotation "grouping" "kick/kick_intensity;" color kickColor = 1; float kick_intensity = 1; #pragma annotation "grouping" "fill/fillColor;" #pragma annotation "grouping" "fill/fill_intensity;" color fillColor = 1; float fill_intensity = 1; // DECLARE OUTPUTS output varying color aov_sssLightID= 0; output varying color aov_sssLight_key= 0; output varying color aov_sssLight_kick= 0; output varying color aov_sssLight_fill= 0;) { float luminance(color input_color){ return 0.3 * comp(input_color, 0) + 0.59 * comp(input_color, 1) + 0.11 * comp(input_color, 2); } uniform string raytype = "unknown"; rayinfo("type", raytype); normal Nn = normalize(N); color keyLight = 0; color kickLight = 0; color fillLight = 0; uniform string category = ""; // SEND TO SUBSURFACE EACH LIGHT CATEGORY SEPERATELY if(raytype == "subsurface"){ illuminance(P, Nn, PI/2){ vector Ln = normalize(L); float lightContrib = Nn.Ln * luminance(Cl); lightsource("__category", category); if (category == "key,specular,diffuse" || category == "key") setcomp(Ci, 0, lightContrib * key_intensity); else if (category == "kick,specular,diffuse" || category == "kick") setcomp(Ci, 1, lightContrib * kick_intensity); else if (category == "fill,specular,diffuse" || category == "fill") setcomp(Ci, 2, lightContrib * fill_intensity); } Ci *= overall_color * overall_intensity; } // GET COLOR FROM EACH LIGHT CATEGORY SEPERATELY else{ // RETURN FROM SUBSURFACE EACH LIGHT CATEGORY SEPERATELY color sssReturn = subsurface(P); aov_sssLightID = color(sssReturn[0], sssReturn[1], sssReturn[2]); aov_sssLight_key = color(sssReturn[0]) * keyColor; aov_sssLight_kick = color(sssReturn[1]) * kickColor; aov_sssLight_fill = color(sssReturn[2]) * fillColor; Ci = aov_sssLight_key + aov_sssLight_kick + aov_sssLight_fill; } } Quote Link to comment Share on other sites More sharing options...
Jason Posted December 16, 2008 Share Posted December 16, 2008 Is ur code something similar to this? I believe he's talking about regular illuminance stuff being combined with area lights, nothing to do with SSS. Quote Link to comment Share on other sites More sharing options...
geneome Posted December 16, 2008 Author Share Posted December 16, 2008 I believe he's talking about regular illuminance stuff being combined with area lights, nothing to do with SSS. Exactly, just a plain illuminance loops, nothing fancy. Quote Link to comment Share on other sites More sharing options...
kensonuken Posted December 17, 2008 Share Posted December 17, 2008 can u post the code.. Quote Link to comment Share on other sites More sharing options...
Wolfwood Posted December 17, 2008 Share Posted December 17, 2008 (edited) can u post the code.. Light Export Example surface diffuse_export( export vector diff = 0 ) { vector total_diff = 0; vector Nn = normalize(N); illuminance(P, Nn, 1.570796 , "lightexport", "diff") { diff = 0; shadow(Cl); diff = Cl * diffuseBRDF(L, Nn); total_diff += diff; } Cf = total_diff; } Edited December 17, 2008 by Wolfwood Quote Link to comment Share on other sites More sharing options...
geneome Posted December 18, 2008 Author Share Posted December 18, 2008 (edited) @kensonuken Wolfwood beat me to it, but he's showing what I'm using (with diffuseBRDF being interchanged with other BRDFs when necessary). Edited December 18, 2008 by geneome Quote Link to comment Share on other sites More sharing options...
kensonuken Posted December 18, 2008 Share Posted December 18, 2008 yeah i tried out the above method long time ago and was stuck up at SSS as the illum code is not available anywhere and cracking that code for me takes time since im not that expert to do it Quote Link to comment Share on other sites More sharing options...
Wolfwood Posted December 18, 2008 Share Posted December 18, 2008 yeah i tried out the above method long time ago and was stuck up at SSS as the illum code is not available anywhere and cracking that code for me takes time since im not that expert to do it You mean the SSS code in VEX? Its in $HH/vex/include/pcscatter.h Quote Link to comment Share on other sites More sharing options...
kensonuken Posted December 19, 2008 Share Posted December 19, 2008 (edited) ss=ssbase=terr; float icdfmax = vop_cdfSingle(clamp(spoMax/lu1,0.,1.)); for(samp=0; samp<samples; samp++) { ss = ssbase+nrandom()*sinc; spo = spoMax*vop_icdfSingle(ss*icdfmax); ssbase += sinc; Psamp = Xo + (To * spo); illuminance(Psamp, No, M_PI, LIGHT_DIFFUSE) { Wi = normalize(L); hitD = rayhittest(Psamp,L,Xi,Ni,0.,"scope",oname); if(hitD>0.) { realsamples += 1; Ni = normalize(Ni); WiNi = dot(Wi,Ni); AWiNi = abs(WiNi); spi = distance(Psamp,Xi) * AWiNi / sqrt(1.0 - ieta2 * (1.0 - AWiNi*AWiNi)); if(spi <= lu1 && WiNi>0.) { if(eta!=1.0) { fresnel(-Wi,Ni,ieta,Kri,Kti); } else Kti = 1.0; F = Kti * Kto; phase = vop_hgphaseN(gg,Wi,Wpo); ksss = F * phase * (1-smooth(0,lu1,spi)); scatt+= Cl * Rd * WiNi * ksss; } } } } } return 2.0 * scatt / realsamples; } I think this part of the code should do the work for sss per light output.. hmm let me try that... thanks Wolfwood Edited December 19, 2008 by kensonuken Quote Link to comment Share on other sites More sharing options...
kensonuken Posted December 19, 2008 Share Posted December 19, 2008 but is there anysource for dipole shader? 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.