Giter Site home page Giter Site logo

webgl-noise's People

Contributors

jcbernack avatar stegu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

webgl-noise's Issues

Ugly artifacts in 2d simplex

Im experimencing some ugly artifacts in 2d simplex.
It seems that pattern repeat itself faster then in 289.

I experimenced it with iPad (iPad 2 mini I think).

Could anyone point where the problem could be?

Mention the range somewhere

Some people implement noises to be between 0 and 1, other implementations (liket the Simplex noise here?) are between -1 and 1.

It would be helpful to just mention the range somewhere, so no one is left guessing.

snoise(vec3) discontinuities

In my usage of the snoise(vec3) function I easily notice lines of noise value discontinuities in lots of places.
See the attached picture.

In my use case I use a single layer of the noise, scaled up by 2000, the squares in the image are 1 unit.
The discontinuities seems to reach up to 1/1000 units in value-discontinuity relative to the scale of the snoise inputs.
In my case this is a significant error that would be hard to hide when used for voxel generation.
They appear seemingly everywhere (ie. not just far from the origin).

I don't know enough about the math to be able to tell what might be causing this.
Although to me this looks like the lines might be corresponding to the simplex cell borders.
Although I believe I've ruled out my own code as the source,
since I've tried both snoise(vec2) and cnoise(vec3) and neither seem free from any of these discontinuities.

My current use case is a ray marching shader on desktop glsl.

issue

Problems in Safari iOS on mediump

It seems like snoise(vec3) and maybe others are only working using precision highp float; on Safari in iOS. I spent a bit of time debugging some older shaders of mine that aren't working anymore and this appeared to fix it.

How to get the noise value in [0, 1]

Hi,

I've been reading the wiki for the project and I haven't found a method to do this. I'm trying to get the values for float snoise(vec2) to be in a certain interval [0, 1]. How can I do that? What is the domain for vec2 that I should use as input?

Thanks,

3D simplex noise exhibiting spacial artifacts not found in 2D simplex noise

Hi,I've notice that the 3D snoise function produces very noticeable diagonal streaking that doesn't seem to appear (or not as noticeably) in the 2D snoise.

Compare the following revisions of this sandbox sketch:
2D Simplex
3D Simplex

The streaks exist in the 3D version even without an animation (just setting the z component to a constant).

Why does this happen and is there a way to minimize the effect?

webgl

webgl可以使用什么插件一起使用可以进行动画效果

6D noise

For generating 3D tiles on the fly, what about creating a 6D noise function?

problem making MacOSX benchmark

Using Mac OS X 10.6.7, xcode 3.2.6 installed

[benchmark (master)]$ make MacOSX
cd common ; make
cpp -P -I../../src -DSHADER=\"noise2D.glsl\" \
        -DVTYPE=vec2 -DVNAME=v_texCoord2D -DNOISEFUN=snoise\
         -DVERSION='#version 120' commonShader.frag simplexnoise2D.frag
cpp -P -I../../src -DSHADER=\"noise3D.glsl\" \
        -DVTYPE=vec3 -DVNAME=v_texCoord3D -DNOISEFUN=snoise\
         -DVERSION='#version 120' commonShader.frag simplexnoise3D.frag
cpp -P  -I../../src -DSHADER=\"noise4D.glsl\" \
        -DVTYPE=vec4 -DVNAME=v_texCoord4D -DNOISEFUN=snoise\
         -DVERSION='#version 120' commonShader.frag simplexnoise4D.frag
cpp -P -I../../src -DSHADER=\"classicnoise2D.glsl\" \
        -DVTYPE=vec2 -DVNAME=v_texCoord2D -DNOISEFUN=cnoise\
         -DVERSION='#version 120' commonShader.frag classicnoise2D.frag
cpp -P -I../../src -DSHADER=\"classicnoise3D.glsl\" \
        -DVTYPE=vec3 -DVNAME=v_texCoord3D -DNOISEFUN=cnoise\
         -DVERSION='#version 120' commonShader.frag classicnoise3D.frag
cpp -P  -I../../src -DSHADER=\"classicnoise4D.glsl\" \
        -DVTYPE=vec4 -DVNAME=v_texCoord4D -DNOISEFUN=cnoise\
         -DVERSION='#version 120' commonShader.frag classicnoise4D.frag
cd MacOSX ; make ; make run
cc -I. -I/usr/X11/include   -c -o noisebench.o ../common/noisebench.c
../common/noisebench.c:28:21: error: GL/glfw.h: No such file or directory
In file included from ../common/noisebench.c:34:
/usr/X11/include/GL/glext.h:3985: error: expected ‘)’ before ‘red’
/usr/X11/include/GL/glext.h:3986: error: expected ‘)’ before ‘mode’

...

../common/noisebench.c: In function ‘createShader’:
../common/noisebench.c:192: error: lvalue required as left operand of assignment

...

make[1]: *** [noisebench.o] Error 1
open -W ./noisebench.app
The file /Users/stephen/dev/javascript/webgl/webgl-noise-git/benchmark/MacOSX/noisebench.app does not exist.
make[1]: *** [run] Error 1
make: *** [MacOSX] Error 2

demo fails to build on OS X

I get the following failure when trying to run the makefile in the demos folder:

$ make MacOSX
cd common ; make
make[1]: Nothing to be done for `all'.
cd MacOSX ; make ; make run
cc -I. -I/usr/X11/include   -c -o noisedemo.o ../common/noisedemo.c
cc -framework Cocoa -framework OpenGL -lglfw  noisedemo.o   -o noisedemo
./bundle.sh noisedemo.app noisedemo ; chmod a-x noisedemo
/bin/sh: ./bundle.sh: Permission denied
ln -s ../common/noisedemo.vert ../common/noisedemo.frag . ; touch links_done
open -W ./noisedemo.app
The file /Volumes/ssd/code/graphics/webgl-noise/demo/MacOSX/noisedemo.app does not exist.
make[1]: *** [run] Error 1
make: *** [MacOSX] Error 2

doing:

$ chmod u+x demo/MacOSX/bundle.sh

fixes the 'Permission denied' error above and allows the Makefile to run flawlessly

Use of implementation in art project

Hi

I'm a generative artist working on a series of work that require me to implement simplex noise in glsl. I've accepted that I probably wont do as good a job on that as you've already done, so I would like to use your implementation. However, the code of the final project is size-sensitive so I cannot include an MIT license text in it. Will you be ok with me using and modifying (to reduce size) your code for 2D simplex noise without the addition of this text? Since this is an art project that will likely generate sale of the final pieces I'm also very happy to donate a sum to a charity of your choice.

best
Thomas

Seeds

Provide a means to seed noise generators

Gradient to 3D Simplex Noise

I tried to add the calculation of the noise gradient to the 3D Simplex Noise, but I have no idea how to check if my results are correct. Can somebody comment on this with a better understanding of the Simplex Noise algorithm?

float snoise(vec3 v, out vec3 grad)
{
    ......

    // Mix final noise value
    vec4 m = max(0.6 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0);
    vec4 m2 = m * m;
    vec4 m4 = m2 * m2;

    vec4 pdotx = vec4(dot(p0,x0), dot(p1,x1), dot(p2,x2), dot(p3,x3));

    vec4 temp = m2 * m * pdotx;
    grad = -8.0 * (temp.x * x0 + temp.y * x1 + temp.z * x2 + temp.w * x3);
    grad += m4.x * p0 + m4.y * p1 + m4.z * p2 + m4.w * p3;
    grad *= 42.0;

    return 42.0 * dot(m4, pdotx);
}

The implementation is based on code I found which either was not in GLSL or not in 3D, like this one: srdnoise2.glsl

Texture-intensive noise implementations

Hi!

First off thanks a lot for this work it's been incredibly useful :)

This is not really an "issue" but I have a question for you guys about something posted in the "Wiki" and couldn't find another way to ask it. In the Wiki, you say: "However, if you are generating noise by itself and using a lot of it, the texture-intensive noise implementations this work was based on...". I'm interested in exploring those texture-based implementations to see the performance trade-offs. Is there any resource or article you recommend to get started with them?

Thanks a lot!
Johan

mod289 defined only for vec3

Hi !

While using the 3D classical noise, I got one complaint, about mod289 using vec4 while Pi0 and Pi1 are vec3. As permute actualy uses a vec3, I just added a vec3 version of mod289, and everything worked fine.

Thanks for sharing those useful functions.

Marc

put the demos online?

i want to see what it does but don't want to install all this stuff just to see what what's going on. :(

pnoise is not repeating

If noise is rendered per fragment, and the attached texture to the FBO is 512x512 pixels, then the gl_FragCoords go from 0.5 ... 511.5, using a period of 512 does not tile properly:

float value = pnoise(gl_FragCoord.xy_0.1, vec2(512.0_0.1)); // does not work

Question: offsetting / seeding noise2D.glsl .

I am using the noise2D.glsl , and it is working nicely ( thank you ) .

Wondering how I can offset (or seed) the noise2D.glsl to make it different every time I generate with it ? . ( The easier the better - just using it to export a still noise image - so not too worried about performance ) .

I was looking at the other thread and did not really figure anything out from it - so figured asking again might not hurt.

Thank you for sharing & taking the time to release this.

Periodicity along diagonal

Hey, this might be a dupe of issue 10 but the links are broken in that one so I couldn't be sure. Apologies if so.

It seems like both the 2D and 3D simplex noise functions are periodic with respect to a particular diagonal direction. The problem is not quite so obvious in 2D, but it's definitely still there. I tried various fixes mentioned in other issues without luck. Did I do something wrong?

In the samples below I zoomed out a lot to show the problem but it's also quite noticeable in real situations. Increasing the period would be fine for my use case I guess, it just seems very small at the moment.

I tried changing the value of 289 used in the permutation to something much higher, which did fix the periodicity problem, but it also introduced discontinuities in the noise function along diagonal lines. I guess it needs to be a real permutation polynomial rather than some number I made up, but I'm not sure how those values were constructed in the first place.

Here are code samples and results for both cases. It's just the fragment shader and I'm rendering a quad over the whole screen.

#include "noise3D.glsl"

out vec4 output_colour;

void main()
{
  highp vec3 seed = vec3(0, gl_FragCoord.xy) / 2;
  highp float n = snoise(seed);
  float v = clamp((n + 1) / 2, 0, 1);
  output_colour = vec4(v, v, v, 1);
}

screenshot

#include "noise2D.glsl"

out vec4 output_colour;

void main()
{
  highp float n = snoise(gl_FragCoord.xy / 2);
  float v = clamp((n + 1) / 2, 0, 1);
  output_colour = vec4(v, v, v, 1);
}

screenshot2d

Procedural Focal Points

Is there an option in the shader to indicate procedural focal points, where an offset is either a seed value or an attractor value, such as would be typical when replacing a textured object with have feature characteristics, or when extruding the procedural rendering along a non-uniform mesh structure, such as an extension object like flower or grass connected to the primary plane?

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.