peliosis Posted August 6, 2006 Share Posted August 6, 2006 In sig02.course16.pdf page 57 we read: "the illuminance loop corresponding to the built-in diffuse() function. normal Nf = normalize(faceforward(N, I)); illuminance (P, Nf, PI/2) { Ci += Cl * (Nf . normalize(L)); } Which is a very easy stuff. I wrote in vex : #include <math.h> surface k_pharr_mattefalloff( vector mycolor = 0.2) { vector Nf = normalize(frontface(N,I)); illuminance(P,Nf,PI/2) Cf = mycolor + Cl * dot(Nf,normalize(L)); } Which works but leaves the unlit areas (PI/2 to PI I guess) constant white! Does illuminance loops differ between vex and rsl? What to do to correct it not using built-in functions ofcourse? I have similar problems with other examples from the paper (listings 3.2, 3.4, 3.7...) I hope this is not one of my stupid errors. Quote Link to comment Share on other sites More sharing options...
edward Posted August 7, 2006 Share Posted August 7, 2006 I know next to nothing about shading but some odd things occur to me in your code: - Do you need braces around your illuminance loop contents? - I don't see you accumulating the light colours. Do you mean to set Cf to mycolor outside the illuminance loop and then accumulate the the lighting results within? Quote Link to comment Share on other sites More sharing options...
peliosis Posted August 7, 2006 Author Share Posted August 7, 2006 In help illuminance loop looks like illuminance(){} , so in the shader it should look like surface mysurface() { illuminance(){ } } but it works exactly as my example. About the colour: In rman example there is "Cf +=" because it adds calculated Cf to default surface color (from rib?). AFAIK for light color there is "Cl" in illuminance loops in both rsl and vex. What I'm trying to do with "Cf = mycol + Cl*(blah)" is exactly to take some colour (instead of default surface) and add light colour multiplied by dot(Nf,L). Please explain me if this is wrong. There has to be an error because the result is as I wrote. Quote Link to comment Share on other sites More sharing options...
AndrewVK Posted August 7, 2006 Share Posted August 7, 2006 Goal of illuminance is: loop through ALL lights and GATHER illumination... #include <math.h> surface k_pharr_mattefalloff( vector mycolor = 0.2) { vector Nf = normalize(frontface(N,I)); //set global illumination = 0 vector lcol = 0; //loop through all lights illuminance(P,Nf,PI/2){ //add illumination of current light to global illumination lcol += Cl * dot(Nf,normalize(L)); } Cf = lcol * mycolor; } EDIT illuminance(P,Nf,PI/2) Cf = mycolor + Cl * dot(Nf,normalize(L)); } This means: Skip all lights except last, get illumination of last light and ???ADD??? some color. Quote Link to comment Share on other sites More sharing options...
peliosis Posted August 7, 2006 Author Share Posted August 7, 2006 Ouch Now, where should I send a beer ? Quote Link to comment Share on other sites More sharing options...
thx1138 Posted January 25, 2017 Share Posted January 25, 2017 (edited) Help me please. In my simple example neither frontface VOP nor frontface() VEX function work with illuminance loop. Maybe it's some bug with my version of houdini... fronFace_problem.hipc.hip Edited January 25, 2017 by thx1138 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.