od[forum]: Area Light In Illuminance Loops? - od[forum]

Jump to content

  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

Area Light In Illuminance Loops?

#1 User is offline   geneome Icon

  • Peon
  • Pip
  • Group: Members
  • Posts: 37
  • Joined: 28-May 08
  • Location:Maryland/D.C., USA
  • Name:Eugene
  • [geneome]

Posted 16 December 2008 - 07:46 AM

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?
0

#2 User is offline   Jason Icon

  • King Tapir
  • PipPipPipPipPip
  • Group: Admin
  • Posts: 3,577
  • Joined: 08-November 00
  • Gender:Male
  • Name:Jason
  • Iversen

Posted 16 December 2008 - 08:42 AM

View Postgeneome, on Dec 16 2008, 07:46 AM, said:

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 :)
jason iversen
++odforce guy, and supervisor @ r+h
0

#3 User is offline   geneome Icon

  • Peon
  • Pip
  • Group: Members
  • Posts: 37
  • Joined: 28-May 08
  • Location:Maryland/D.C., USA
  • Name:Eugene
  • [geneome]

Posted 16 December 2008 - 09:21 AM

View PostJason, on Dec 16 2008, 11:42 AM, said:

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 :).
0

#4 User is offline   kensonuken Icon

  • Illusionist
  • PipPipPip
  • Group: Members
  • Posts: 311
  • Joined: 07-October 07

Posted 16 December 2008 - 12:28 PM

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;
}
}

0

#5 User is offline   Jason Icon

  • King Tapir
  • PipPipPipPipPip
  • Group: Admin
  • Posts: 3,577
  • Joined: 08-November 00
  • Gender:Male
  • Name:Jason
  • Iversen

Posted 16 December 2008 - 01:08 PM

View Postkensonuken, on Dec 16 2008, 12:28 PM, said:

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.
jason iversen
++odforce guy, and supervisor @ r+h
0

#6 User is offline   geneome Icon

  • Peon
  • Pip
  • Group: Members
  • Posts: 37
  • Joined: 28-May 08
  • Location:Maryland/D.C., USA
  • Name:Eugene
  • [geneome]

Posted 16 December 2008 - 02:04 PM

View PostJason, on Dec 16 2008, 04:08 PM, said:

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.
0

#7 User is offline   kensonuken Icon

  • Illusionist
  • PipPipPip
  • Group: Members
  • Posts: 311
  • Joined: 07-October 07

Posted 16 December 2008 - 07:51 PM

can u post the code..
0

#8 User is offline   Wolfwood Icon

  • Houdini Master
  • PipPipPipPip
  • Group: Members
  • Posts: 665
  • Joined: 11-February 03
  • Location:The Jim-nasium
  • Name:jim
  • price

Posted 17 December 2008 - 04:44 AM

Quote

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;
}

This post has been edited by Wolfwood: 17 December 2008 - 04:44 AM

"I enjoyed your talk today, but I didn't follow your derivation of the Jell-O Equation".
0

#9 User is offline   geneome Icon

  • Peon
  • Pip
  • Group: Members
  • Posts: 37
  • Joined: 28-May 08
  • Location:Maryland/D.C., USA
  • Name:Eugene
  • [geneome]

Posted 17 December 2008 - 07:21 PM

@kensonuken
Wolfwood beat me to it, but he's showing what I'm using (with diffuseBRDF being interchanged with other BRDFs when necessary).

This post has been edited by geneome: 17 December 2008 - 07:22 PM

0

#10 User is offline   kensonuken Icon

  • Illusionist
  • PipPipPip
  • Group: Members
  • Posts: 311
  • Joined: 07-October 07

Posted 18 December 2008 - 08:31 AM

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
0

#11 User is offline   Wolfwood Icon

  • Houdini Master
  • PipPipPipPip
  • Group: Members
  • Posts: 665
  • Joined: 11-February 03
  • Location:The Jim-nasium
  • Name:jim
  • price

Posted 18 December 2008 - 02:52 PM

View Postkensonuken, on Dec 18 2008, 11:31 AM, said:

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
"I enjoyed your talk today, but I didn't follow your derivation of the Jell-O Equation".
0

#12 User is offline   kensonuken Icon

  • Illusionist
  • PipPipPip
  • Group: Members
  • Posts: 311
  • Joined: 07-October 07

Posted 18 December 2008 - 06:34 PM

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

This post has been edited by kensonuken: 18 December 2008 - 06:37 PM

0

  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users