Generative Art

148 readers
1 users here now

A community for posting algorithmically generated art. Can be digital or physical.

Rules

We also strongly recommend you mention the basic tools used so others can search for them

founded 4 years ago
MODERATORS
1
 
 

cross-posted from: https://lemmy.spaceships.me/post/17978

Procedurally generated video of stars and clouds moving using a parallax effect.

This video actually consists of multiple pieces of procedurally generated art combined together. These individual parts are the star and cloud textures, the code that animates them and the Bézier curve gradients that add colour.

I created this art as a part of Spaceships, a free/libre video game that I created. The game and this art are created in the Rust programming language and using the glium crate for rendering the video (this is a safe abstraction to OpenGL).

Each individual star texture is generated from four glowing lines that intersect the centre of the texture. I was inspired by GIMP's sparkle plugin on individual pixels when making this.

The clouds are generated using Perlin noise in a similar way to how this article generates them. The video uses three cloud images layered on top of each other.

The larger game that this is part of is 2D, but the sky background is 3D, with each individual star and cloud image having a z coordinate that gives a parallax effect when the camera moves.

What I have described so far would only generate a greyscale video. For the clouds, what adds colour are two Bézier curve gradients. Each of the two colour channels in each cloud image is treated as input to the Bézier curve which outputs an RGB colour. Once the clouds are rendered, the stars are rendered on top and coloured based on the colour of the generated clouds right under it.

Here are the source files that are used to generate this video. These only provide a partial picture as they depend on many other source files, but if you want to get an understanding of how the code works, these are a good place to start exploring.

  1. Star texture generation code: https://codeberg.org/rustydev/spaceships/src/tag/v1.3.1/assets/src/textures/stars.rs
  2. Cloud texture generation code: https://codeberg.org/rustydev/spaceships/src/tag/v1.3.1/assets/src/textures/clouds.rs
  3. Animation: https://codeberg.org/rustydev/spaceships/src/tag/v1.3.1/src/playing/view/decorations/sky.rs
  4. Gradient: https://codeberg.org/rustydev/spaceships/src/tag/v1.3.1/src/game/config.rs#L113-L119
2
 
 

cross-posted from: https://sopuli.xyz/post/22614106

Today we want to generate this star like shape using sums of trigeometric functions sin and cos: exponential-sum

Function:

f(x) = x/57 + x**3/19 

where x**3 is x^3 = x*x*x written in python

To calculate the x and y coordinate of the nth. step:

sx(n) = sum((75*cos(2*pi*f(i)) for i in range(n)))
sy(n) = sum((75*sin(2*pi*f(i)) for i in range(n)))

To render this with pythons turtle library, the following code can be used.

from math import cos, sin, pi, tan
def f(x):
    form = x/57 + x**3/19
    return form

def seq(fu):
    r = 75 # "zoom" level, kinda arbitrary choice so you can see it well
    s = [0, 0]
    for i in range(10000):
        s[0] += r*cos(2*pi*fu(i))
        s[1] += r*sin(2*pi*fu(i))
        yield s

import turtle
from time import sleep
for i in seq(f):
    turtle.setpos(i[0], i[1])
sleep(20)

This exponential sum with function f seems to have a limited convergence-radius / the sum stays in a bounded circle for longer than 10000 steps in my experiments. Can you proof this?

Further reading:

3
4
 
 
5
 
 
6
 
 
7
1
writhing choad (leminal.space)
submitted 7 months ago* (last edited 7 months ago) by [email protected] to c/[email protected]
 
 
8
9
1
submitted 8 months ago* (last edited 8 months ago) by [email protected] to c/[email protected]
 
 

~~Gif is very small due to lemmy.ml size restrictions. I can probably put a higher res one on youtube if ppl want to see.~~

edit: made it reasonable size by changing it to mp4

10
1
Rain (lemmy.ca)
submitted 9 months ago* (last edited 9 months ago) by [email protected] to c/[email protected]
 
 

// Randomly spawn drops

// Take a random fraction of each cell move it down, or down and to the left or right

// The remainder of the fraction stays where it is

// Subtract a constant small value from all cells to prevent rain from accumulating

11
12
13
 
 

cross-posted from: https://lemm.ee/post/3796105

Video description:

A prototype of the project of virtual breeding of digital plants by crossing. Each plant has a genome, which is an array of numbers. By crossing plants (mixing their genome), we get a new kind of plant. In this way, you can get very interesting and unusual results.

Summary generated by claude.ai from the video transcript:

A generative art project to create abstract images of imaginary plants. The creator starts with a genome represented as a sequence of numbers that gets fed into an algorithm to generate plant images. By evolving the genomes through processes like mutation and crossover, new plant images emerge. The creator discusses the challenges of defining an objective fitness function, since beauty is subjective. Without a fitness function for natural selection, the creator resorts to artificial selection by manually choosing genomes to crossover. The resulting plants have unique, imaginary qualities that can't be precisely predicted in advance. The creator notes some possible rules to make the plants more unique, like limiting how similar parent genomes can be. Overall, the project aims to explore an abstract generative space of imaginary plants through evolutionary techniques.

14