-
Notifications
You must be signed in to change notification settings - Fork 111
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
BREAKING: WebGPU support (MToonNodeMaterial) #1384
Conversation
- The type parameter of `THREE.Object3D` is no longer required (used to be `THREE.Object3D<THREE.Event>` - `THREE.UniformsUtils.merge` now has more appropriate typing which breaks the existing code, workarounded with `as any`
Starting from r155, the light unit is set to physically based one by default. We need to multiply the directional light intensity by PI because of this change. See: mrdoob/three.js#26392
also removed an impossible compat code path
Built the MToon shader using NodeMaterial feature I had to add `three/examples/jsm/nodes/Nodes.js` to rollup's `external` config. Is the solution legit? We have a problem on the current `@types/three`, I had to patch-package. Some of them are already addressed as PR on `three-ts-types` repo I applied temporary changes to several example html files, this should be reverted before merge
…ead of local space
`parameters` have `depthWrite = false` when it's transparent, we have to overwrite this
It seems model normal was multiplied by 100 in UniGLTF 1.27, 1.28. Low confidence
also emit a warning if the model contains vertex colors
The outline was too bright when the outlineLightingMix is zero
This prevents opaque / cutout materials to go white
…utlineWidthTexture
…LightingMix factor is 1 it should be multiplied by (1.0 / PI)
outline didn't respect alpha when outlineLightingMixFactor is not 1
outlineWidthMode is not required when it's not outline pass also add comma
…cheKey it's included in cacheKey in either way. See: https://github.com/mrdoob/three.js/blob/r160/examples/jsm/renderers/common/RenderObject.js#L115
We should have the parametric rim result to a temporary variable
WebGPURenderer creates shader variants for each skeleton uuid so we want to unify skeletons as much as possible If there is a superset skeleton, reuse it
This reverts commit 33fc057. boneInverse might be different between skeletons and the new method does not work well with such cases.
The `Type of property 'cache' circularly references itself in mapped type` still persists The error disappears once I bump TypeScript to v5.1.3 or above
revert several examples back to WebGL `three/examples/jsm/*` now referred by `three/addons/*`; see `tsconfig.json` and `rollup.config.js` `RotateUV` doesn't work properly with UV Animation Mask Texture on r162. Spin using a handmade rotation matrix instead
tested using VRMC_materials_mtoon_UV_Animation_Test.vrm
This is an option to decrease initial rendering time when the model has many materials
If you want to use three-vrm on WebGPU, use `MToonNodeMaterialLoaderPlugin` by specifying the loader in the option of `VRMLoaderPlugin`. See the `webgpu-dnd.html` example for details BREAKING: MToonMaterialLoaderPlugin might put materials other than MToonMaterial (namely, MToonNodeMaterial in this case) to `gltf.userData.vrmMToonMaterials`. This shouldn't affect many users since the interface of MToonNodeMaterial is almost identical to MToonMaterial
The spec says that the animation should not accelerate over time when we apply uv scroll and rotation over time See: https://github.com/vrm-c/vrm-specification/tree/master/specification/VRMC_materials_mtoon-1.0#transform-order The GLSL code is also wrong, we have to fix this later
日本語で恐縮ですが、NodeMaterialを継承したマテリアルのコードを読む上で、NodeMaterialの動作の流れ(r164現在のもの)を以下のページにまとめてあります。レビューの際にご活用ください。 |
packages/three-vrm-materials-mtoon/src/nodes/MToonNodeMaterialLoaderPlugin.ts
Show resolved
Hide resolved
Perhaps MToonMaterial was wrong? three-vrm/packages/three-vrm-materials-mtoon/src/MToonMaterial.ts Lines 607 to 614 in 8a89449
|
It seems to be, yes! The blue ball in the example should have bumps on the surface since the normal map is assigned. |
If possible, please incorporate this change. |
packages/three-vrm-materials-mtoon/src/nodes/MToonNodeMaterial.ts
Outdated
Show resolved
Hide resolved
Resolved conflict with |
yes I have to indeed |
equivalent of 25cc2ba See: #1384 (comment)
…ToonNodeMaterial on Three.js r160 or before
… opaque" part It's more appropriate to put in `setupOutput` rather than `setupDiffuseColor` Use the same condition as the `OPAQUE` flag in WebGLRenderer shaders See: #1384 (comment)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
This PR supports WebGPURenderer by adding
MToonNodeMaterial
, which is a NodeMaterial port ofMToonMaterial
.After the change is published, you can use three-vrm on WebGPU by using
MToonNodeMaterialLoaderPlugin
.To use the loader, specify the loader in the option of
VRMLoaderPlugin
.See the
webgpu-dnd.html
example for details.BREAKING
gltf.userData.vrmMToonMaterials
might have materials other thanMToonMaterial
(namely,MToonNodeMaterial
in this case).MToonNodeMaterial
is almost identical toMToonMaterial
.TODOs
three-vrm-material-mtoon
importsthree/addons/nodes/Nodes.js
, the initial module loading time became longer when you are using certain CDNs like unpkg. We are currently seeking for a workaround.@types/three
are patched bypatch-package
three-ts-types
side before we ship thisType of property 'cache' circularly references itself ...
error (TS2615) occurstslFn
related typings three-types/three-ts-types#744 (comment)