Jump to content

Procedural, animated Landscape using Math only


minxomat
 Share

Recommended Posts

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

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

Link to comment
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.

Link to comment
Share on other sites

  • 2 weeks later...

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

Link to comment
Share on other sites

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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...