This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Created by Anderson Mancini 2023 | |
// React Three Fiber Ultimate LensFlare | |
// To be used Effect together with react-three/postprocessing | |
import { Uniform, Color, Vector3 } from 'three' | |
import { BlendFunction, Effect } from 'postprocessing' | |
import { wrapEffect } from './util.tsx' | |
import { useRef, useMemo, useEffect } from 'react' | |
import { useFrame, useThree } from '@react-three/fiber' | |
import { useTexture } from '@react-three/drei' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// File copy pasted from https://github.com/pmndrs/react-postprocessing/blob/master/src/util.tsx | |
import React, { forwardRef, useMemo, useLayoutEffect, MutableRefObject } from 'react' | |
import { Vector2, Object3D } from 'three' | |
import { ReactThreeFiber, useThree } from '@react-three/fiber' | |
import { Effect, BlendFunction } from 'postprocessing' | |
type ObjectRef = MutableRefObject<Object3D> | |
type DefaultProps = Partial<{ blendFunction: BlendFunction; opacity: number }> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Lens Flare by Anderson Mancini | |
* Based on: https://github.com/ektogamat/R3F-Ultimate-Lens-Flare | |
*/ | |
import * as THREE from 'three' | |
import { easing } from 'maath' | |
export let LensFlareParams = {} | |
/** | |
* @param {Boolean | undefined} enabled Enable or disable the effect |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// CONFETTI COMPONENT BY ANDERSON MANCINI AND ROMAIN HERAULT | |
// Based on: https://github.com/JamesChan21/threejs-confetti | |
// Based on: https://github.com/daniel-lundin/dom-confetti | |
// If you use, please credit it :) | |
import React, { useRef, useState } from 'react' | |
import { useFrame } from '@react-three/fiber' | |
import * as THREE from 'three' | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Holographic material component by Anderson Mancini - Dec 2023. | |
* Dec 7th - Added useMemo for better performance | |
*/ | |
import React, { useRef, useMemo } from 'react' | |
import { shaderMaterial } from '@react-three/drei' | |
import { extend, useFrame } from '@react-three/fiber' | |
import { | |
Color, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Holographic material by Anderson Mancini - Dec 2023. | |
*/ | |
import { ShaderMaterial, Clock, Uniform, Color, NormalBlending, AdditiveBlending, FrontSide, BackSide, DoubleSide } from 'three'; | |
class HolographicMaterial extends ShaderMaterial { | |
/** | |
* Create a HolographicMaterial. | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useMemo } from 'react' | |
import PropTypes from 'prop-types' | |
import { shaderMaterial } from '@react-three/drei' | |
import { extend } from '@react-three/fiber' | |
import { Color, DoubleSide, AdditiveBlending } from 'three' | |
/** | |
* @typedef {Object} FakeGlowMaterialProps | |
* @property {Number} [falloff=0.1] - Controls the value of the Falloff effect. Ranges from 0.0 to 1.0. | |
* @property {Number} [glowInternalRadius=6.0] - Controls the internal glow radius. Ranges from -1.0 to 1.0. Set a darker color to get the fresnel effect only. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useMemo } from "react"; | |
import { shaderMaterial } from "@react-three/drei"; | |
import type { Object3DNode } from "@react-three/fiber"; | |
import { extend } from "@react-three/fiber"; | |
import type { Material, Side } from "three"; | |
import { AdditiveBlending, Color, FrontSide } from "three"; | |
import type { ColorRepresentation } from "three"; | |
/** | |
* @typedef {Object} FakeGlowMaterialProps |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* FakeGlow material by Anderson Mancini - Fec 2024. | |
*/ | |
import { ShaderMaterial, Uniform, Color, AdditiveBlending, FrontSide, BackSide, DoubleSide } from 'three'; | |
class FakeGlowMaterial extends ShaderMaterial { | |
/** | |
* Create a FakeGlowMaterial. | |
* |
OlderNewer