Reviewed-on: #1
Co-authored-by: Persson-dev <sim16.prib@gmail.com>
Co-committed-by: Persson-dev <sim16.prib@gmail.com>
This commit was merged in pull request #1.
This commit is contained in:
2025-11-09 15:41:00 +00:00
committed by Simon Pribylski
parent 86def65569
commit 926bf694c0
11 changed files with 416 additions and 117 deletions

View File

@@ -1,32 +1,42 @@
#version 460 core
layout(rgba32f, binding = 0) uniform writeonly image2D outputImage;
layout(std430, binding = 3) buffer layoutName {
float o_Points[];
};
layout(local_size_x = 16, local_size_y = 16) in;
void main()
const uint transformationCount = 3;
layout(location = 1) uniform mat4 transformations[transformationCount];
layout(local_size_x = 64) in;
highp float rand(vec2 co)
{
ivec2 pixelCoord = ivec2(gl_GlobalInvocationID.xy);
highp float a = 12.9898;
highp float b = 78.233;
highp float c = 43758.5453;
highp float dt= dot(co.xy ,vec2(a,b));
highp float sn= mod(dt,3.14);
return fract(sin(sn) * c);
}
if (pixelCoord.x >= imageSize(outputImage).x || pixelCoord.y >= imageSize(outputImage).y)
return;
vec3 unpack(uint index) {
return vec3(o_Points[index * 3], o_Points[index * 3 + 1], o_Points[index * 3 + 2]);
}
ivec2 texSize = imageSize(outputImage);
vec2 fTexSize = vec2(texSize);
vec2 normalizedCoord = vec2(pixelCoord) / vec2(texSize);
void store(vec3 vect, uint index) {
o_Points[index * 3] = vect.x;
o_Points[index * 3 + 1] = vect.y;
o_Points[index * 3 + 2] = vect.z;
}
vec4 O = vec4(0, 0, 0, 1);
vec2 I = vec2(pixelCoord);
void main() {
uint currentIndex = gl_GlobalInvocationID.x;
vec3 currentPoint = unpack(currentIndex);
float iTime = 2.2;
float i = 0.0, t=iTime;
O *= i;
for(vec2 a=fTexSize.xy, p=(I+I-a)/a.y; i++<20.;
O += (cos(sin(i*.2+t)*vec4(0,4,3,1))+2.)
/(i/1e3+abs(length(a-.5*min(a+a.yx,.1))-.05)))
a.x = abs(a = (fract(.2*t+.3*p*i*mat2(cos(cos(.2*t+.2*i)+vec4(0,11,33,0))))-.5)).x;
O = tanh(O*O/2e5);
uint index = uint(rand(currentPoint.xy + currentPoint.z + currentIndex) * 69);
mat4 transformation = transformations[index % transformationCount];
vec4 color = vec4(normalizedCoord, 0.0, 1.0);
imageStore(outputImage, pixelCoord, O);
vec3 result = (transformation * vec4(currentPoint, 1.0)).xyz;
store(result, currentIndex);
}

8
Shaders/Fragment.glsl Normal file
View File

@@ -0,0 +1,8 @@
#version 460 core
layout (location = 0) out vec4 o_Color;
void main()
{
o_Color = vec4(1, 1, 1, 1);
}

18
Shaders/Vertex.glsl Normal file
View File

@@ -0,0 +1,18 @@
#version 460 core
layout(std430, binding = 3) buffer layoutName
{
float data_SSBO[];
};
layout(location = 0) uniform mat4 viewMatrix;
layout(location = 1) uniform mat4 projectionMatrix;
vec3 unpack(uint index) {
return vec3(data_SSBO[index * 3], data_SSBO[index * 3 + 1], data_SSBO[index * 3 + 2]);
}
void main()
{
gl_Position = projectionMatrix * viewMatrix * vec4(unpack(gl_InstanceID), 1.0);
}