Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / [DBP] - 3D wave

Author
Message
noobnerd
13
Years of Service
User Offline
Joined: 30th Nov 2010
Location:
Posted: 18th Mar 2012 17:19 Edited at: 18th Mar 2012 19:38
Hi!

I posted a primitive version of this in 20liners but this one has stuff that i didnt manage to squeeze into a mere 20 lines.

Its basically a way of simulating waves ( not real waves just fun looking ones ). Every point of the surface is drawn to its neighbouring points. this results in a cool wave effect. Also this code calculates the normals for the points ( rough ones ) and that normal is then used to color the surface to make it seem as if there was a light shining.

HOW to use:

press W/S to move forward/backward
use mouse to look
press SPACE repeatedly to soothe the waves
hold SPACE to pause ( you can still move )
hold leftmouse to select a point.
then move mouse up/down to influence that point to create waves
hold ENTER to stop the two moving points ( the ones that cause waves in the beginning )
Tap ENTER to put the light to camera orientation

HOW to tweak:

basefriction# = a lower value will make the waves dissipate faster, a value of more than one will make the waves increase in size
lineforce# = will increase the pull between the lines ( not reccomended to change)
gravity# = self explanatory
light# = increase light strength
diffuse# = increase ambient light strength# ( yeah wrongly named )
a and b (at the top) = the height and width of the surface
i use 80x80 but then i have a very good comp. you might want to try lower settings.

hope you enjoy it

OH it uses D3D_plugin


Login to post a reply

Server time is: 2024-04-19 19:20:33
Your offset time is: 2024-04-19 19:20:33