Jump to content

Calculate velocity in screen space


sipi

Recommended Posts

15 minutes ago, haggi said:

You have a vex function called toNDC where you can use your velocity information to transform it to normalized raster coordinates. Even if it says it's only well defined in shading context it seems to work in sop as well.

yeah, i guess i have to do something with the NDC stuff, but not clear to me how

Edited by sipi
Link to comment
Share on other sites

image.thumb.png.50d66afe791f0e5bf7b4dfc2ab4cea7c.png@sipi maybe
 

//box ndc
vector offset = {0.5, 0.5, 0};
vector cameraScale = set(ch("camera_X"), ch("camera_Y"), 1);
if (@group_near)  @P = set(@P.x, @P.y, ch("near")*-1); 
if (!@group_near) @P = set(@P.x, @P.y, ch("far")*-1);  
vector xformpos = @P *  maketransform(0,0, offset,{0,0,0},cameraScale,{0,0,0}); 
@P = fromNDC(chs("camera_path"), xformpos); 

 

Edited by Librarian
  • Like 1
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...