Jump to content

Message passing aggghhhrrrr


AndrewVK

Recommended Posts

Could anybody explain me what wrong have i done while translating from SL

into VEX shaders, which use message passing?:unsure:

In VEX there seems to be no message passing at all :o

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;

}

===================================================================

Link to comment
Share on other sites

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. B)

For VEX, you have to specify which parameter is to be exported(message passing).

Link to comment
Share on other sites

Thank You Steven!!!!!!!!!!!

Finally i`ve begun to study VEX.

"export" works,workS,worKS,wrRKS,wORKS,WORKS!!!:D :D :D :D :D :D

It`s definitely strange this "magic word" can`t be found in the doc.

.....time to finish optimized volume spotlight shader:)

Link to comment
Share on other sites

  • 3 weeks later...

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?:ph34r:

I try:

if (dot(lightdirection,(inersectionpoint-lightorigin)) >= 0)

...but it doesnt work correctly. And i cant understand WHY.:blink:

Can You explain me whats wrong?:unsure:

http://andrewvk107.narod.ru/RayBox/Phantom.jpg (rmb, save target as)

http://andrewvk107.narod.ru/RayBox/shaders.zip (rmb, save target as)

Link to comment
Share on other sites

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()?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...