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

Apply to all threejs shaders? #1

Open
luruke opened this issue Apr 4, 2019 · 2 comments
Open

Apply to all threejs shaders? #1

luruke opened this issue Apr 4, 2019 · 2 comments
Labels
enhancement New feature or request idea

Comments

@luruke
Copy link
Owner

luruke commented Apr 4, 2019

Just an idea, we could plug and use the magic comments everywhere on three.js without even using the MagicShader class...

@luruke luruke added enhancement New feature or request idea and removed enhancement New feature or request labels Apr 4, 2019
@akella
Copy link

akella commented Apr 5, 2019

i think my issue belongs here: i've been using usual ShaderMaterial, and just noticed it only works for RawShaderMaterial right now. It actually works perfectly if u just replace this dep in your code. But i guess there should be some more clever way for that.
And thank you again for implementing this idea! =)

@luruke
Copy link
Owner Author

luruke commented Apr 7, 2019

Yeah, a solution could be:

import MagicShader from 'magicshader';

const material = new MagicShader(Material)({
  fragmentShader:'...'
});

where Material can be anything that inherits from THREE.Material.
But I guess it would be just useful for RawShaderMaterial and ShaderMaterial...

Or a syntax like:

import { MagicShader, RawMagicShader} from 'magicshader';

where MagicShader uses ShaderMaterial and RawMagicShader uses RawShaderMaterial

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request idea
Projects
None yet
Development

No branches or pull requests

2 participants