funtechinc / use-shader-fx Goto Github PK
View Code? Open in Web Editor NEW⚡️ More FXs, Less GLSL
Home Page: https://use-shader-fx.vercel.app
License: MIT License
⚡️ More FXs, Less GLSL
Home Page: https://use-shader-fx.vercel.app
License: MIT License
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;
});
If I use my custom code for useFluid
that I created in this PR #65, it works well like below:
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.
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:
<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?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!
@takuma-hmng8 test
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.