GithubHelp home page GithubHelp logo

funtechinc / use-shader-fx Goto Github PK

View Code? Open in Web Editor NEW
205.0 2.0 9.0 500.45 MB

⚡️ More FXs, Less GLSL

Home Page: https://use-shader-fx.vercel.app

License: MIT License

TypeScript 67.62% GLSL 10.13% JavaScript 21.86% CSS 0.02% SCSS 0.36%
react webgl glsl glsl-shader helpers hooks threejs react-three-fiber react-three-drei shader

use-shader-fx's People

Contributors

mkubdev avatar roku-ft avatar takuma-hmng8 avatar yutofukui avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

use-shader-fx's Issues

useMetamorphose

  • noise マッピングするnoiseテクスチャー
  • switch 0~1
  • [texture,texture] スイッチする テクスチャー
  • dir トランジションする方向

useFlag

  • 旗がなびくみたいなやつ

usePixelGrid

  • テクスチャーを受けとって、さらにテクスチャーを返す。
  • 全体的にピクセルグリッド表現になって、色がある部分がピクセライズされる。みたいな

useLense

  • 外側に行くに従ってrgbが強くなるサークル
  • マウスに追従、慣性
  • サークルの中にテクスチャーをマッピングできるように

UV projection of `pointerValues` for FX is wrong

Following this setup to assign custom pointer values to FX hooks (Ex: useFluid) results in a wrong UV projection, as while pointer value goes from 0 -> 1, the effects display from 0.5 -> 1 on the UV instead.

useFrame((props) => {
    const pointerValues = updatePointer(refPointer.current);
    
    //This however returns the correct values of pointerValues
    console.log('pointerValues', pointerValues);
    
     //Therefore, I suspects the issue lie inside the updateFluid
    const fluid = updateFluid(props, { pointerValues: pointerValues });
    const fx = updateBlending(props, {
	    map: fluid,
	    alphaMap: false,
    });
    materialRef.current!.material.uniforms.u_fx.value = fx;
});
2024-03-04.20-52-56.mp4

If I use my custom code for useFluid that I created in this PR #65, it works well like below:

2024-03-04.20-58-43.mp4

Make FX shader overlay the scene

How can I make the FX shader overlay the current scene? Following the basic example in the docs, it hides everything behind the shader, while I want it to be like a transparent overlay effect, that show color on mouse movement.

Apply Fluid Shader FX as reflective plane material

I'm trying to apply useFluid and useBlending FX to a custom <MeshReflectorMaterial/> from drei, to create a reflective water with ripple as you move the mouse along the surface, and I encounter some issues with it:

  • The mouse positions are set to viewport by default, while I want to map it to the plane UV coordinates. Is this possible?
  • In <MeshReflectorMaterial/> fragment shader, it output color as vec4 diffuseColor, so I can not "morph" the UV using the usual ways "texture2D(diffuseColor, uv)". I wonder if it is possible to morph the UV of diffuseColor in this case?
  • Render the whole scene into createPortal to use it as texture of full-screen FX plane will disable the mouse movement of scene, leads to any prior mouse event in the scene will stop working.

I wonder if everything mention above is possible with this package? I have ported and created CustomMeshReflectorMaterial, linked it with useFluid and useBlending to apply the FX to the material in this codesandbox!

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.