Skip to content

Instantly share code, notes, and snippets.

@KdotJPG
KdotJPG / K.jpg's Idea Dump.md
Last active October 25, 2022 04:45
K.jpg's Idea Dump

K.jpg's Idea Dump

Game dev, procedural generation, and general coding ideas I come up with and want to make sure others can consider as well. I try to cover a lot of the details / use cases that come to mind, but it would be difficult to cover them all. Not all of these ideas are fully thought through, but they might still be pretty close to usable implementation descriptions. I'll try to update this whenever I think of something to add to it. If you use one of these ideas directly, and you got it here first, credit is appreciated but certainly not required! Credit is whatever, just please stop adding to the development and creativity obstacle minefield that is the sea of software patents.

Noise Generation

Union of reciprocal lattices

  • Generate procedural noise, or perform another function on a particular lattice in N-dimensions, by constructing the lattice as a union of copies of its reciprocal lattice.
  • Look at the points that each reciprocal lattice misses on the original lattice. Keep p
@KdotJPG
KdotJPG / Description 不要授予专利“用于转换数字图像的方法” CN110264409A CN201910160651.XA
Last active January 10, 2020 13:30
不要授予专利“用于转换数字图像的方法” CN110264409A CN201910160651.XA
I cannot find the Web Link to submit Prior Art against a patent application in China. So the best that I can do is post this,
and hope that the patent examiner in China will find it.
Keywords: noise vertex lattice simplex image parameter novaquark range quadrangle quadrilateral non-local gradient matrix
我找不到该Web链接来提交针对中国专利申请的现有技术。 因此,我能做的最好的就是发布这篇文章,并希望中国的专利审查员能够找到它。
关键字:噪声,顶点,晶格,单纯形,图像,参数,novaquark,范围,四边形,非局部,梯度,矩阵
Note to others who read this: I have heard recommendations not to review unexpired patents without a lawyer present. Take from that what you will (not legal advice).
@KdotJPG
KdotJPG / computeGoodEnoughNoise.java
Last active January 29, 2020 23:35
Sample code for only generating enough noise octaves to know the sign of the final value (simplified from a small WIP MC mod of mine)
private double computeGoodEnoughNoise(int worldX, int worldY, int worldZ, double startingValue) {
// Final noise value begins with the threshold.
double value = startingValue; // e.g. -heightThreshold (negative)
double freq = BASE_FREQUENCY; // e.g. 1.0/256.0
double amp = BASE_AMPLITUDE; // e.g. 64.0
for (int i = 0; i < nOctaves && actualValue > -uncertaintyBounds[i] && actualValue < uncertaintyBounds[i]; i++) {
value += octaves[i].noise3_XZBeforeY(worldX * hScale * freq, worldY * vScale * freq, worldZ * hScale * freq) * amp;
freq *= 2.0;
@KdotJPG
KdotJPG / OpenSimplexNoise.cs
Last active August 12, 2024 11:20 — forked from digitalshadow/OpenSimplexNoise.cs
OpenSimplex Noise Refactored for C# (with updated gradient sets)
/* OpenSimplex Noise in C#
* Ported from https://gist.github.com/KdotJPG/b1270127455a94ac5d19
* and heavily refactored to improve performance.
* Updated Dec 2019, Feb 2020: New Gradients, XYBeforeZ + XZBeforeY 3D functions. */
using System;
using System.Runtime.CompilerServices;
namespace NoiseTest
{
@KdotJPG
KdotJPG / OpenSimplexNoiseTileable3D.java
Created December 25, 2014 13:18
Tileable 3D OpenSimplex Noise
/*
* OpenSimplex Noise in Java.
* by Kurt Spencer
*
* Tileable 3D version, preliminary release.
* Could probably use further optimization.
*
* w6, h6, and d6 are each 1/6 of the repeating period.
* for x, y, z respectively. If w6 = 2, h6 = 2, d6 = 2,
* then the noise repeats in blocks of (0,0,0)->(12,12,12)
@KdotJPG
KdotJPG / SimplexValueNoise.java
Created October 13, 2014 07:57
Coherent noise algorithm based on value-multiplied kernels on a triangular grid.
/*
* SimplexValue Noise in Java.
* by Kurt Spencer
*
* Public Domain
*/
public class SimplexValueNoise {
private static final double SQUISH_CONSTANT = 0.366025403784439; //(Math.sqrt(2+1)-1)/2;
@KdotJPG
KdotJPG / SimplexValueSplineNoise.java
Last active December 6, 2019 13:55
Coherent noise algorithm based off of C2-continuous polynomial spline on a triangular grid.
/*
* SimplexValue Noise in Java.
* by Kurt Spencer
*
* v1.0.1
* - Slight change to seed RNG
* - Removed default permutation array in favor of
* default seed.
*/
@KdotJPG
KdotJPG / OpenSimplex2S.java
Last active December 23, 2024 10:24
Visually isotropic coherent noise algorithm based on alternate constructions of the A* lattice.
/**
* K.jpg's OpenSimplex 2, smooth variant ("SuperSimplex")
*
* More language ports, as well as legacy 2014 OpenSimplex, can be found here:
* https://github.com/KdotJPG/OpenSimplex2
*/
public class OpenSimplex2S {
private static final long PRIME_X = 0x5205402B9270C86FL;