Skip to content

Instantly share code, notes, and snippets.

View dghez's full-sized avatar
🌝

Robert dghez

🌝
View GitHub Profile
@dghez
dghez / GlslSobel.frag
Created June 25, 2024 14:27 — forked from Hebali/GlslSobel.frag
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)
{
@dghez
dghez / TruchetTiling.glsl
Created November 13, 2023 23:56 — forked from Forenard/TruchetTiling.glsl
TruchetTiling.glsl
#version 300 es
#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif
out vec4 outColor;
@dghez
dghez / BoxProjectedEnvMapHelper.js
Created April 5, 2022 10:33 — forked from 0beqz/BoxProjectedEnvMapHelper.js
Updated code to box-project env-maps in three.js (r137) - credits go to codercat (https://codercat.tk) for the box-projecting code
import * as THREE from "three"
// credits for the box-projecting shader code go to codercat (https://codercat.tk)
const worldposReplace = /* glsl */`
#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )
vec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );
#ifdef BOX_PROJECTED_ENV_MAP
vWorldPosition = worldPosition.xyz;