3D lighting + 3D Verlet Integration physics [Source]

Post your Construct-made creations!

Post » Thu Dec 30, 2010 10:08 pm

Another random programming test. 3D physics using verlet integration, and 3D lighting using vectors cross products to find normals and vector dot products to find angular differences.

Controls are mouse click and mouse wheel to manipulate.


http://dl.dropbox.com/u/1010927/Verlet%20Cube.cap

sometimes the normals flip because my physics implementation doesn't iterate for increased stability/accuracy
B
52
S
7
G
6
Posts: 1,945
Reputation: 7,610

Post » Fri Dec 31, 2010 4:06 am

Dude... seriously. Very cool!
B
3
S
1
G
4
Posts: 42
Reputation: 1,609

Post » Fri Dec 31, 2010 4:06 am

Brilliant! :)
My professional Royalty Free Music at Scirra Assets Store
--------------------------------
Specs: i5 2500, 16gb of ram, gtx 770, win 7, Focusrite Scarlett 8i6, Mackie mr8mk2, Alesis 320, browsing the net on chrome.
B
71
S
19
G
19
Posts: 1,919
Reputation: 16,910

Post » Fri Dec 31, 2010 7:44 am

man, how can you come up with such stuff so quickly? :shock: brilliant!
some questions though-
I too know quite a bit about vectors but still have no idea about how to use them for lighting, any articles for help??
Meanwhile i'll search for verlet integration :)
B
9
S
3
G
3
Posts: 366
Reputation: 2,301

Post » Fri Dec 31, 2010 7:48 am

seriously impressive
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Fri Dec 31, 2010 9:11 am

Very impressive.
Might I suggest you try turning this into a plugin once you have the dev system setup.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
120
S
28
G
68
Posts: 4,841
Reputation: 48,283

Post » Fri Dec 31, 2010 12:07 pm

[quote="lucid":1g0nufwv]seriously impressive[/quote:1g0nufwv]

Indeed, frame rate is pretty much constant, even at 8x multisampling.
Image Image
B
161
S
48
G
90
Posts: 7,347
Reputation: 66,749

Post » Fri Dec 31, 2010 1:33 pm

Doing something like this with events as a finger exercise - I bow deep to your wit.
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Fri Dec 31, 2010 4:30 pm

HOLY (BEEP) ON A (BEEP) SANDVICH

This is freaking awesome! The things you can do with Construct are absolutely incredible! Man...
B
94
S
37
G
11
Posts: 404
Reputation: 11,275

Post » Fri Dec 31, 2010 5:54 pm

for lighting I used two edges of the cube as vectors per face found the cross product to get a 3rd vector that gave me the normal of the cubes face, and then found the dot product of that normal vector and an unchanging "light direction vector" (specified with the variables 'Lx' 'Ly' and 'Lz') that belong to the object L (L is just an object i use to store variables, because its faster to write L than global('etc') all the time), anyways, i find the dot product using the components of the two vectors, then i find the norm of those vectors with distance formula sqrt(x^2+y^2+z^2), the norm of the light is precomputed in the variable ('Ln'). with the norms and the dot product i can get the angle between the vectors that they form in their unique plane, by dividing the dot product by the product of the two norms, and then finding the arccosine of that value. the lighting from therein is just setting the filter of the face to a scaled value of that angle difference. R=G=B=('Anglebetween'/180)*255
B
52
S
7
G
6
Posts: 1,945
Reputation: 7,610

Next

Return to Your Creations

Who is online

Users browsing this forum: No registered users and 3 guests