Skip to content

Latest commit

 

History

History

generative

Caustic generative texture inspired on https://www.shadertoy.com/view/MdlXz8 by David Hoskins

To import this block add the following url to your import list:

import:
    - https://tangrams.github.io/blocks/generative/caustics.yaml

If you want to import this block together with their dependencies use this other url:

import:
    - https://tangrams.github.io/blocks/generative/caustics-full.yaml

These blocks uses a custom shader. These are the defines:

  • TAU: The default value is 6.28318530718.
  • CAUSTIC_ITERATIONS: The default value is 3.

These are the shader blocks:

  • global:
  • vec3 getCaustic (vec2 uv)

Here are some benchmarks of this block performed on a Raspberry Pi:

  • getCaustic_3iter ( mean: 0.0175725003059 median: 0.017571 )

...
// Color:
    color.rgb += getCaustic(v_texcoord);
  • getCaustic_5iter ( mean: 0.0275907997563 median: 0.027598 )

#define CAUSTIC_ITERATIONS 5
...
// Color:
    color.rgb += getCaustic(v_texcoord);
  • getCaustic_4iter ( mean: 0.0270359104172 median: 0.027099 )

#define CAUSTIC_ITERATIONS 4
...
// Color:
    color.rgb += getCaustic(v_texcoord);

Set of Fractal Brownian Motion functions. For more information on this theme read this chapter of The Book of Shaders about fractal Brownian Motion.

To import this block add the following url to your import list:

import:
    - https://tangrams.github.io/blocks/generative/fbm.yaml

If you want to import this block together with their dependencies use this other url:

import:
    - https://tangrams.github.io/blocks/generative/fbm-full.yaml

These blocks uses a custom shader. These are the defines:

  • NUM_OCTAVES: The default value is 5.

These are the shader blocks:

  • global:
  • float fbm (in float x)
  • float fbm (in vec2 xy)
  • float fbm (in vec3 xyz)

Here are some benchmarks of this block performed on a Raspberry Pi:

  • fbm_float_5oct ( mean: 0.010135752381 median: 0.010136 )

...
// Color:
    color.rgb += fbm(v_texcoord.x);
  • fbm_vec2_5oct ( mean: 0.0611064060247 median: 0.061113 )

...
// Color:
    color.rgb += fbm(v_texcoord);
  • fbm_vec3_5oct ( mean: 0.0584654752151 median: 0.058501 )

...
// Color:
    color.rgb += fbm(vec3(v_texcoord,u_time));
  • fbm_float_8oct ( mean: 0.0237187597951 median: 0.023732 )

#define NUM_OCTAVES 8
...
// Color:
    color.rgb += fbm(v_texcoord.x);
  • fbm_vec3_8oct ( mean: 0.136034082884 median: 0.134022 )

#define NUM_OCTAVES 8
...
// Color:
    color.rgb += fbm(vec3(v_texcoord,u_time));
  • fbm_float_3oct ( mean: 0.00640298289023 median: 0.006403 )

#define NUM_OCTAVES 3
...
// Color:
    color.rgb += fbm(v_texcoord.x);
  • fbm_vec2_3oct ( mean: 0.0278048893878 median: 0.02781 )

#define NUM_OCTAVES 3
...
// Color:
    color.rgb += fbm(v_texcoord);
  • fbm_vec3_3oct ( mean: 0.0287940898739 median: 0.028803 )

#define NUM_OCTAVES 3
...
// Color:
    color.rgb += fbm(vec3(v_texcoord,u_time));
  • fbm_vec2_8oct ( mean: 0.131073964162 median: 0.130915 )

#define NUM_OCTAVES 8
...
// Color:
    color.rgb += fbm(v_texcoord);

Set of Noise functions. For more information on this theme read this chapter of The Book of Shaders about Noise.

To import this block add the following url to your import list:

import:
    - https://tangrams.github.io/blocks/generative/noise.yaml

If you want to import this block together with their dependencies use this other url:

import:
    - https://tangrams.github.io/blocks/generative/noise-full.yaml

These blocks uses a custom shader. These are the defines:

  • NOISE_TEXSAMPLE_SIZE: The default value is 256.0.

These are the shader blocks:

  • global:
  • float noise (in float x)
  • float noise (vec2 p)
  • float noise (vec3 p)
  • float gnoise (in vec2 p)
  • float gnoise (in vec3 p)
  • vec3 mod289(vec3 x)
  • vec2 mod289(vec2 x)
  • vec3 permute(vec3 x)
  • float snoise(vec2 v)
  • float snoise (vec3 p)

Here are some benchmarks of this block performed on a Raspberry Pi:

  • snoise_vec3 ( mean: 0.0081320892949 median: 0.008167 )

...
// Color:
    color.rgb += snoise(vec3(v_texcoord.xy*2.,u_time));
  • snoise_vec2 ( mean: 0.00466698304726 median: 0.004539 )

...
// Color:
    color.rgb += snoise(v_texcoord.xy*2.);
  • gnoise_vec3 ( mean: 0.0155613809307 median: 0.014337 )

...
// Color:
    color.rgb += gnoise(vec3(v_texcoord.xy*2.,u_time));
  • gnoise_vec2 ( mean: 0.00828029987097 median: 0.008283 )

...
// Color:
    color.rgb += gnoise(v_texcoord.xy*2.);
  • noise_float ( mean: 0.00276502347418 median: 0.002771 )

...
// Color:
    color.rgb += noise(v_texcoord.x*2.);
  • noise_float_t ( mean: 0.00171042681007 median: 0.001593 )

#define NOISE_TEXSAMPLE 1
...
// Color:
    color.rgb += noise(v_texcoord.x*2.);
  • noise_vec3_t ( mean: 0.0025067628239 median: 0.002369 )

#define NOISE_TEXSAMPLE 1
...
// Color:
    color.rgb += noise(vec3(v_texcoord.xy,u_time)*2.);
  • noise_vec3 ( mean: 0.00791788742217 median: 0.008132 )

...
// Color:
    color.rgb += noise(vec3(v_texcoord.xy*2.,u_time));
  • noise_vec2 ( mean: 0.00753833157631 median: 0.007736 )

...
// Color:
    color.rgb += noise(v_texcoord.xy*2.);
  • noise_vec2_t ( mean: 0.0023383445145 median: 0.002296 )

#define NOISE_TEXSAMPLE 1
...
// Color:
    color.rgb += noise(v_texcoord.xy*2.);

Set of functions about random. For more information on this theme read this chapter of The Book of Shaders about Random.

To import this block add the following url to your import list:

import:
    - https://tangrams.github.io/blocks/generative/random.yaml

If you want to import this block together with their dependencies use this other url:

import:
    - https://tangrams.github.io/blocks/generative/random-full.yaml

These blocks uses a custom shader. These are the uniforms:

  • u_random: The default value is https://tangrams.github.io/blocks/generative/imgs/tex16.png.

These are the shader blocks:

  • global:
  • vec3 random3 (vec2 p)
  • vec3 random3 (vec3 p)
  • vec2 random2 (vec2 p)
  • float random (float x)
  • float random (vec2 p)
  • float random (vec3 p)

Here are some benchmarks of this block performed on a Raspberry Pi:

  • random3_vec3_t ( mean: 0.00312405490502 median: 0.003067 )

#define RANDOM_TEXSAMPLE 1
...
// Color:
    color.rgb += random3(vec3(v_texcoord.xy*2.,u_time));
  • random_vec3 ( mean: 0.00270068586118 median: 0.002365 )

...
// Color:
    color.rgb += random(vec3(v_texcoord.xy*2.,u_time));
  • random_vec2 ( mean: 0.00252334352418 median: 0.002444 )

...
// Color:
    color.rgb += random(v_texcoord.xy*2.);
  • random3_vec2_t ( mean: 0.00315922334108 median: 0.003081 )

#define RANDOM_TEXSAMPLE 1
...
// Color:
    color.rgb += random3(v_texcoord.xy*2.);
  • random_vec2_t ( mean: 0.00315702371745 median: 0.003083 )

#define RANDOM_TEXSAMPLE 1
...
// Color:
    color.rgb += random(v_texcoord.xy*2.);
  • random_float_t ( mean: 0.00238605439546 median: 0.002301 )

#define RANDOM_TEXSAMPLE 1
...
// Color:
    color.rgb += random(v_texcoord.x*2.);
  • random_vec3_t ( mean: 0.00310508876669 median: 0.003073 )

#define RANDOM_TEXSAMPLE 1
...
// Color:
    color.rgb += random(vec3(v_texcoord.xy*2.,u_time));
  • random2_vec2_t ( mean: 0.0027482502193 median: 0.002737 )

#define RANDOM_TEXSAMPLE 1
...
// Color:
    color.rg += random2(v_texcoord.xy*2.);
  • random_float ( mean: 0.00160958646154 median: 0.001529 )

...
// Color:
    color.rgb += random(v_texcoord.x*2.);
  • random2_vec2 ( mean: 0.00256994760345 median: 0.002537 )

...
// Color:
    color.rg += random2(v_texcoord.xy*2.);
  • random3_vec3 ( mean: 0.00242304361702 median: 0.002308 )

...
// Color:
    color.rgb += random3(vec3(v_texcoord.xy*2.,u_time));
  • random3_vec2 ( mean: 0.00338676149199 median: 0.003303 )

...
// Color:
    color.rgb += random3(v_texcoord.xy*2.);

Set of Voronoi functions. For more information on this theme read this chapter of The Book of Shaders about Cellular Noise and Voronoi.

To import this block add the following url to your import list:

import:
    - https://tangrams.github.io/blocks/generative/voronoi.yaml

If you want to import this block together with their dependencies use this other url:

import:
    - https://tangrams.github.io/blocks/generative/voronoi-full.yaml

These blocks uses a custom shader. These are the shader blocks:

  • global:
  • vec3 voronoi (vec2 st)

Here are some benchmarks of this block performed on a Raspberry Pi:

  • voronoi ( mean: 0.0258840274359 median: 0.025893 )

...
// Color:
    color.rgb = voronoi(v_texcoord.xy*2.);