Got unexpected results from perlin noise. Wondering what it is doing?

Got unexpected results from perlin noise. Wondering what it is doing?

I was just messing around with perlin noise and got this. Wondering if anyone knows what it is or has seen it before.

Here is the code(LUA with love2d engine):

function love.load()     love.window.setMode( 1920, 1080, {fullscreen=false})     --Assuming you called the module perlin.lua     newperlin = require("perlin2")     --newperlin is a function that generates Perlin noise objects:      myperlin = newperlin()     --333 is seed     myperlin = newperlin(333)     mapHeight = 400     mapWidth = 400      --then, to create noise:     scale = 0.007     map = {}     for x = 0, mapWidth - 1 do         map[x] = {}         for y = 0, mapHeight - 1 do             map[x][y] = 0             map[x][y] = --[[map[x][y] + --]](myperlin:noise(x * scale, y                * scale) + 1) / 2.0 * 255.0              --The following lines change it from a cloud to a weird image             smin=0; smax=255             map[x][y] =  math.floor(( map[x][y] - (-0.5) ) * 255 / ( 0.5                - (-0.5) ) + 0)         end     end end function love.draw()     for x = 0, mapWidth - 1 do         for y = 0, mapHeight - 1 do[x][y], map[x][y], map[x][y], 255),y)          end     end end  function love.update()  end  function love.keyreleased(key)     if key == "escape" then         love.event.quit()     end end 

and here is perlin.lua:


You are going outside the 0..255 range. That's why you see these color bands, since you are goint the whole range of values between 0..255 for every integer.

You are multiplying by 255 twice. This has nothing to do with perlin noise.

Category: lua Time: 2016-07-30 Views: 0

Related post

  • Unexpected results from GARCH Processes 2015-05-01

    I'm playing a bit with Time Series and I've been trying to estimate Garch Processes from different time series. Are TimeSeriesModelFit and EstimatedProcess returning accurate results? An example: proc = GARCHProcess[0.1, {0.02}, {0.04}]; data = Rando

  • puppet - unexpected result from 'each' in a custom function 2016-01-23

    I have a simple function which takes a JSON and 'does something' with it. The main part works good BUT the function returns not only what I want but additionally the result of .each loop! The code: module Puppet::Parser::Functions newfunction(:mlh, :

  • Unexpected results from Java DOM getAttribute 2016-01-29

    I am having some trouble with my DOM parser for Java. I am trying to parse the entire XML document and save everything into either Strings or ArrayLists depending how it appears in the document. Right now I have run into one issue in particular. I am

  • Unexpected result from face-font-rescale-alist in emacs 2014-07-11

    I am trying to modify the default size of a font using (add-to-list 'face-font-rescale-alist (cons "^.*STIXGeneral.*$" 0.95) t) This is supposed to rescale all fonts with name STIXGeneral by 0.95, because for me that font is a little taller than

  • Unexpected results from pgfmath functions with numbers with leading 0 2012-04-17

    The pgfmath functions give me unexpected results when used on numbers with leading zeros. Are the output in the example below expected for 0011 and 0021? \documentclass{article} \usepackage{tikz} \newcommand\truncateline[2]{% #1 & #2 & \pgfmathtru

  • Unexpected result from StringReplace 2014-12-06

    The following works as expected. StringReplace["xxxyxz", "x" ~~ _ -> "ww"] "wwwwww" And so does this. StringReplace["xxxyxz", {"xy" -> "xy", "x" ~~ _ -> "ww"

  • scikit-learn: unexpected result from preprocessing.RobustScaler 2016-01-31

    When using preprocessing.RobustScalar, with centering disabled, I'm getting some unexpected results following the processing. Text file containing sample data, where the first row is meant to be headers ("Friends" and "Likes"): Friends

  • Having trouble getting specific items from a list. What am I doing wrong? 2012-05-02

    I am a total beginner when it comes to python. I received some help already getting this code started but I hit a wall. I have a directory with 200 folders, each with a geodatabase, feature dataset, and point line and polygon feature classes. Each fe

  • Unexpected results from custom partitioning scheme - Ubuntu preseed unattended install 2010-04-15

    I need some help with partman-auto custom recipe in preseed.... it's doing unexpected things, the docs aren't so clear. This is in my preseed file: d-i partman-auto/expert_recipe string \ boot-root-var :: \ 1024 100 1024 ext4 \ $primary{ } $bootable{

  • Unexpected results from Thread 2012-04-18

    I ran into a bug in my code today based on an errant assumption. Namely, I thought that: Thread[Equal[{aa, bb, cc}, {dd, ee, ff}]] Thread[SameQ[{aa, bb, cc}, {dd, ee, ff}]] Would {aa == dd, bb == ee, cc == ff} {False,False,False} Respectively (variab

  • Unexpected results from NDSolve 2012-10-08

    I am trying to solve a stiff reaction diffusion system with NDSolve. However, it does not produce the expected results. My problem is a spherical cell with 5 different species, of which only one can flow across the cell membrane. Initially the cell c

  • Result from kernel returned to what process? 2014-03-27

    When a process requires actions that require kernel mode, it uses a system call. So, how are the results returned to the process? --------------Solutions------------- NOTE: ALL THE BELOW INFORMATION IS FROM THE REFERENCED SITE From this link, I found

  • Unexpected result from Flatten 2012-12-19

    Consider the following three evaluations involving Flatten: Flatten[f[f[f[x, y], 1, 2], f[x, y]], Infinity, f] f[x, y, 1, 2, x, y] (* as expected *) Flatten[List[f[f[x, y], 1, 2], f[x, y]], Infinity, f] {x, y, 1, 2, x, y} (* as expected *) Flatten[Li

  • Unexpected result from query based on old column value 2014-09-20

    I need to update a column and based on the old value, update a second column. After googling I came up with THIS (*nr 4) solution: copy the table to have the old value at hand. The table looks like id | upd | a1 | a2 .. | b1 | b2 | b3 | 1 | | 1 | 1 |

  • Unexpected result from sort command of linux bash 2014-10-22

    I have a file foo.txt with this content: chr1 15 chr11 5 chr11 8 chr1 7 chr2 23 chr1 35 I tried to sort it first according to the first column, and then according to the second column for breaking ties by the following command in linux shell: sort -k

  • Unexpected results from an XML query filter for security event log 2013-07-18

    Folks, I am trying to craft a custom XML / Xpath filter to the Windows Event Log viewer to exclude the countless "SYSTEM" Logons from the security log's view. I have managed to get this far with the help of the Technet blog on XML filtering: <

  • Unexpected result from InverseFunction 2013-08-20

    Given the following two equivalent inverse functions, why does one simplify (using inverse functions that are acceptable to me) and the other doesn't? Is there an assumption or setting I can give which will force these to use inverse functions and si

  • Unexpected result from FullSimplify 2014-06-26

    In the following simplification why doesn't Mathematica get a zero when asked to compute "Y-Z" eventually? a = 1 - 4 A Q^2; b = (-972 + 648) A Q^2 + 54; c = 9 - 36 A Q^2; Y = 12 Q/( Sqrt[A] ( 2 - (3 2^(1/3) a )/(Sqrt[b^2 - 4 c^3] + b )^(1/3) - (

  • Unexpected results from output with NumberForm and ScientificForm 2015-03-31

    I wrote this little function to help me export tables with formatted numbers to files: (By the way, if you have suggestions on how to make it more efficient and compact, it would be great) Options[exportSimpleFormatTable] = {numberFormat -> NumberFor

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development


Front-end development


development tools

Open Platform

Javascript development

.NET development

cloud computing


Copyright (C), All Rights Reserved.

processed in 1.529 (s). 13 q(s)