Talk:Perlin noise: Difference between revisions

From Rosetta Code
Content added Content deleted
No edit summary
Line 5: Line 5:


http://4.bp.blogspot.com/-u4wfD21sIvU/UsI85U78XYI/AAAAAAAAAx8/NG2fEzYjTUA/s1600/perlin2.png
http://4.bp.blogspot.com/-u4wfD21sIvU/UsI85U78XYI/AAAAAAAAAx8/NG2fEzYjTUA/s1600/perlin2.png

:Your image is not correct. The perlin noise has a range between -1 and 1, and you use this to convert it into an unsigned byte:

:<code>Gray(cast(ubyte)(p * 256))</code>

:Try this:

:<code>Gray(cast(ubyte)((p+1)/2 * 256))</code>

:Also, your image will look smoother than the example you found on blogspot.com, since this imag is made with several octaves.

:--[[User:Grondilu|Grondilu]] ([[User talk:Grondilu|talk]]) 17:49, 5 March 2014 (UTC)

Revision as of 17:49, 5 March 2014

Correctness

The D implementation generates exactly the same outputs of the Java version. I have used the D code to generate this image (with the grayscale code visible in the D entry): http://oi62.tinypic.com/2pt9flx.jpg

Is such image correct? Isn't a correct Perlin noise image without sharp borders, like this?

http://4.bp.blogspot.com/-u4wfD21sIvU/UsI85U78XYI/AAAAAAAAAx8/NG2fEzYjTUA/s1600/perlin2.png

Your image is not correct. The perlin noise has a range between -1 and 1, and you use this to convert it into an unsigned byte:
Gray(cast(ubyte)(p * 256))
Try this:
Gray(cast(ubyte)((p+1)/2 * 256))
Also, your image will look smoother than the example you found on blogspot.com, since this imag is made with several octaves.
--Grondilu (talk) 17:49, 5 March 2014 (UTC)