Dubtronics Posted March 29, 2018 Share Posted March 29, 2018 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 Quote Link to comment Share on other sites More sharing options...
3dome Posted March 29, 2018 Share Posted March 29, 2018 (edited) 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 March 29, 2018 by 3dome forgot line of code 1 Quote Link to comment Share on other sites More sharing options...
konstantin magnus Posted March 29, 2018 Share Posted March 29, 2018 Alternatively: @Cd = vector(relbbox(0, @P)).y; Quote Link to comment Share on other sites More sharing options...
Dubtronics Posted March 29, 2018 Author Share Posted March 29, 2018 Thank you, I will try that. I tried something similar but i wasnt able to get the gradient just a solid color. I wanted to try to do it in VOP because i feel more comfortable with a node base approach rather than VEX code. Quote Link to comment Share on other sites More sharing options...
konstantin magnus Posted March 29, 2018 Share Posted March 29, 2018 5 hours ago, Dubtronics said: try to do it in VOP vertical_gradient.hipnc 1 Quote Link to comment Share on other sites More sharing options...
Dubtronics Posted March 29, 2018 Author Share Posted March 29, 2018 Thanks for different methods really helps me to understand the way things work. 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.