Jump to content
Sign in to follow this  
trili

how to ray on surface in vex?

Recommended Posts

yes, the "intersect" vex function does that:

 

vector p;
vector uvw;
vector raydir = normalize(chv("raydir"));
float raylength = chf("raylength");
int primfound = intersect(1,@P,raydir*raylength,p,uvw);
// copy primitive attribute from ray hit
@Cd=prim(1,"Cd",primfound);

 

  • Thanks 1

Share this post


Link to post
Share on other sites
11 minutes ago, bunker said:

yes, the "intersect" vex function does that:

 


vector p;
vector uvw;
vector raydir = normalize(chv("raydir"));
float raylength = chf("raylength");
int primfound = intersect(1,@P,raydir*raylength,p,uvw);
// copy primitive attribute from ray hit
@Cd=prim(1,"Cd",primfound);

 

Thanks!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×