Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom vertex shader #15

Open
glebka100500 opened this issue Nov 7, 2020 · 1 comment
Open

Custom vertex shader #15

glebka100500 opened this issue Nov 7, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@glebka100500
Copy link

glebka100500 commented Nov 7, 2020

Hi, I really like this package, easy to use and to set up, is there a possibility to use custom vertex shader, or at least include my own model matrix? I think it would be really helpful and will expand project's versatility

@fand
Copy link
Owner

fand commented Dec 7, 2021

Hi @glebka100500 ! sorry I didn't notice the issue...

Currently REACT-VFX only accepts fragment shaders.
However, by recent updated, the mesh is placed to cover the entire screen so that it can render outside the area of the original element.
So now you can move or scale the textures by modifying the uv coord like this:

void main() {
  vec2 uv = (gl_FragCoord.xy - offset) / resolution;

  // scale
  uv = (uv - 0.5) * 1.5 + 0.5;

  // offset
  uv.x += sin(time) * 0.3;

  gl_FragColor = texture2D(src, uv);
}

I think this covers most usecases, but if you have any ideas to do something cool with vertex shaders, please tell me again.

@fand fand added the enhancement New feature or request label Jun 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants