old school Posted June 23, 2005 Share Posted June 23, 2005 Pretty much all of the surface VOPs in the Material folder in a surface VOP network contain Lighting Model VOPs. Fine if you use one of these as the basis for the entire material that you are building. The downfall is if you start to mix two or more material VOPs together with say a Color Mix VOP. You are effectively calling the illuminance loops on all the lights illuminanting the surface two times. Mix in a third material and you increase this to three times. Add more materials and mix in at your peril. Start to build better illuminance loop VOPs that generate deep rasters (AOV's) with intelligent ligth message passing and it get's real complicated real fast. I have seen some Slim shader networks that contain several illuminance loops unbenounced to the slim artist several times in the past. Isn't this a recipe for disaster due to incresed render times and pipeline complexity or am I way off in my assumption. The big question is: Should we be mixing color fed in to a single lighting model VOP or be mixing the result of two or more ighting models? I am sure some of you will see where this is leading. Is this an issue that a VOP shader writer artist needs to worry about? Quote Link to comment Share on other sites More sharing options...
Wolfwood Posted June 24, 2005 Share Posted June 24, 2005 It comes down to flexibility/ease vs. speed. (As always) Most shaders have at least two illuminance loops already (diffuse() & specular()). The diffuse and specular calculations can easily be done in the same loop and it is a little bit faster. If I was doing a short film at home where I only have one or two computers and I was the only one who had to worry about the shader code I would probably use the multiple illuminance approach until I was really happy with the look of everything, then I would go in and do a major optimize pass. Like get rid of some parameters, combine illuminance loops etc. But I would only do that if it was just me and I was my own director. Otherwise lots of mixing different functions with illuminance loops like a specular() diffuse() clay() etc etc in a studio environment isn't the most efficient way when it comes to CPU time but its very efficient when it comes to user time. surface singleLoop() { vector Nn = normalize(N); vector In = -normalize(I); vector C = 0; illuminance(P,Nn,1.5708) { vector Ln = normalize(L); vector H = normalize(Ln+In); C += Cl*(dot(Nn,Ln) + pow(max(0,dot(Nn,H)),1/.1)); } Cf = C; } Render Time: 1:06.15u 1.02s 1:07.72r Function Excl. Incl. Calls Instructions Instr. Local Secs Secs Per Call Storage ------------------------------------------------------------------------------ opdef:/Shop/singleLoop 9.07 10.57 29,404,617 582,837,913 19.82 20,556 opdef:/Shop/v_asadlight 1.50 1.50 29,404,617 264,641,553 9.00 3,096 ------------------------------------------------------------------------------ Invocations Instruction 259,690,261 set 112,667,176 normalize 110,191,530 add 56,333,588 mul 56,333,588 nlight 53,857,942 dot 29,404,617 blight 29,404,617 div 29,404,617 length 29,404,617 neg 26,928,971 jump 26,928,971 max 26,928,971 pow surface twoLoop() { vector Nn = normalize(N); vector In = -normalize(I); vector C = 0; illuminance(P,Nn,1.5708) { vector Ln = normalize(L); C += Cl * dot(Nn,Ln); } illuminance(P,Nn,1.5708) { Ln = normalize(L); vector H = normalize(Ln+In); C += Cl * pow(max(0,dot(Nn,H)),1/.1); } Cf = C; } Render Time: 1:07.07u 1.00s 1:08.31r Function Excl. Incl. Calls Instructions Instr. Local Secs Secs Per Call Storage ------------------------------------------------------------------------------ opdef:/Shop/twoLoop 10.51 12.04 29,404,617 776,292,002 26.40 19,528 opdef:/Shop/v_asadlight 1.52 1.52 29,404,617 264,641,553 9.00 3,096 ------------------------------------------------------------------------------ Invocations Instruction 286,619,232 set 139,596,147 normalize 112,667,176 nlight 110,191,530 add 83,262,559 mul 58,809,234 blight 53,857,942 dot 53,857,942 jump 29,404,617 div 29,404,617 length 29,404,617 neg 26,928,971 max 26,928,971 pow 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.