3d wind (pardon)

Community Forums/Graphic Chat/3d wind (pardon)

AdamStrange(Posted 2014) [#1]
Further to the tree generation, Wind has now been added:
Here are a couple of quick gifs showing the live results direct from the 3d view:
First a tablecloth


and now a primitive flag



Rick Nasher(Posted 2014) [#2]
Wauw. Pretty neat.


degac(Posted 2014) [#3]
O. O Nice effect!
It's precalculated I suppose!


Brucey(Posted 2014) [#4]
Heh, cool, the flag is walking! :-)


AdamStrange(Posted 2014) [#5]
no, it's realtime

each model has the following:
bend - how much the wind will affect it 0=none, 1=lots, 10=loads
wind jitter - how much of a random effect is applied (the waviness)
wind jitter speed - how fast is the random effect

for each vertex, you then need to set how much the wind will affect it. This is actually quite simple as it is all handled from the UI with soft selections which you can add and minus, there is also a power function so you can get very small variations


The wind is calculated per model as follows:
wind has a y direction (y rotation) and an up direction (x rotation) plus a wind power.
The wind vector is calculated and that is applied to the model

It's very dirty, but very quick. I'll see about doing a demo with wind moving and not the camera


Derron(Posted 2014) [#6]
The flag-model: when you rotate it to the "right side" - it looks like if the handle gets "white shaded" triangles... mixed with odd shading.

Make sure you save each "effect" separately, so you could switch on/off effects during runtime "wind/no wind".



bye
Ron


AdamStrange(Posted 2014) [#7]
yep, the handle does have white triangles - it's not a bug or a shading error. it is actually the shader I was using, this was really just a quick demo of the wind :)

Here's a quick shot showing different wind strengths.
This time I've actually got a material with alpha in it (no bitmaps were harmed in the process)


so you could switch on/off effects during runtime "wind/no wind

Wind itself is per model, per frame, so it can be moved, changed power, change direction, on/off, etc as you wish.

My thoughts are to have some form of vertex cloud for the wind that gets updated once per frame, propagating the wind


Hotshot2005(Posted 2014) [#8]
This wind would be good for tree, grass and so on :)


GfK(Posted 2014) [#9]
There's something not right about that last one - looks like the vertices are locked on all but one axis? I can't tell if the others have this problem too as they don't show it from a suitable angle.


Derron(Posted 2014) [#10]
I think I see what GfK meant: The texture is stretching, so it is really only moving along one axis instead of keeping the distance between the other connectec vertices constant (stiff clothing).


bye
Ron


GfK(Posted 2014) [#11]
The texture is stretching, so it is really only moving along one axis instead of keeping the distance between the other connectec vertices constant
Yeah, that!


AdamStrange(Posted 2014) [#12]
yep, the deform is locked to the direction of the wind - the block with the W inside. You can see the wind direction (in that example) is from back to front, so there is no side-to-side movement.

But...
Wind can be at any any not just 90degrees.

My thoughts are that wind should be in constant angular motion, which would prevent exactly this situation.

I can certainly add wind wobble (side to side movement) though


Derron(Posted 2014) [#13]
you do not need "wobble".

if you take a sheet of paper ... and simulate wind by blowing towards it, it does not stretch - it even does not move to the left or right (most of the times - depends on the stiffness and of course if your blowing angle is a normal vector of the papers plane).

But... the paper "bends" - so if you mark the middle of the paper, the distance ON the paper from "middle" to "wind adjusted corner" will still be the same (NO stretching).

So in your case: the flag is planar on XY, the wind comes along Z axis. So the vertices of the flag will not only move along "z", they will eg. move along "y" to compensate stretching. Y in that case is the axis affected by gravity.
Why? because forces always could accumulate:
- wind force
- gravity force

vertex is by default going to "ground" (if gravity is positive), the wind is trying to move the vertex away from this, so windForce-vector + gravity-force-vector will get added to each other forming a resulting force-vector. Use this vector to move the individual vertex.

Ah ... and of course you have some kind of "chain" between vertices so a vertex wont "fall to the ground":

pinned vertex: not affected by gravity, vertices not pinned calculate their forces then by distance to the pinned vertex (or better: direct neighbors which have their force already calculated). Influence of the "pinned vertex" is configured using a "stiffness factor" (leather: vertices far away still do not bend much, while with silk a vertice with a distance of 1cm will already have get a big influence of the wind/forces).


you could surely simplify the whole process but you might run into trouble in the future ..with behaviour being "odd" or "unwanted".
Simplify: Just limit the strength of the wind so stretching is not visible :D. Do some kind of "constant vertex distance"-check.


bye
Ron


AdamStrange(Posted 2014) [#14]
yep, fully understand that. But... What you are talking about is a physics modeller, soft body deformation, springs, etc

This is very quick, and (as stated) very dirty. If you crank up the values, you get a complete mess - lol