Jump to content
Adam Ferestad

Finding the Min/Max values in a field?

Recommended Posts

I am trying to figure out how to get the converse of a field, mathematically.  I am attempting to blur a Cd field in using a Gas Blur microsolver.  I have some mixed results, but I want to get some finer control over the radius, namely that I want it to blur more as it slows down.  I have used the gas analysis microsolver to get the speed field by taking the length of the velocity, but I can't figure out how to get larger values to be in the lower speed areas.  Obviously I would love to use a fit to invert the values, but I am struggling with an elegant way to get the minimum and maximum values for a given field.  I could easily just do a loop in a wrangle and get the min/max values that way, but that is going to be extremely slow as this is a very large, dense simulation.  Is there a simple way I can get the min/max values in a field so I can use fit(@speed, min, max, max, min) in a Gas Field Wrangle node to get the converse of my field?

Share this post


Link to post
Share on other sites

hscript volumemin() and volumemax()
if you open the Textport, type: exhelp volumemax

 

Edited by bunker

Share this post


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

hscript volumemin() and volumemax()
if you open the Textport, type: exhelp volumemax

 

Are you suggesting that I need to use hscript to do this?  There is no way directly in VEX?  Or is hscript a command in VEX that I was unaware of?  I can't figure out how to use HScript within my DOPs context.  I have done it in SOPSolver nodes in the past, but never in DOPs.  Also, how to pass the value downstream to other wrangle nodes?

Edited by Adam Ferestad

Share this post


Link to post
Share on other sites

there isn't anything in vex to do that directly but you can reference the hscript output value in vex, eg:
 

float maxvalue = chf("maxvalue");

create a spare parameter, then you can enter your hscript expression there:
volumemax("/obj/geo/myvolume", 0)

Share this post


Link to post
Share on other sites
2 hours ago, bunker said:

there isn't anything in vex to do that directly but you can reference the hscript output value in vex, eg:
 

float maxvalue = chf("maxvalue");

create a spare parameter, then you can enter your hscript expression there:
volumemax("/obj/geo/myvolume", 0)

I actually ended up trying something similar to this, but within DOPs I couldn't seem to get the function to target the field.  It always returned 0.

Share this post


Link to post
Share on other sites

there is also Volume Reduce SOP and Gas Reduce DOP for that

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

×