three.js icon indicating copy to clipboard operation
three.js copied to clipboard

Core: Move Phong shader chunks out of BSDFs

Open WestLangley opened this issue 2 years ago • 4 comments

...continuing a pattern started previously.

bsdfs.js is now vacuous, and has been removed.

WestLangley avatar May 26 '23 23:05 WestLangley

📦 Bundle size

Full ESM build, minified and gzipped.

Filesize dev Filesize PR Diff
642.7 kB (159.1 kB) 642.6 kB (159 kB) -92 B

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Filesize dev Filesize PR Diff
432.9 kB (104.8 kB) 432.8 kB (104.8 kB) -92 B

github-actions[bot] avatar May 26 '23 23:05 github-actions[bot]

Perhaps renaming bsdfs to other name could avoid code duplication of MMDToonShader.js and lights_phong_pars_fragment.glsl.js?

sunag avatar May 29 '23 08:05 sunag

Because I don't like the idea of moving the Blinn-Phong BRDF out of a Blinn-Phong-specific file in core to accommodate an example program that is modifying shader chunks via onBeforeCompile().

WestLangley avatar May 29 '23 15:05 WestLangley

If a user wants to use onBeforeCompile() to hack the shader code, the user must copy the shader chunk and edit it.

I do not support moving part of the Blinn-Phong-specific code out of the Phong pars file in Core so the user has fewer lines to copy.

WestLangley avatar Jun 06 '23 18:06 WestLangley