Skip to content

Instantly share code, notes, and snippets.

View ektogamat's full-sized avatar
👋

Anderson Mancini ektogamat

👋
View GitHub Profile
@akella
akella / setup.md
Last active November 8, 2024 12:49
My Setup
@0beqz
0beqz / BoxProjectedEnvMapHelper.js
Last active September 21, 2024 05:34
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;
@imrobbiegreen
imrobbiegreen / gltf_loader_solution.js
Created May 30, 2022 23:57
Looking for a more effective solution to load gltf models
// Model 1
// Model 1 Maps
const s1RoomColor = textureLoader.load('/Threesources/Textures/HighRes/s1RoomBaseColor.jpg')
const s1RoomRoughness = textureLoader.load('/Threesources/Textures/HighRes/s1RoomRoughness.jpg')
const s1RoomMetalness = textureLoader.load('/Threesources/Textures/HighRes/s1RoomMetallic.jpg')
const s1RoomNormal = textureLoader.load('/Threesources/Textures/HighRes/s1RoomNormal.jpg')
const s1RoomOpacity = textureLoader.load('/Threesources/Textures/HighRes/s1RoomOpacity.png')
// Model 1 Flip
@sketchpunk
sketchpunk / arcball.js
Last active September 30, 2024 16:53
Maths for various camera movement ( Orbit, Arcball, FPS, Zoom, etc )
/** Using a faux sphere in screen space, determine the arc transform to orbit
* the camera around a target position. A continuous orientation will
* be provided for further calls.
*/
function arcBallTransform(
scrSize, // Screen size, vec2
scrPos0, // Starting mouse position, vec2
scrPos1, // Ending Mouse Positiong, vec2
rotOrientation, // Current arc orientation, quaternion
targetPos, // Position to orbit around
// Created by Anderson Mancini 2023
// React Three Fiber AutoFocus Component to be used
// as an extension for default Depth Of Field from react-three/postprocessing
// HOW TO USE?
// import AutoFocusDOF from './AutoFocusDOF'
//
// And add this component inside the EffectsComposer...
//...
// <EffectComposer>