Skip to content

Instantly share code, notes, and snippets.

@zvodd
zvodd / 3d-graphics-spaces-and-matrices.md
Last active September 9, 2024 09:50
3D Spaces and Matrices in Godot 4 Shaders

Vertex and Fragment Function Spaces

  1. Vertex Function:

    • Input: Model Space (Local Space)
    • Output: Clip Space
  2. Fragment Function:

    • Input: View Space (Camera Space)

Coordinate Spaces

@zvodd
zvodd / geom_node_instance_positions.py
Last active September 8, 2024 19:35
Blender 4 instance enumeration - Including unrealized Geometry Node generated instances.
import bpy
# https://docs.blender.org/api/current/bpy.types.Depsgraph.html
# https://docs.blender.org/api/current/bpy.types.DepsgraphObjectInstance.html
def report_instances(obj):
"""
Reports the instances under an object in the Blender scene.
Including unrealized Geometry Node generated instances.
@zvodd
zvodd / gallery_overlay_modal.py
Last active September 4, 2024 16:21
Blender 4 Image Gallery Overlay
@zvodd
zvodd / vFacePaint.py
Last active July 26, 2024 20:20
Blender Vertex Face Brush [tested in 3.6]
#
# Add a tool to vertex paint mode that paints by FACE
#
import bpy
import bmesh
from mathutils import Vector
from bpy.types import WorkSpaceTool
from bl_ui.space_toolsystem_common import ToolDef
from bpy_extras import view3d_utils
@zvodd
zvodd / synth_sound_demo.py
Last active March 3, 2024 02:15
pygame, pyaudio, additive "synth" demo with bandpass filter.
import pygame
import pygame_gui
import math
import pyaudio
import struct
SCREEN_X = 800
SCREEN_Y = 600
SCOPE_DIMS = (SCREEN_X//4, SCREEN_Y // 4)
@zvodd
zvodd / wave_combiner.py
Created February 24, 2023 10:18
pygame + pyaudio "synth": wave generation inspection and filtering
import pygame
import pygame_gui
import math
import pyaudio
import struct
SCREEN_X = 800
SCREEN_Y = 600
SCOPE_DIMS = (SCREEN_X//4, SCREEN_Y // 4)
@zvodd
zvodd / spiralout.py
Created February 23, 2023 07:34
pygame spiral markov chain pixels
import pygame
import numpy as np
SCREEN_X = 256
SCREEN_Y = 256
GRID_SIZE = SCREEN_X //6
CELL_W = SCREEN_X // GRID_SIZE
CELL_H = SCREEN_Y // GRID_SIZE
@zvodd
zvodd / view_wave.py
Created February 21, 2023 14:04
interactive waveform generation and mixing using pygame and pyaudio
import pygame
import pygame_gui
import math
import pyaudio
import struct
SCREEN_X = 800
SCREEN_Y = 600
SCOPE_DIMS = (SCREEN_X//4, SCREEN_Y // 4)
@zvodd
zvodd / color_palette_from_images.html
Last active November 26, 2022 03:18
color palette js
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>whatever</title>
<script>
/*
This is a completly disorganised mess of shoehorning old code into a new proof of concept.
@zvodd
zvodd / howtobasicrust.rs
Created May 9, 2022 16:28
Baby's first rust code. A basic guessing game that was primarily a product of trail and error, as tutorials just aren't as much fun as breaking things.
use rand::Rng;
use std::io;
static HINT_HIGHER: &str = "higher";
static HINT_LOWER: &str = "lower";
fn main() {
println!("Guess the integer between 0 and 9.");
let target: u8 = rand::thread_rng().gen_range(1..10);