Results 1 to 4 of 4

Thread: Lava Lamp

  1. #1

    Lava Lamp

    I searched in vain for perlin noise implemented in ThinBasic. So decided to create something similar, based on random numbers, but easily controllable. I came up with the idea of a sparse array with some randoms numbers and a second detail array which interpolates over the random numbers using cosine interpretation to ensure smooth transitions. I had to precompile the cosine values and the hues to get some performance improvement. I did try and convert it to Oxygen but I couldn't work out how to pass two dimensional arrays. But the code runs reasonably "as is" on my 5 year old laptop.

    I am using the basic smoothed set of random numbers to create the image. I then evolve the array by a set of small delta random numbers which shifts the values in a controlled way. I then take a small percentage of the base random numbers set and add them to the row above to create the "rising" effect. I am using random numbers, but you can put anything into the base array. If the regular coordinates is a concern, you can still use this approach and then apply a transformation to get the final shape you desire. e.g. rectangular to polar coordinates.

    And yes I know it does not look like a lava lamp but I didn't think of a better description right now.

    Lava Lamp.jpg

    and the code is here:
    LavaLamp.tbasic

  2. #2
    thinBasic MVPs kryton9's Avatar
    Join Date
    Nov 2006
    Location
    Naples, Florida & Duluth, Georgia
    Age
    67
    Posts
    3,869
    Rep Power
    404
    Lava lamp is a good name as it is mesmerizing to watch. Great job!

  3. #3
    Junior Member omarpta's Avatar
    Join Date
    Aug 2012
    Location
    Recife - Pernambuco - Brazil
    Age
    41
    Posts
    20
    Rep Power
    14
    Great! Its wonderful.

  4. #4
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10
    Yes, really great.
    Thanks for sharing it

    Still trying to understand how it works but .... This is my lack of knowledge on the specific matter
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •