Sign in to follow this  
Followers 0
minxomat

Procedural, animated Landscape using Math only

7 posts in this topic

#1 ·  Posted (edited)

Hi there.
 
This script is an implicit function plotter, plotting a graph that simulates a landscape.
 
Basically, everything you see in this picture is based on implicit equations and functions. I modified the original equations a bit and added animation for the sea, a moving sun and two different kinds of lighting.

  • Procedural Scene (only per-pixel-colors are calculated, no drawing function is used)
  • Animated sea waves
  • Animated sun
  • Ambient light
  • Directional light

The animation has 60 Frames and runs @30FPS. The animation must be pre-buffered due the massive calculations done for every pixel, this takes approximately 5 minutes (get a coffee ;) ).
 
Here are the equations I used in the final version (don't change anythin in the script, except you want to redo all the math):
 
Tree trunks: trunks665e.gif
 
Light leaves: leavded6e.gif
 
Dark leaves: leavh0f27.gif
 
Ground: ground19fa.gif
 
Water: water239a.gif
 
The Sun: suneb32.gif
 
Movement of the Sun: sun2eb42.gif
 
Calculation of the RGB values: rgb6d0b.gif
 
 
If you really can't wait 5 minutes for the animation to calculate, here is a GIF (rendered with GDI+):
 

landscape_6976.gif

Have fun  :sorcerer:

LandScape.au3

Edited by minx
4 people like this

I will answer every single PM, and you are free to ask anything anytime.

Share this post


Link to post
Share on other sites



Thank you, minx for this excellent example!

Very well done!

This could also be a good teaching tool and inspire interest in higher mathematics!

Share this post


Link to post
Share on other sites

A bit more math. (Well, not too complicated math). The color of the sun and the sky are now calculated, too. As well as the effect of the redness of the sun on the whole scene. I attached the script. (I can add the formulas if anyone is interested).

landscape.au3


I will answer every single PM, and you are free to ask anything anytime.

Share this post


Link to post
Share on other sites

Heh, the gif animation reminded me of this.


2015 - Still no flying cars, instead blankets with sleeves.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

I re-wrote the frame drawing code (the "heavy" math path) in C++ and compiled it to .dll -- attached below, source included.

It takes about 10 seconds to render all the frames.

It kinda tells you how slow the AutoIt interpreter is.

Could you post the code you used to render the .gif file?

Landscape .dll ver.7z

Edited by DatMCEyeBall

"Just be fred, all we gotta do, just be fred."  -Vocaliod

"That is a Hadouken. A KAMEHAMEHA would have taken him 13 days and 54 episodes to form." - Roden Hoxha

@tabhooked

Clock made of cursors ♣ Desktop Widgets ♣ Water Simulation

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Updated the script above using static linking (you don't need the Visual C++ Redist) and with the "_xp" tools (can run on win XP(for all you old people))

Edited by DatMCEyeBall

"Just be fred, all we gotta do, just be fred."  -Vocaliod

"That is a Hadouken. A KAMEHAMEHA would have taken him 13 days and 54 episodes to form." - Roden Hoxha

@tabhooked

Clock made of cursors ♣ Desktop Widgets ♣ Water Simulation

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0