Download

[TOOL TUTORIAL] Vector Fields from splines in 3ds Max

Hi everyone,

I’d like to share a Maxscript i’ve been working on to create vector fields for UE4 by using spline shapes in 3ds Max.

You can download VFShapes from here: https://dl.dropboxusercontent.com/u/1047231/VFShapes.mcr

Feedback is more than welcome. If you guys make anything cool with it, please post it in this thread, i’d love to see it!

Thanks.

Ruben Henares
Senior Technical Artist

This is insane! :eek:

Thank you Ruben!

I’m glad you like it Jacky. Let me know if you try it out and find any features you’d like to see added.

Wow…I’ll check it when i get home. I once made a VectorField generator using Maxscript with FumeFX but it didnt go well. :frowning:

That was going to be my next project actually. I’ve seen a few guys asking about VF tools for Max. What was it that went wrong?

That was awesome

Hello Ruben, I have been using this tool now for a bit (great tool! thank you for this!), and would love to use it in combination with VF Rotation rate (rotates the vector field) but when I move the pivot in 3dsmax to the center of the box instead of at the bottom (to give it a propper rotation) it wont accept it and resets it back to the bottom.

which results in this:

099cfde13fa25d842ab24488a6b21688882b5243.png

The rotation in the particle editor results in this if I move the pivot

(not moving one)

Any ideas? suggestions? did i miss something?

Hi Luos,

I see what you mean. The pivot point in 3ds max is not used in UE. If you want the pivot of the VF to be centered in Cascade, you need to position your splines and the template box centered in the world. The origin of the world will be the pivot point position of your VF.

Hope it helps.

Ahh, why didnt I think of that :slight_smile:
Thanks! works like a charm now!

Works great!!

the plugin works pretty well but if I do 64x64x, my computer becomes nearly unusable, completely slammed by whatever processing it’s doing…

Great work my friend, so happy you made this! One suggestion might be to allow to select different sizes, like 8x32, or 1x256 :slight_smile:

Let me know if I can help bug test or whatever. I am using max 2013. Thanks!

Hey,

Yes, maxscript isn’t very fast really, try disabling the previewing of boxes and vectors, that should really help.

It actually supports the sizes that you mentioned. The density setting only determines the number of voxels for the longest side, if you scale the bounding box non uniformly you can get whatever size you want, it doesn’t have to be square, it will round it to the nearest power of 2.

Thanks for the feedback! Let me know if you’d like any feature implemented or bug fixed.

Wow this looks amazing. Great job.

Should my computer be almost crashing with only 64x64? I don’t have the live update on… When I click “update” my computer becomes overwhelmed by whatever its doing…

is it slower with more complex splines? what number of vertices do you recommend keeping things under? In the example I used a text spline that spelled out my full name. is that too complex of a spline? I will try it again and optimize the spline and see if I dare try 256 :slight_smile:

Hello again,

The script is taking forever… so I figured I would take this opportunity to show you what I am working with, maybe I am doing something wrong. the 3 images pretty much show everything.

bb28c573056c18cdfb734ae12bc9811e83bf4bc8.png top1.PNG 84351b725c553187cd12f2c17967307467ea6ed2.png

I forgot to optimize the curves, but they couldn’t be more than 200 total…

Ok, so I optimized the curve, and started with 4x4. Worked fperfect, and took about 5 seconds…

Then I tried 8x8. no problem, took a bit longer…
then I tried 16x16. takes about 30 seconds…

So if I tried 128x128, I am thinking it will take 2 hours! Is that taking longer than it should?

UPDATE: I recreated the spline, simpler this time, and now I am trying 32x32 and… still going… it will most likely finish but is taking approximately … at least 5 minutes but it’s not finished yet… here is the current setup (I added red dots to show spline complexity):

Thanks in advance for your help!

~s

Hi,

It’s a script so it’s slow, it’s not multithreaded. The complexity of the spline doesn’t have a big impact, the main factor is the resolution of the grid. Take into account that it’s a 3d voxel grid.
So if your bounding box is perfectly square and you set the resolution to 8, it’s computing 8x8x8 = 512 voxels, increasing it to 16 is not twice as much, 16x16x16 = 4096 and 32x32x32 = 36864.

It’s not crashing is just taking exponentially longer.

The only thing you can do is try to adjust the bounding box pretty close to your splines on all 3 axis to reduce the number of wasted voxels.

It could definitely be optimized by using custom functions and an octree to find the intersecting voxels and moving the heavy processing code to .net to take advantage of multi threading. But I haven’t had the time to do that.

hey again!

That makes sense, I tried making a 1x64 and it was quite fast. I forgot to take a screenshot of it, but here is the 32x1 version:

df28bcccd26086f6903d4fc09e5e01814ad66952.png

One issue I am having is the direction of the flow. I see there are parts to the voxel array, voxels hit and voxels not hit. is there a way to assign a force to the voxels hit? Would it make sense if I wanted voxels hit to “leave” and voxels not hit to attract? or vice versa? And I have a couple more questions, if you don’t mind :slight_smile:

Do the length, width, and height segments affect the VF at all?

What is the general rule regarding vector size?

Also, In my mushroom cloud experiment from before, the flow of force came out strange.

bb28c573056c18cdfb734ae12bc9811e83bf4bc8.png

I couldn’t get the particles to go up through the main shaft and then curl around, they would only curl around if the particles came from above the mushroom cloud top. I will experiment with it more to see if I can make the particles behave, this is still new to me but I a m catching on quick! :slight_smile:

This is an excellent plugin! Guess I won’t be putting off learning particle systems now. Can’t wait to try it out. In terms of features, however, in order to speed up the processing of the voxels, you might want to try and allow the user to define what voxels will not be used, like having them place geometry in areas that will not be used and having the voxels check for that geometry.

That a super handy plugin man! Thx for sharing.

currently trying to export a 128 density complex vector field setup.
Maybe I should book a vacation :slight_smile:

Nontheless, I am so enjoying this plugin!
So once more, thanks!

Edit:

That looks pretty awesome man!
I’ve been pretty busy lately but I’ll try to work on version 2 soon after seeing what you guys are doing.