Fix stretching when using non square surface on multiple nodes.

This commit is contained in:
Tanasart 2024-09-25 09:04:06 +07:00
parent efb8af1250
commit f003d77fd5
43 changed files with 116 additions and 88 deletions

View file

@ -655,13 +655,6 @@
{"$GMIncludedFile":"","%Name":"tile_0126.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Getting started","name":"tile_0126.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",}, {"$GMIncludedFile":"","%Name":"tile_0126.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Getting started","name":"tile_0126.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"Broken heart.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Sample Projects","name":"Broken heart.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",}, {"$GMIncludedFile":"","%Name":"Broken heart.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Sample Projects","name":"Broken heart.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"Broken heart.pxc","CopyToMask":-1,"filePath":"datafiles/Welcome files/Sample Projects","name":"Broken heart.pxc","resourceType":"GMIncludedFile","resourceVersion":"2.0",}, {"$GMIncludedFile":"","%Name":"Broken heart.pxc","CopyToMask":-1,"filePath":"datafiles/Welcome files/Sample Projects","name":"Broken heart.pxc","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"card_back.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Sample Projects","name":"card_back.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"card_clubs_02.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Sample Projects","name":"card_clubs_02.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"card_clubs_03.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Sample Projects","name":"card_clubs_03.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"card_clubs_04.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Sample Projects","name":"card_clubs_04.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"card_clubs_05.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Sample Projects","name":"card_clubs_05.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"Cards flipping.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Sample Projects","name":"Cards flipping.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"Cards flipping.pxc","CopyToMask":-1,"filePath":"datafiles/Welcome files/Sample Projects","name":"Cards flipping.pxc","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"dice_1.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Sample Projects","name":"dice_1.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",}, {"$GMIncludedFile":"","%Name":"dice_1.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Sample Projects","name":"dice_1.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"dice_2.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Sample Projects","name":"dice_2.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",}, {"$GMIncludedFile":"","%Name":"dice_2.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Sample Projects","name":"dice_2.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"dice_3.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Sample Projects","name":"dice_3.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",}, {"$GMIncludedFile":"","%Name":"dice_3.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Sample Projects","name":"dice_3.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
@ -672,6 +665,8 @@
{"$GMIncludedFile":"","%Name":"Dice.pxc","CopyToMask":-1,"filePath":"datafiles/Welcome files/Sample Projects","name":"Dice.pxc","resourceType":"GMIncludedFile","resourceVersion":"2.0",}, {"$GMIncludedFile":"","%Name":"Dice.pxc","CopyToMask":-1,"filePath":"datafiles/Welcome files/Sample Projects","name":"Dice.pxc","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"Shiny gem.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Sample Projects","name":"Shiny gem.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",}, {"$GMIncludedFile":"","%Name":"Shiny gem.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Sample Projects","name":"Shiny gem.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"Shiny gem.pxc","CopyToMask":-1,"filePath":"datafiles/Welcome files/Sample Projects","name":"Shiny gem.pxc","resourceType":"GMIncludedFile","resourceVersion":"2.0",}, {"$GMIncludedFile":"","%Name":"Shiny gem.pxc","CopyToMask":-1,"filePath":"datafiles/Welcome files/Sample Projects","name":"Shiny gem.pxc","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"Space cloud.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Sample Projects","name":"Space cloud.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"Space cloud.pxc","CopyToMask":-1,"filePath":"datafiles/Welcome files/Sample Projects","name":"Space cloud.pxc","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"spark.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Sample Projects","name":"spark.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",}, {"$GMIncludedFile":"","%Name":"spark.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Sample Projects","name":"spark.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"tile_0044.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Sample Projects","name":"tile_0044.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",}, {"$GMIncludedFile":"","%Name":"tile_0044.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Sample Projects","name":"tile_0044.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"tile_0067.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Sample Projects","name":"tile_0067.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",}, {"$GMIncludedFile":"","%Name":"tile_0067.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Sample Projects","name":"tile_0067.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",},

Binary file not shown.

Before

Width:  |  Height:  |  Size: 887 B

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

View file

@ -2,7 +2,7 @@ function Node_Shader_Generator(_x, _y, _group = noone) : Node_Shader(_x, _y, _gr
name = ""; name = "";
newInput(0, nodeValue_Dimension(self)); newInput(0, nodeValue_Dimension(self));
addShaderProp(SHADER_UNIFORM.float, "u_resolution"); addShaderProp(SHADER_UNIFORM.float, "dimension");
attribute_surface_depth(); attribute_surface_depth();

View file

@ -16,7 +16,7 @@ function Node_Shader_Processor(_x, _y, _group = noone) : Node_Shader(_x, _y, _gr
_outSurf = surface_verify(_outSurf, _sw, _sh, attrDepth()); _outSurf = surface_verify(_outSurf, _sw, _sh, attrDepth());
surface_set_shader(_outSurf, shader); surface_set_shader(_outSurf, shader);
shader_set_f("u_resolution", _sw, _sh); shader_set_f("dimension", _sw, _sh);
setShader(_data); setShader(_data);
draw_surface_safe(_surf); draw_surface_safe(_surf);

View file

@ -66,6 +66,7 @@ function Node_Noise_Aniso(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth()); _outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth());
surface_set_shader(_outSurf, sh_ani_noise); surface_set_shader(_outSurf, sh_ani_noise);
shader_set_2("dimension", _dim);
shader_set_f("position", _pos[0] / _dim[0], _pos[1] / _dim[1]); shader_set_f("position", _pos[0] / _dim[0], _pos[1] / _dim[1]);
shader_set_f("seed", _data[2]); shader_set_f("seed", _data[2]);
shader_set_f("colrSeed", _data[10]); shader_set_f("colrSeed", _data[10]);

View file

@ -79,13 +79,13 @@ function Node_Perlin(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth()); _outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth());
surface_set_shader(_outSurf, sh_perlin_tiled); surface_set_shader(_outSurf, sh_perlin_tiled);
shader_set_f("u_resolution", _dim); shader_set_2("dimension", _dim);
shader_set_2("position", _pos); shader_set_2("position", _pos);
shader_set_f("rotation", degtorad(_rot)); shader_set_f("rotation", degtorad(_rot));
shader_set_f_map("scale", _data[2], _data[10], inputs[2]); shader_set_f_map("scale", _data[2], _data[10], inputs[2]);
shader_set_f("seed", _sed); shader_set_f("seed", _sed);
shader_set_i("tile", _til); shader_set_i("tile", _til);
shader_set_i("iteration", _ite); shader_set_i("iteration", _ite);
shader_set_i("colored", _col); shader_set_i("colored", _col);
shader_set_2("colorRanR", _clr); shader_set_2("colorRanR", _clr);

View file

@ -42,12 +42,12 @@ function Node_Perlin_Smear(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth()); _outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth());
surface_set_shader(_outSurf, sh_perlin_smear); surface_set_shader(_outSurf, sh_perlin_smear);
shader_set_f("u_resolution", _dim); shader_set_f("dimension", _dim);
shader_set_2("position", _pos); shader_set_2("position", _pos);
shader_set_2("scale", _sca); shader_set_2("scale", _sca);
shader_set_f("bright", _bri); shader_set_f("bright", _bri);
shader_set_i("iteration", _ite); shader_set_i("iteration", _ite);
shader_set_f("rotation", degtorad(_rot)); shader_set_f("rotation", degtorad(_rot));
draw_sprite_ext(s_fx_pixel, 0, 0, 0, _dim[0], _dim[1], 0, c_white, 1); draw_sprite_ext(s_fx_pixel, 0, 0, 0, _dim[0], _dim[1], 0, c_white, 1);
surface_reset_shader(); surface_reset_shader();

View file

@ -74,6 +74,7 @@ function Node_RM_Cloud(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
surface_set_shader(_outSurf, sh_rm_cloud); surface_set_shader(_outSurf, sh_rm_cloud);
shader_set_2("dimension", _dim);
shader_set_3("position", _pos); shader_set_3("position", _pos);
shader_set_3("rotation", _rot); shader_set_3("rotation", _rot);
shader_set_f("objectScale", _sca * 4); shader_set_f("objectScale", _sca * 4);

View file

@ -1,6 +1,7 @@
varying vec2 v_vTexcoord; varying vec2 v_vTexcoord;
varying vec4 v_vColour; varying vec4 v_vColour;
uniform vec2 dimension;
uniform float seed; uniform float seed;
uniform float colrSeed; uniform float colrSeed;
uniform vec2 position; uniform vec2 position;
@ -44,7 +45,8 @@ void main() {
ang = radians(ang); ang = radians(ang);
#endregion #endregion
vec2 pos = (v_vTexcoord - position) * mat2(cos(ang), - sin(ang), sin(ang), cos(ang)); vec2 ntx = v_vTexcoord * vec2(1., dimension.y / dimension.x);
vec2 pos = (ntx - position) * mat2(cos(ang), - sin(ang), sin(ang), cos(ang));
float yy = floor(pos.y * nsy); float yy = floor(pos.y * nsy);
float xx = (pos.x + random(vec2(1., yy), seed)) * nsx; float xx = (pos.x + random(vec2(1., yy), seed)) * nsx;

View file

@ -36,8 +36,9 @@ void main() {
float ang = rotation; float ang = rotation;
#endregion #endregion
vec2 ntx = v_vTexcoord * vec2(1., dimension.y / dimension.x);
vec2 pos = position / dimension; vec2 pos = position / dimension;
vec2 st = (v_vTexcoord - pos) * mat2(cos(ang), -sin(ang), sin(ang), cos(ang)) * sca; vec2 st = (ntx - pos) * mat2(cos(ang), -sin(ang), sin(ang), cos(ang)) * sca;
vec3 color = vec3(.0); vec3 color = vec3(.0);
float m_dist = 1.; float m_dist = 1.;
@ -70,7 +71,7 @@ void main() {
float rad = pow(float(j) / sca, radiusScale) * sca * .5 + random(vec2(angl)) * 0.1; float rad = pow(float(j) / sca, radiusScale) * sca * .5 + random(vec2(angl)) * 0.1;
vec2 point = vec2(cos(angl) * rad, sin(angl) * rad) + pos; vec2 point = vec2(cos(angl) * rad, sin(angl) * rad) + pos;
vec2 _diff = point - v_vTexcoord; vec2 _diff = point - ntx;
float dist = length(_diff); float dist = length(_diff);
m_dist = min(m_dist, dist); m_dist = min(m_dist, dist);
} }

View file

@ -59,8 +59,9 @@ void main() {
float ang = rotation; float ang = rotation;
#endregion #endregion
vec2 ntx = v_vTexcoord * vec2(1., dimension.y / dimension.x);
vec2 pos = position / dimension; vec2 pos = position / dimension;
vec2 st = (v_vTexcoord - pos) * mat2(cos(ang), -sin(ang), sin(ang), cos(ang)) * sca * 0.75; vec2 st = (ntx - pos) * mat2(cos(ang), -sin(ang), sin(ang), cos(ang)) * sca * 0.75;
float n = voronoi3d(vec3(st, seed), sca); float n = voronoi3d(vec3(st, seed), sca);
n = middle + (n - middle) * contrast; n = middle + (n - middle) * contrast;

View file

@ -37,8 +37,9 @@ void main() {
float ang = rotation; float ang = rotation;
#endregion #endregion
vec2 ntx = v_vTexcoord * vec2(1., dimension.y / dimension.x);
vec2 pos = position / dimension; vec2 pos = position / dimension;
vec2 st = (v_vTexcoord - pos) * mat2(cos(ang), -sin(ang), sin(ang), cos(ang)) * sca; vec2 st = (ntx - pos) * mat2(cos(ang), -sin(ang), sin(ang), cos(ang)) * sca;
float md = 8.; float md = 8.;
vec2 mg, mr; vec2 mg, mr;
@ -83,7 +84,7 @@ void main() {
vec2 neighbor = vec2(cos(ang) * rad, sin(ang) * rad); vec2 neighbor = vec2(cos(ang) * rad, sin(ang) * rad);
vec2 point = neighbor + pos; vec2 point = neighbor + pos;
vec2 _diff = point - v_vTexcoord; vec2 _diff = point - ntx;
float dist = length(_diff); float dist = length(_diff);
if(dist < md) { if(dist < md) {
@ -103,7 +104,7 @@ void main() {
vec2 neighbor = vec2(cos(ang) * rad, sin(ang) * rad); vec2 neighbor = vec2(cos(ang) * rad, sin(ang) * rad);
vec2 point = neighbor + pos; vec2 point = neighbor + pos;
vec2 r = point - v_vTexcoord; vec2 r = point - ntx;
if(dot(mr - r, mr - r) > .0001) if(dot(mr - r, mr - r) > .0001)
md = min( md, dot( 0.5 * (mr + r), normalize(r - mr)) ); md = min( md, dot( 0.5 * (mr + r), normalize(r - mr)) );
} }

View file

@ -46,8 +46,9 @@ void main() {
float ang = rotation; float ang = rotation;
#endregion #endregion
vec2 ntx = v_vTexcoord * vec2(1., dimension.y / dimension.x);
vec2 pos = position / dimension; vec2 pos = position / dimension;
vec2 st = (v_vTexcoord - pos) * mat2(cos(ang), -sin(ang), sin(ang), cos(ang)) * sca; vec2 st = (ntx - pos) * mat2(cos(ang), -sin(ang), sin(ang), cos(ang)) * sca;
vec3 color = vec3(.0); vec3 color = vec3(.0);
vec2 i_st = floor(st); vec2 i_st = floor(st);
@ -80,7 +81,7 @@ void main() {
float rad = pow(float(j) / sca, radiusScale) * sca * .5 + random(vec2(ang)) * 0.1; float rad = pow(float(j) / sca, radiusScale) * sca * .5 + random(vec2(ang)) * 0.1;
vec2 point = vec2(cos(ang) * rad, sin(ang) * rad) + pos; vec2 point = vec2(cos(ang) * rad, sin(ang) * rad) + pos;
vec2 _diff = point - v_vTexcoord; vec2 _diff = point - ntx;
float dist = length(_diff); float dist = length(_diff);
if(dist < m_dist) { if(dist < m_dist) {

View file

@ -4,6 +4,7 @@
varying vec2 v_vTexcoord; varying vec2 v_vTexcoord;
varying vec4 v_vColour; varying vec4 v_vColour;
uniform vec2 dimension;
uniform vec2 position; uniform vec2 position;
uniform float scale; uniform float scale;
uniform float time; uniform float time;
@ -14,7 +15,8 @@ vec2 random2( vec2 p ) {
} }
void main() { void main() {
vec2 st = v_vTexcoord + position; vec2 ntx = v_vTexcoord * vec2(1., dimension.y / dimension.x);
vec2 st = ntx + position;
vec3 color = vec3(.0); vec3 color = vec3(.0);
// Scale // Scale

View file

@ -205,8 +205,10 @@ void main() {
} }
#endregion #endregion
vec2 ntx = v_vTexcoord * vec2(1., dimension.y / dimension.x);
if(mode == 1) { if(mode == 1) {
vec2 px = floor((v_vTexcoord - position) * dimension); vec2 px = floor((ntx - position) * dimension);
sca = floor(sca); sca = floor(sca);
vec2 scaG = sca - (gapAcc + 1.); vec2 scaG = sca - (gapAcc + 1.);
@ -240,7 +242,7 @@ void main() {
sca = dimension / sca; sca = dimension / sca;
vec2 pos = v_vTexcoord - position, _pos; vec2 pos = ntx - position, _pos;
float ratio = dimension.x / dimension.y; float ratio = dimension.x / dimension.y;
_pos.x = pos.x * ratio * cos(ang) - pos.y * sin(ang); _pos.x = pos.x * ratio * cos(ang) - pos.y * sin(ang);
_pos.y = pos.x * ratio * sin(ang) + pos.y * cos(ang); _pos.y = pos.x * ratio * sin(ang) + pos.y * cos(ang);

View file

@ -3,7 +3,7 @@
varying vec2 v_vTexcoord; varying vec2 v_vTexcoord;
varying vec4 v_vColour; varying vec4 v_vColour;
uniform vec2 u_resolution; uniform vec2 dimension;
uniform float density; uniform float density;
uniform float seed; uniform float seed;
uniform vec2 scale; uniform vec2 scale;
@ -16,11 +16,12 @@ uniform float thickness;
float random (in vec2 st) { return fract(sin(dot(st.xy + vec2(1., 6.), vec2(2., 7.))) * (1. + seed / 100.)); } float random (in vec2 st) { return fract(sin(dot(st.xy + vec2(1., 6.), vec2(2., 7.))) * (1. + seed / 100.)); }
void main() { void main() {
vec2 tx = 1. / u_resolution; vec2 ntx = v_vTexcoord * vec2(1., dimension.y / dimension.x);
vec2 ps = v_vTexcoord; vec2 tx = 1. / dimension;
vec2 ps = ntx;
float w = 0.; float w = 0.;
vec2 dim = u_resolution; vec2 dim = dimension;
vec2 pos = ps; vec2 pos = ps;
float _t = min(tx.x, tx.y) / 2.; float _t = min(tx.x, tx.y) / 2.;

View file

@ -7,7 +7,7 @@ varying vec4 v_vColour;
#define PI 3.141592 #define PI 3.141592
#define TAU 6.283184 #define TAU 6.283184
uniform vec2 u_resolution; uniform vec2 dimension;
uniform vec2 scale; uniform vec2 scale;
uniform vec2 position; uniform vec2 position;
@ -60,7 +60,8 @@ vec3 Oilnoise(in vec2 pos, in vec3 RGB) {
void main() { void main() {
vec2 pos = v_vTexcoord * scale + position; vec2 ntx = v_vTexcoord * vec2(1., dimension.y / dimension.x);
vec2 pos = ntx * scale + position;
vec3 col = Oilnoise(pos, color.rgb * gamma); vec3 col = Oilnoise(pos, color.rgb * gamma);
gl_FragColor = vec4(col, 1.0); gl_FragColor = vec4(col, 1.0);
} }

View file

@ -5,13 +5,14 @@ uniform float progress;
uniform float rotation; uniform float rotation;
uniform vec2 detail; uniform vec2 detail;
uniform vec2 u_resolution; uniform vec2 dimension;
uniform vec2 position; uniform vec2 position;
uniform vec2 scale; uniform vec2 scale;
void main() { void main() {
vec2 ntx = v_vTexcoord * vec2(1., dimension.y / dimension.x);
float ang = radians(rotation); float ang = radians(rotation);
vec2 uv = (v_vTexcoord - position / u_resolution) * mat2(cos(ang), -sin(ang), sin(ang), cos(ang)) * scale; vec2 uv = (ntx - position / dimension) * mat2(cos(ang), -sin(ang), sin(ang), cos(ang)) * scale;
for(float i = detail.x; i <= detail.y; i++) { for(float i = detail.x; i <= detail.y; i++) {
uv.x += .5 / i * sin(i * 3. * uv.y + progress); uv.x += .5 / i * sin(i * 3. * uv.y + progress);

View file

@ -3,7 +3,7 @@
varying vec2 v_vTexcoord; varying vec2 v_vTexcoord;
varying vec4 v_vColour; varying vec4 v_vColour;
uniform vec2 u_resolution; uniform vec2 dimension;
uniform vec2 position; uniform vec2 position;
uniform float rotation; uniform float rotation;
uniform vec2 scale; uniform vec2 scale;
@ -15,9 +15,10 @@ uniform float amplitude;
uniform int mode; uniform int mode;
void main() { void main() {
vec2 ntx = v_vTexcoord * vec2(1., dimension.y / dimension.x);
float ang = radians(rotation); float ang = radians(rotation);
vec2 pos = (v_vTexcoord - position / u_resolution) * mat2(cos(ang), -sin(ang), sin(ang), cos(ang)) * scale; vec2 pos = (ntx - position / dimension) * mat2(cos(ang), -sin(ang), sin(ang), cos(ang)) * scale;
vec4 col = vec4(0., 0., 0., 1.); vec4 col = vec4(0., 0., 0., 1.);
for (int i = 0; i < iteration; i++) { for (int i = 0; i < iteration; i++) {
pos += cos( pos.yx * 3. + vec2(0.0, stretch)) / 3.; pos += cos( pos.yx * 3. + vec2(0.0, stretch)) / 3.;

View file

@ -26,7 +26,7 @@ uniform vec2 scale;
uniform int scaleUseSurf; uniform int scaleUseSurf;
uniform sampler2D scaleSurf; uniform sampler2D scaleSurf;
uniform vec2 u_resolution; uniform vec2 dimension;
uniform vec2 position; uniform vec2 position;
uniform float trRotation; uniform float trRotation;
@ -98,8 +98,8 @@ void main() {
float r = radians(trRotation); float r = radians(trRotation);
vec2 pos = v_vTexcoord; vec2 pos = v_vTexcoord;
pos.x *= (u_resolution.x / u_resolution.y); pos.x *= (dimension.x / dimension.y);
pos = (pos - position / u_resolution) * mat2(cos(r), -sin(r), sin(r), cos(r)) * scale; pos = (pos - position / dimension) * mat2(cos(r), -sin(r), sin(r), cos(r)) * scale;
vec3 f = gabor_wave(pos); vec3 f = gabor_wave(pos);
vec3 col = vec3(0.5 + 0.5 * f.x); vec3 col = vec3(0.5 + 0.5 * f.x);

View file

@ -4,7 +4,7 @@
varying vec2 v_vTexcoord; varying vec2 v_vTexcoord;
varying vec4 v_vColour; varying vec4 v_vColour;
uniform vec2 u_resolution; uniform vec2 dimension;
uniform vec2 position; uniform vec2 position;
uniform float rotation; uniform float rotation;
uniform vec2 scale; uniform vec2 scale;
@ -92,9 +92,10 @@ vec3 iterateNoise ( vec2 pos, int iteration ) {
} }
void main() { void main() {
vec2 ntx = v_vTexcoord * vec2(1., dimension.y / dimension.x);
float ang = radians(rotation); float ang = radians(rotation);
vec2 pos = (v_vTexcoord - position / u_resolution) * mat2(cos(ang), -sin(ang), sin(ang), cos(ang)) * scale * 4.; vec2 pos = (ntx - position / dimension) * mat2(cos(ang), -sin(ang), sin(ang), cos(ang)) * scale * 4.;
vec3 col = iterateNoise(pos, iteration); vec3 col = iterateNoise(pos, iteration);
// if(mode == 0) col = vec3(noiseHoneycomb(pos)); // if(mode == 0) col = vec3(noiseHoneycomb(pos));
// else if(mode == 1) col = vec3(noiseHoneycombStar(pos)); // else if(mode == 1) col = vec3(noiseHoneycombStar(pos));

View file

@ -20,7 +20,7 @@ uniform vec2 scale;
uniform int scaleUseSurf; uniform int scaleUseSurf;
uniform sampler2D scaleSurf; uniform sampler2D scaleSurf;
uniform vec2 u_resolution; uniform vec2 dimension;
uniform vec2 position; uniform vec2 position;
uniform float rotation; uniform float rotation;
@ -77,8 +77,9 @@ void main() {
} }
#endregion #endregion
vec2 ntx = v_vTexcoord * vec2(1., dimension.y / dimension.x);
float ang = radians(rotation); float ang = radians(rotation);
vec2 pos = (v_vTexcoord - position / u_resolution) * mat2(cos(ang), -sin(ang), sin(ang), cos(ang)) * sca / 16.; vec2 pos = (ntx - position / dimension) * mat2(cos(ang), -sin(ang), sin(ang), cos(ang)) * sca / 16.;
prog /= 100.; prog /= 100.;
vec3 uv = vec3( pos + prog, prog * .5 ); vec3 uv = vec3( pos + prog, prog * .5 );

View file

@ -3,7 +3,7 @@
varying vec2 v_vTexcoord; varying vec2 v_vTexcoord;
varying vec4 v_vColour; varying vec4 v_vColour;
uniform vec2 u_resolution; uniform vec2 dimension;
uniform vec2 position; uniform vec2 position;
uniform float density; uniform float density;
uniform float seed; uniform float seed;
@ -20,11 +20,12 @@ uniform float thickness;
float random (in vec2 st) { return fract(sin(dot(st.xy + vec2(1., 6.), vec2(2., 7.))) * (1. + seed / 100.)); } float random (in vec2 st) { return fract(sin(dot(st.xy + vec2(1., 6.), vec2(2., 7.))) * (1. + seed / 100.)); }
void main() { void main() {
vec2 tx = 1. / u_resolution; vec2 ntx = v_vTexcoord * vec2(1., dimension.y / dimension.x);
vec2 ps = v_vTexcoord + position; vec2 tx = 1. / dimension;
vec2 ps = ntx + position;
float w = 0.; float w = 0.;
vec2 dim = axis == 0? u_resolution : u_resolution.yx; vec2 dim = axis == 0? dimension : dimension.yx;
vec2 pos = axis == 0? ps : ps.yx; vec2 pos = axis == 0? ps : ps.yx;
float _t = min(tx.x, tx.y) / 2.; float _t = min(tx.x, tx.y) / 2.;

View file

@ -11,7 +11,7 @@ varying vec2 v_vTexcoord;
varying vec4 v_vColour; varying vec4 v_vColour;
uniform float seed; uniform float seed;
uniform vec2 u_resolution; uniform vec2 dimension;
uniform vec2 position; uniform vec2 position;
uniform float rotation; uniform float rotation;
@ -66,8 +66,9 @@ void main() {
} }
#endregion #endregion
vec2 ntx = v_vTexcoord * vec2(1., dimension.y / dimension.x);
float ang = radians(rotation); float ang = radians(rotation);
vec2 pos = (v_vTexcoord - position / u_resolution) * mat2(cos(ang), -sin(ang), sin(ang), cos(ang)) * sca / 16.; vec2 pos = (ntx - position / dimension) * mat2(cos(ang), -sin(ang), sin(ang), cos(ang)) * sca / 16.;
vec3 col = vec3(0.); vec3 col = vec3(0.);
col += WaveletNoise(pos * 5., (2.9864 + prog), detl) * .5 + .5; col += WaveletNoise(pos * 5., (2.9864 + prog), detl) * .5 + .5;

View file

@ -1,7 +1,7 @@
varying vec2 v_vTexcoord; varying vec2 v_vTexcoord;
varying vec4 v_vColour; varying vec4 v_vColour;
uniform vec2 u_resolution; uniform vec2 dimension;
uniform vec2 position; uniform vec2 position;
uniform float scale; uniform float scale;
uniform int iteration; uniform int iteration;
@ -39,7 +39,8 @@ float perlin ( vec2 pos, int iteration ) {
///////////////////// PERLIN END ///////////////////// ///////////////////// PERLIN END /////////////////////
void main() { void main() {
vec2 pos = position + v_vTexcoord * scale; vec2 ntx = v_vTexcoord * vec2(1., dimension.y / dimension.x);
vec2 pos = position + ntx * scale;
float n = perlin(pos, iteration); float n = perlin(pos, iteration);
gl_FragColor = vec4(vec3(n), 1.0); gl_FragColor = vec4(vec3(n), 1.0);

View file

@ -4,7 +4,7 @@ varying vec2 v_vTexcoord;
varying vec4 v_vColour; varying vec4 v_vColour;
uniform int type; uniform int type;
uniform vec2 u_resolution; uniform vec2 dimension;
uniform vec2 position; uniform vec2 position;
uniform float rotation; uniform float rotation;
@ -193,8 +193,9 @@ void main() { #region
} }
#endregion #endregion
vec2 ntx = v_vTexcoord * vec2(1., dimension.y / dimension.x);
float ang = radians(rotation); float ang = radians(rotation);
vec2 uv = (v_vTexcoord - position / u_resolution) * mat2(cos(ang), -sin(ang), sin(ang), cos(ang)) * sca; vec2 uv = (ntx - position / dimension) * mat2(cos(ang), -sin(ang), sin(ang), cos(ang)) * sca;
if(colored == 0) { if(colored == 0) {
gl_FragColor = vec4(vec3(perlin(uv)), 1.0); gl_FragColor = vec4(vec3(perlin(uv)), 1.0);

View file

@ -4,7 +4,7 @@
varying vec2 v_vTexcoord; varying vec2 v_vTexcoord;
varying vec4 v_vColour; varying vec4 v_vColour;
uniform vec2 u_resolution; uniform vec2 dimension;
uniform vec2 position; uniform vec2 position;
uniform float rotation; uniform float rotation;
uniform vec2 scale; uniform vec2 scale;
@ -49,7 +49,7 @@ float noise (in vec2 st) {
void main() { void main() {
float ang = radians(rotation); float ang = radians(rotation);
vec2 pos = position / u_resolution; vec2 pos = position / dimension;
vec2 st = (v_vTexcoord - pos) * mat2(cos(ang), -sin(ang), sin(ang), cos(ang)) * scale; vec2 st = (v_vTexcoord - pos) * mat2(cos(ang), -sin(ang), sin(ang), cos(ang)) * scale;
float amp = bright; float amp = bright;

View file

@ -2,7 +2,7 @@ varying vec2 v_vTexcoord;
varying vec4 v_vColour; varying vec4 v_vColour;
uniform vec2 position; uniform vec2 position;
uniform vec2 u_resolution; uniform vec2 dimension;
uniform float rotation; uniform float rotation;
uniform vec2 scale; uniform vec2 scale;
@ -88,7 +88,7 @@ void main() { #region
} }
#endregion #endregion
vec2 pos = position / u_resolution; vec2 pos = position / dimension;
float ang = rotation; float ang = rotation;
vec2 st = (v_vTexcoord - pos) * mat2(cos(ang), -sin(ang), sin(ang), cos(ang)) * sca; vec2 st = (v_vTexcoord - pos) * mat2(cos(ang), -sin(ang), sin(ang), cos(ang)) * sca;

View file

@ -46,7 +46,8 @@ void main() { #region
#endregion #endregion
vec2 pos = (v_vTexcoord - position) * mat2(cos(ang), -sin(ang), sin(ang), cos(ang)) * amo; vec2 ntx = v_vTexcoord * vec2(1., dimension.y / dimension.x);
vec2 pos = (ntx - position) * mat2(cos(ang), -sin(ang), sin(ang), cos(ang)) * amo;
float value = 0.0; float value = 0.0;
int num = 4; int num = 4;

View file

@ -1,17 +1,17 @@
varying vec2 v_vTexcoord; varying vec2 v_vTexcoord;
varying vec4 v_vColour; varying vec4 v_vColour;
uniform vec2 u_resolution; uniform vec2 dimension;
uniform float rotation; uniform float rotation;
float d(vec4 c) { return (c.r + c.g + c.b) / 3. * c.a; } float d(vec4 c) { return (c.r + c.g + c.b) / 3. * c.a; }
void main() { void main() {
vec2 tx = 1. / u_resolution; vec2 tx = 1. / dimension;
vec4 cc = texture2D( gm_BaseTexture, v_vTexcoord ); vec4 cc = texture2D( gm_BaseTexture, v_vTexcoord );
int emp = 0; int emp = 0;
vec2 px = v_vTexcoord * u_resolution; vec2 px = v_vTexcoord * dimension;
gl_FragColor = vec4(0.); gl_FragColor = vec4(0.);

View file

@ -8,6 +8,8 @@ const int MAX_MARCHING_STEPS = 200;
const float EPSILON = 1e-6; const float EPSILON = 1e-6;
const float PI = 3.14159265358979323846; const float PI = 3.14159265358979323846;
uniform vec2 dimension;
uniform vec3 position; uniform vec3 position;
uniform vec3 rotation; uniform vec3 rotation;
uniform float objectScale; uniform float objectScale;
@ -354,6 +356,8 @@ vec3 marchDensity(in vec3 camera, in vec3 direction, out vec3 hitPos) {
} }
void main() { void main() {
vec2 ntx = v_vTexcoord * vec2(1., dimension.y / dimension.x);
mat3 rx = rotateX(rotation.x); mat3 rx = rotateX(rotation.x);
mat3 ry = rotateY(rotation.y); mat3 ry = rotateY(rotation.y);
mat3 rz = rotateZ(rotation.z); mat3 rz = rotateZ(rotation.z);
@ -361,7 +365,7 @@ void main() {
irotMatrix = inverse(rotMatrix); irotMatrix = inverse(rotMatrix);
float z = 1. / tan(radians(fov) / 2.); float z = 1. / tan(radians(fov) / 2.);
dir = normalize(vec3((v_vTexcoord - .5) * 2., -z)); dir = normalize(vec3((ntx - .5) * 2., -z));
eye = vec3(0., 0., 5.); eye = vec3(0., 0., 5.);
dir = normalize(irotMatrix * dir) / objectScale; dir = normalize(irotMatrix * dir) / objectScale;

View file

@ -147,22 +147,24 @@ float simplex(in vec2 st) {
} }
void main() { void main() {
vec2 ntx = v_vTexcoord * vec2(1., dimension.y / dimension.x);
sca = scale; sca = scale;
if(scaleUseSurf == 1) { if(scaleUseSurf == 1) {
vec4 _vMap = texture2D( scaleSurf, v_vTexcoord ); vec4 _vMap = texture2D( scaleSurf, ntx );
sca = vec2(mix(scale.x, scale.y, (_vMap.r + _vMap.g + _vMap.b) / 3.)); sca = vec2(mix(scale.x, scale.y, (_vMap.r + _vMap.g + _vMap.b) / 3.));
} }
itr = iteration.x; itr = iteration.x;
itrMax = max(iteration.x, iteration.y); itrMax = max(iteration.x, iteration.y);
if(iterationUseSurf == 1) { if(iterationUseSurf == 1) {
vec4 _vMap = texture2D( iterationSurf, v_vTexcoord ); vec4 _vMap = texture2D( iterationSurf, ntx );
itr = mix(iteration.x, iteration.y, (_vMap.r + _vMap.g + _vMap.b) / 3.); itr = mix(iteration.x, iteration.y, (_vMap.r + _vMap.g + _vMap.b) / 3.);
} }
vec2 pos = position.xy / dimension; vec2 pos = position.xy / dimension;
float ang = rotation; float ang = rotation;
vec2 st = (v_vTexcoord - pos) * mat2(cos(ang), -sin(ang), sin(ang), cos(ang)) * sca; vec2 st = (ntx - pos) * mat2(cos(ang), -sin(ang), sin(ang), cos(ang)) * sca;
if(colored == 0) { if(colored == 0) {
gl_FragColor = vec4(vec3(simplex(st)), 1.0); gl_FragColor = vec4(vec3(simplex(st)), 1.0);

View file

@ -7,10 +7,11 @@
varying vec2 v_vTexcoord; varying vec2 v_vTexcoord;
varying vec4 v_vColour; varying vec4 v_vColour;
uniform vec2 dimension;
uniform float seed; uniform float seed;
uniform float progress; uniform float progress;
uniform float paramA; uniform float paramA;
uniform vec2 u_resolution;
uniform vec2 position; uniform vec2 position;
uniform float rotation; uniform float rotation;
uniform vec2 scale; uniform vec2 scale;
@ -213,17 +214,20 @@ vec3 squareVoronoi( in vec2 x ) { #region // IQ classic voronoi - shadertoy.com/
} }
#endregion #endregion
void main() { #region void main() {
vec2 ntx = v_vTexcoord * vec2(1., dimension.y / dimension.x);
float ang = radians(rotation); float ang = radians(rotation);
vec2 pos = (v_vTexcoord - position / u_resolution) * mat2(cos(ang), -sin(ang), sin(ang), cos(ang)) * scale / 4.; vec2 pos = (ntx - position / dimension) * mat2(cos(ang), -sin(ang), sin(ang), cos(ang)) * scale / 4.;
if(mode == 0) { if(mode == 0) {
gl_FragColor = vec4(vec3(.1 + blockVoronoi(pos * vec2(1., -1.))), 1.0); gl_FragColor = vec4(vec3(.1 + blockVoronoi(pos * vec2(1., -1.))), 1.0);
} else if(mode == 1) { } else if(mode == 1) {
vec3 v = vec3(triangleVoronoi(pos * 2.)); vec3 v = vec3(triangleVoronoi(pos * 2.));
gl_FragColor = vec4(vec3(v.r), 1.0); gl_FragColor = vec4(vec3(v.r), 1.0);
} else if(mode == 2) { } else if(mode == 2) {
gl_FragColor = vec4(vec3(squareVoronoi(pos * 4.).r), 1.0); gl_FragColor = vec4(vec3(squareVoronoi(pos * 4.).r), 1.0);
} }
} #endregion }

View file

@ -7,7 +7,7 @@ uniform float seed;
uniform float progress; uniform float progress;
uniform float detail; uniform float detail;
uniform vec2 u_resolution; uniform vec2 dimension;
uniform vec2 position; uniform vec2 position;
uniform vec2 scale; uniform vec2 scale;
@ -82,7 +82,7 @@ vec4 snoise(vec3 v) {
void main() { void main() {
vec2 p = v_vTexcoord - .5; vec2 p = v_vTexcoord - .5;
p.x *= (u_resolution.x / u_resolution.y); p.x *= (dimension.x / dimension.y);
p = (p + position) * scale / 2.; p = (p + position) * scale / 2.;
vec3 pos = vec3(p.x, progress, p.y); vec3 pos = vec3(p.x, progress, p.y);

View file

@ -1,9 +1,9 @@
varying vec2 v_vTexcoord; varying vec2 v_vTexcoord;
varying vec4 v_vColour; varying vec4 v_vColour;
uniform vec2 dimension; uniform vec2 dimension;
uniform vec2 position; uniform vec2 position;
uniform int blend; uniform int blend;
uniform float rotation; uniform float rotation;
uniform vec2 amount; uniform vec2 amount;
@ -32,8 +32,8 @@ void main() {
ang = radians(ang); ang = radians(ang);
#endregion #endregion
vec2 ntx = v_vTexcoord * vec2(1., dimension.y / dimension.x);
vec2 pos = v_vTexcoord - position; vec2 pos = ntx - position;
float _cell = 1. / (amo * 2.); float _cell = 1. / (amo * 2.);
pos.y -= _cell / 2.; pos.y -= _cell / 2.;
pos *= mat2(cos(ang), -sin(ang), sin(ang), cos(ang)); pos *= mat2(cos(ang), -sin(ang), sin(ang), cos(ang));