Mesh distortion

Post your own tutorials, guides and demos.

Post » Wed Aug 27, 2008 10:46 am



I am currently working on a feature of sprite which allows it to render using multiple quads which can be deformed. I noticed it was a feature in the HGE engine, demonstrated by this tutorial http://hge.relishgames.com/files/hge_tut05.zip.

At the moment you can individually move the vertex and change their colour and uv co-ordinates. However, it means you have to use 2 for loops and write long expressions.

Construct is all about speed and ease of development, so I'm asking you guys if theres any kind of distortion you would like me to make built in. Attached is a template, just modify the second event and upload the example on the forum.
B
4
S
2
G
5
Posts: 641
Reputation: 3,011

Post » Wed Aug 27, 2008 10:52 am

This is a kind of flappy flag like effect
B
4
S
2
G
5
Posts: 641
Reputation: 3,011

Post » Wed Aug 27, 2008 11:14 am

And heres an exe of the above but with a mesh instead of just points
B
4
S
2
G
5
Posts: 641
Reputation: 3,011

Post » Wed Aug 27, 2008 2:39 pm

Awesome effects - those all should be built in :D. I can imagine the underwater scenes made possible by those effects! Even though it would be possible to do with loops and expressions, ease of development is important so add them. (And effects coded with C++ are faster, too...)

Edit: Oh, I forgot. What kind of distortions I would like to have... You know, when a water drop drops to a puddle it creates circular wave. That kind of effect would be nice... and some kind of "punch" and "pinch" effects.
B
3
S
2
G
5
Posts: 263
Reputation: 2,201

Post » Wed Aug 27, 2008 3:37 pm

Please keep it so that we can affect the points using events! All sorts of neat stuff will be possible in that situation! :D

Would we be able to set behaviors to the points? Then we can use physics behavior and make all sorts of neat stuff!

Some thoughts are demonstrated in this video of Aquaria: http://www.youtube.com/watch?v=G40cXjcz-9c

First at 17 seconds, the main character swims past a banner and it waves with her. Then at 38 some underwater plants bend as she swims past, and again at 41. It's kinda hard to tell, but the plants bend at the proper place - if she swims past the tip, then the tip moves.

I guess what I'm asking is if it would be possible to make the points move in response to a nearby object, but very importantly, have a settable maximum distance that the parts of the mesh can be from each other? Wouldn't want it to get too wild.

At 56 there's an octopus that has a tentacle that bends, apparently using bones. Would it be possible to have a sort of bone based system - using bones to deform a sprite? I would imagine it working sort of like the custom mask for physics objects at the moment. Either that or could we attach points to another object? Like using 'create hinge' in the physics behavior - then we could rotate sprites via events to move groups of points.

Also, would it be possible to choose the resolution of the grid? (to save on performance, etc.)

I realize this is a lot to ask, so think of it more as food for thought. :)
Moderator
B
88
S
32
G
33
Posts: 3,005
Reputation: 27,432

Post » Wed Aug 27, 2008 4:02 pm

hehe yeah i played that game thats what inspired me to add this feature!

There will still be actions to set the points individually, i just wanna add some premade effects so people can be like 'hmm...i wanna make it wave a little...but how!? oh theres an action...cool!'
B
4
S
2
G
5
Posts: 641
Reputation: 3,011

Post » Wed Aug 27, 2008 4:06 pm

I tried to create a circular wave and played little around. I got this funky effect :D. That mesh is pretty fun to experiment with if you know some trigonometry.
B
3
S
2
G
5
Posts: 263
Reputation: 2,201

Post » Wed Aug 27, 2008 5:19 pm

[quote="Arima":bv50jryq]First at 17 seconds, the main character swims past a banner and it waves with her. Then at 38 some underwater plants bend as she swims past, and again at 41. It's kinda hard to tell, but the plants bend at the proper place - if she swims past the tip, then the tip moves.[/quote:bv50jryq]

That looks more like a pixel shader to me. I think you'll get a really nice effect like that with the Magnify pixel shader.
Scirra Founder
B
359
S
214
G
72
Posts: 22,951
Reputation: 178,578

Post » Thu Aug 28, 2008 1:08 am

[quote="David":3rn80oip]i just wanna add some premade effects so people can be like 'hmm...i wanna make it wave a little...but how!? oh theres an action...cool!'[/quote:3rn80oip]

Ah, good then. I'm not good enough at math to make any decent looking ones on my own. If there were settings to fiddle with, then I'd be able to come up with something neat looking through trial and error.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Thu Aug 28, 2008 2:10 am

Spiral effect. You can do some call stuff if you express the points in polar coordinates (ie. the angle and distance from the center), so you can play with the angle and distance instead of just the X and the Y.

Maths for the win!
Scirra Founder
B
359
S
214
G
72
Posts: 22,951
Reputation: 178,578

Next

Return to Your tutorials & example files

Who is online

Users browsing this forum: No registered users and 0 guests