AndrewVK Posted July 11, 2002 Share Posted July 11, 2002 Could anybody explain me what wrong have i done while translating from SL into VEX shaders, which use message passing? In VEX there seems to be no message passing at all RenderMan SL ==================================================================== light messagetest( float intensity = 1; color lightcolor = 1; color test = (1,0,0); point from = point "shader" (0,0,0); float atten = 1.E6; ) { illuminate(from) Cl = (intensity * atten / (atten + sqrt(L.L))) * lightcolor; } ==================================================================== surface test() { color test; color Clr; normal Nn; vector Ln; Nn = faceforward(normalize(N),I); Clr = 0; illuminance( P, Nn, PI) { if (lightsource("test",test)==1){ Ln = normalize( L ); Clr += test * Ln.Nn; }else{ Ln = normalize( L ); Clr += Cl * Ln.Nn; } } Ci = Clr; } ==================================================================== VEX ==================================================================== light messagetest( float intensity = 1; vector lightcolor = 1; vector test = {1,0,0}; float atten = 1.E6; ) { Cl = (intensity * atten) / (atten + length(L)) * lightcolor; } =================================================================== #include <math.h> surface test() { vector test; vector Clr; vector Nn; vector Ln; Nn = frontface(normalize( N ),I); Clr = 0; illuminance( P, Nn, M_PI) { if (limport ("test",test)==1){ Ln = normalize( L ); Clr += test * dot(Ln,Nn); }else{ Ln = normalize( L ); Clr += Cl * dot(Ln,Nn); } } Cf = Clr; } =================================================================== Quote Link to comment Share on other sites More sharing options...
stevenong Posted July 11, 2002 Share Posted July 11, 2002 Hey Andrew, How've you been? It's been a while since I converted your Stained Glass shader. To answer your question, VEX does message passing. From your code: light messagetest( float intensity = 1; vector lightcolor = 1; vector test = {1,0,0}; float atten = 1.E6; Just do this: export vector test = {1,0,0}; Now, your geometry will be shaded red. For VEX, you have to specify which parameter is to be exported(message passing). Quote Link to comment Share on other sites More sharing options...
AndrewVK Posted July 11, 2002 Author Share Posted July 11, 2002 Thank You Steven!!!!!!!!!!! Finally i`ve begun to study VEX. "export" works,workS,worKS,wrRKS,wORKS,WORKS!!! :D :D :D It`s definitely strange this "magic word" can`t be found in the doc. .....time to finish optimized volume spotlight shader:) Quote Link to comment Share on other sites More sharing options...
stevenong Posted July 11, 2002 Share Posted July 11, 2002 You're right. I can't find anything on export in the documentation anywhere. I'll pass this along to SESI. Can't wait to use your optimized volume spotlight shader. However, I can't convert your shaders to VEX anymore. Quote Link to comment Share on other sites More sharing options...
AndrewVK Posted July 27, 2002 Author Share Posted July 27, 2002 Hey Steven! I need some help whith this shader!!! My english is probably bad...so please be patient. Ok...basic idea: 1.Get some info from light(s) (position,direction,coneangle,conelength) 2.Test current ray for intersection with current lights cone. 3.If inersection occurs then perform raymarcher from IN point to OUT point if no...then do nothing. I`m not math guru...so i just pick up "Line_vs_Cone" equation from inet. It works fine but solves phantom cone too The question is how to kill phantom? I try: if (dot(lightdirection,(inersectionpoint-lightorigin)) >= 0) ...but it doesnt work correctly. And i cant understand WHY. Can You explain me whats wrong? http://andrewvk107.narod.ru/RayBox/Phantom.jpg (rmb, save target as) http://andrewvk107.narod.ru/RayBox/shaders.zip (rmb, save target as) Quote Link to comment Share on other sites More sharing options...
stevenong Posted July 27, 2002 Share Posted July 27, 2002 Hey Andrew, I'll try to understand the raycone() function first then I'll see what I can do. Also I'm not too knowledgable with VEX or shading writing so I'll probably not able to help you much. Have you tried using the light direction, Lz, to control calculation of the raycone()? Quote Link to comment Share on other sites More sharing options...
AndrewVK Posted July 27, 2002 Author Share Posted July 27, 2002 You can read about raycone math here: http://www.hugi.de/main.php?page=hugi24#download I use normalize(Lz) as light direction. (message from volspot shader) Quote Link to comment Share on other sites More sharing options...
stevenong Posted July 28, 2002 Share Posted July 28, 2002 I haven't any results to share with you. It also puzzles me why dot(V,(P1-C)) is causing the extra cone. I'll try & let you know if I get any results. Quote Link to comment Share on other sites More sharing options...
Stremik Posted July 28, 2002 Share Posted July 28, 2002 There is a pdf file called "vex_theory.pdf" available for download from SideFX site in the Rendering section. In that file there is some info about message passing between shaders in VEX. Not a lot of it, just one page but still... maybe you will find it usefull. 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.