Giter Club home page Giter Club logo

noise's Introduction

Usage

Random

random

local seed = 12356
local x = 0.5
local y = 0.25
local noise = Noise.new(seed)
local value = noise:Random(x,y) -- a value from 0 to 1 (ish)

Perlin

perlin

local seed = 12356
local x = 0.5
local y = 0.25
local noise = Noise.new(seed)
local value = noise:Perlin(x,y) -- a value from 0 to 1 (ish)

Worley / Cellular

worley

local seed = 12356
local x = 0.5
local y = 0.25
local noise = Noise.new(seed)
local value = noise:Cellular(x,y) -- a value from 0 to 1 (ish)

Voronoi

voronoi

local seed = 12356
local x = 0.5
local y = 0.25
local noise = Noise.new(seed)
local value = noise:Voronoi(x,y) -- a value from 0 to 1 (ish)

Benchmark

Each map was sampled 32 times, including math.noise, to determine how long each of them took. Some maps have built in optimizations for when only x and y are provided.

bench

As you can see, math.noise is 2x faster than anything else. The perlin implementation is literally a translation of the official luau source code, so it's unsurprisingly running the fastest. The only reason you'd used this over math.noise is if you want deterministic seed control. The random noise map is just a bunch of Random datatypes in a trenchcoat, so it's also fairly fast.

In general, the more complex maps require around 50-60 microseconds to run per call - not a dealbreaker, but you'll want to be smart when you use them. They do cache their outputs though, so calling a repeat set of conditions can be faster than math.noise.

noise's People

Contributors

nightcycle avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.