Skip to content

Instantly share code, notes, and snippets.

View Anthelmed's full-sized avatar

Anthelme Dumont Anthelmed

View GitHub Profile
@vedranjaic
vedranjaic / iphone_disable_autozoom_input.css
Created May 26, 2013 17:40
css: iPhone - Disable auto-zoom on input fields
/*
* disable auto-zoom on iphone input field focus
* http://www.456bereastreet.com/archive/201212/ios_webkit_browsers_and_auto-zooming_form_controls/
*/
input[type='text']:focus,
input[type='number']:focus,
textarea:focus {
font-size: 16px;
}
@mattatz
mattatz / SobelFilter.shader
Last active September 27, 2024 07:47
Sobel filter shader for Unity.
Shader "Mattatz/SobelFilter" {
Properties {
_MainTex ("Base (RGB)", 2D) = "white" {}
_DeltaX ("Delta X", Float) = 0.01
_DeltaY ("Delta Y", Float) = 0.01
}
SubShader {
Tags { "RenderType"="Opaque" }
@ahem
ahem / loadimage.js
Created October 18, 2016 12:59
Load and decode images with webworker
/* global createImageBitmap */
function loadImageWithImageTag(src) {
return new Promise((resolve, reject) => {
const img = new Image;
img.crossOrigin = '';
img.src = src;
img.onload = () => { resolve(img); };
img.onerror = () => { reject(img); };
});
@Hebali
Hebali / GlslSobel.frag
Created January 12, 2017 17:25
GLSL Fragment Shader: Sobel Edge Detection
// Sobel Edge Detection Filter
// GLSL Fragment Shader
// Implementation by Patrick Hebron
uniform sampler2D texture;
uniform float width;
uniform float height;
void make_kernel(inout vec4 n[9], sampler2D tex, vec2 coord)
{
@valyard
valyard / Jobs_and_ecs.cs
Created July 10, 2017 20:20
"Slides" about C# Job System and ESC in Unity.
// ######################################################################
//
// We want you to write more efficient code
//
// ######################################################################
But, we teach the opposite...
You know, GameObjects and Components.
...
@kodai100
kodai100 / Toggle.shader
Created August 8, 2017 03:01
Unity Shader Bool Property Example
Shader "Custom/ToggleTest" {
Properties{
_BackgroundTex("Background Texture", 2D) = "white"{}
[Toggle(USE_TEXTURE)] _UseTexture("Use Texture", Float) = 0
}
SubShader{
Tags{ "Queue" = "Transparent" "RenderType" = "Transparent" }

Generating Procedural Game Worlds with Wave Function Collapse

Wave Function Collapse (WFC) by @exutumno is a new algorithm that can generate procedural patterns from a sample image. It's especially exciting for game designers, letting us draw our ideas instead of hand coding them. We'll take a look at the kinds of output WFC can produce and the meaning of the algorithm's parameters. Then we'll walk through setting up WFC in javascript and the Unity game engine.

sprites

The traditional approach to this sort of output is to hand code algorithms that generate features, and combine them to alter your game map. For example you could sprinkle some trees at random coordinates, draw roads with a brownian motion, and add rooms with a Binary Space Partition. This is powerful but time consuming, and your original vision can someti

@keijiro
keijiro / mesh_to_pointcloud.md
Last active October 9, 2023 12:34
How to convert a mesh into a point cloud with Houdini.

screenshot

  1. Import the source geometry.
  2. Append a Point Wrangle SOP and set the following snippet.
int vlist[] = pointvertices(0, @ptnum);
vector uv = vertex(0, "uv", vlist[0]);
@Cd = colormap("$HIP/TEXTURE_FILENAME.jpg", uv);
  1. Insert a Delete SOP. Change the pattern to "*". Enable "Keep Points".
@yumayanagisawa
yumayanagisawa / CurlNoise.compute
Last active August 18, 2021 01:35
Unity3D | Curl Noise x Compute Shader
// https://github.com/keijiro/NoiseShader
#include "HLSL/SimplexNoise3D.hlsl"
#pragma kernel CSParticle
// Particle's data
struct Particle
{
float3 position;
float3 velocity;
@zcyemi
zcyemi / JsonHelper.cs
Created March 14, 2018 13:51
Json.Net.JsonConverter for Unity Vector struct.
using UnityEngine;
using Newtonsoft.Json;
using System;
public class Vec4Conv : JsonConverter
{
public override bool CanConvert(Type objectType)
{
if (objectType == typeof(Vector4))