AWS Thinkbox Discussion Forums

Magma Min/Max

Forgive me if I missed this, is there a Min/Max node? For instance I want the min/max magnitude of a vector. I can get this out in box#3 is there a magma way? I know I can debug grab values->input float->ect. Asking if there is a one node way I guess.

The latest version of Magma in KMX has a Loop node, so it would be possible to do a custom loop to figure out the values, but unfortunately it would be very very slow because it would loop once per particle. So if you have a million particles, you will be causing a TRILLION iterations (a million iterations for each of a million particles).
Normally, Magma iterates once over all particles in the stream and has no knowledge of the other particles’ properties (which makes it faster).
A possible solution for this in the future would be a “pre-pass” Loop that is run only once (instead of once per particle) that can do an explicit loop using the Loop node and collect any relevant data you might be interested in, then pass it on for the real Magma Modifiers to access. Or it could be a special class of Run-Once Magma Modifier, or even a checkbox in the existing Magma that causes it to run just once…

We have not decided internally how we would like to deal with this in the future. For Genome where the number of iterations is typically smaller, we tend to pre-generate special channels like ElementVolume etc. by performing a pre-pass internally, collecting and summing face areas and volumes etc. to provide pre-chewed data inside the flow. But for general purpose pre-calculations, we still need a more elegant approach that does not cause nested loops to get out of hand.

Sure I can understand about the slowness factor, for sure.

I was thinking about just making a script op and checking to see where you pull the data from for the Debug table.

I like those ideas, in most cases would be totally fine or grabbing a sample at frame X where most particles were active or a sampling level of every x frames would totally suffice!

The overall usefulness of being able to grab values on the fly instead of educated geusstimation would be a ton quicker. Setting up dumb nodes is fine when you don’t have to change your values often.

Right now you cannot ask for the average velocity on ALL frames anyway. If we add those options I mentioned, they would ask at the CURRENT time, which might be bad because then the min/max/average would be changing on each frame as particles come and go.

I think we could expand the PRT saver in an 1.2 update to include metadata like Min/Max/Mean/Average for every channel, but then it would not work for non-PRT sources.

IMHO, having to measure the value manually over multiple frames in order to enter it as a constant is actually a better, cleaner and safer solution. But it requires an update each time your source changes.

A scripted solution that uses the functionality employed by the Debugger but without having to open the Debugger sounds like a good idea. We could have a button in the InputVector that lets you set a constant value based on a picked (or current) particle system’s Min/Max/whatever of any Vector channel. Same with Floats and Integers. It would be a manual update process, but it would automatically run through frames and particles, do the calculations and put the value in there.

Will log this as a wish…

Sure, too much variance for an accurate average BUT sometimes it is just plain good enough. It is pretty much what we do know with a couple of inputs with semi-arbitrary values in them to blend/mult/divide with anyway. Agreed,yes bad because sometimes you need a solid value for something like color values where inaccuracies would make a big difference in look.

I think the spacial sampling is perfect. Like a x duration sample at frame x?

I like that! Manual Input update, that would work for any particles you could use right?

Could I add one other small wish? What are the chances of having a small Preset listbox for Script Nodes (like the base modifier presets)? I mean I have only a couple that I use but it could be kind of useful, that is if it wouldn’t take away too much time from other things to implement. It would certainly help keep me from forgetting small useful things.

I think that should be useful and doable. Will log it.

Privacy | Site terms | Cookie preferences