/usr/share/psychtoolbox-3/PsychOpenGL/PsychGLSLShaders/BasicPerlinNoiseShader.frag.txt is in psychtoolbox-3-common 3.0.11.20131230.dfsg1-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | /* BasicPerlinNoiseShader.frag.txt - GLSL shader for on-the-fly generation
* of 2D Perlin noise textures. Used by CreateProceduralNoise, 'DrawTexture'
* and friends to generate procedural noise textures.
*
* This is a thin wrapper around the fast procedural perlin noise
* generation code from https://github.com/ashima/webgl-noise
*
* (c) 2011-2012 Mario Kleiner. This is licensed to you under the MIT license.
*
*/
uniform vec4 Offset;
varying vec4 baseColor;
varying float seed;
varying vec2 texSize;
/* Function prototype for the 3D simplex noise random number generator: */
float perlinNoise(vec3 P);
void main()
{
vec3 v;
/* Query current output texel position: */
v.xy = gl_TexCoord[0].xy;
/* Normalization:
* 1. floor() position to remove texture coordinate interpolator skew.
* 2. Divide by texture size by multiplying with reciprocal, ie.,
* texSize is = (1 / texture size), so multiply here is actual a divide.
* 3. Scale up normalized 0-1 range to 0.0 - 289.0, the period size of the
* noise function.
*/
v.xy = floor(v.xy) * vec2(289.0) * texSize.xy;
/* Assign random seed value as 3rd component of v: */
v.z = seed;
/* Compute random value rval, using the Perlin noise subroutines: */
float rval = perlinNoise(v);
/* Multiply/Modulate base color and alpha with calculated rval random number, */
/* add some constant color/alpha Offset, assign as final fragment output color: */
gl_FragColor = (baseColor * rval) + Offset;
}
|