Jump to content

Beginner Question, Calulate Y Length


Recommended Posts

Hi,

I am trying to calculate the y distance of a cached fluid sim in a tank. and I would like to have a color going from from black at the bottom and white at the top. The idea is to then use this in Mantra to drive the roughness of the transparency or the tint to create an ocean shader. I am trying to do this using a vopsop, I have tried various methods that other people have tried and I can only get it partially right. most of the time it seems to be calculating the distance from the center rather than the Y distance. In the file attached I get the gradient at an angle rather than straight up. 

I am totally new to this and any help would be appreciated.
 

points_from_volume.hip

Link to comment
Share on other sites

I'm at work so cant download the file but have you tried using the bounding box to drive the color? in a wrangle it would be something like

vector min, max = {0,0,0};
getbbox(0, min, max);
float remap = fit(@P.y, min.y, max.y, 0, 1);
@Cd = remap;

Edited by 3dome
forgot line of code
  • Thanks 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...