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

NodeMaterial structure changes compared to existing shaders #14250

Closed
pailhead opened this issue Jun 8, 2018 · 1 comment
Closed

NodeMaterial structure changes compared to existing shaders #14250

pailhead opened this issue Jun 8, 2018 · 1 comment
Labels

Comments

@pailhead
Copy link
Contributor

pailhead commented Jun 8, 2018

Trying to extract various topics from #7522

See this comment for a direction for texturing/mapping imposed by NodeMaterial. #14214 (comment)

I propose this requirement be extracted from NodeMaterial and considered for application to the other systems:

For example, right now the templates are limited by this pattern:
https://github.com/mrdoob/three.js/blob/dev/src/renderers/shaders/ShaderChunk/alphamap_fragment.glsl

//alphamap_fragment.glsl

#ifdef USE_ALPHAMAP

	diffuseColor.a *= texture2D( alphaMap, vUv ).g; // why hardcode "vUv" into the coord slot?

#endif

It can be refactored to be more in line with the need imposed by NodeMaterial.

//alphamap_fragment.glsl

#ifdef USE_ALPHAMAP

	diffuseColor.a *= texture2D( alphaMap, alphaUV ).g;

#endif

To be preceded by:

//alphamap_mapping_fragment.glsl

#ifdef USE_ALPHAMAP
    vec2 alphaUV = vUv;
#endif

This would break up and decouple a chunk that is overloaded to begin with IMO, which would then validate the comparison with NodeMaterial.

Would it make sense to document these differences before the new API becomes default?
Would it also make sense to refactor the existing structure, given that #7522 is still not in /src while the templates are? Ie. is there a reason to keep the templates as is, other than this PR from 2015?

Why keep the current template convoluted?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants