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

feat: improve vrm mtoon #1507

Merged
merged 92 commits into from
Dec 28, 2024
Merged

feat: improve vrm mtoon #1507

merged 92 commits into from
Dec 28, 2024

Conversation

emadurandal
Copy link
Collaborator

No description provided.

Yuki Shimada added 28 commits December 28, 2024 03:01
…l calculations

- Added view vector calculations to improve lighting and shading accuracy based on camera position.
- Introduced normalization of the world normal input, enhancing the shader's capability for realistic surface interactions.
- Updated fragment shader logic to incorporate new view and normal calculations, improving overall visual fidelity.
- Introduced normal texture sampling and transformation logic, improving normal mapping capabilities.
- Updated normal calculations to incorporate TBN matrix transformations, enhancing surface interaction realism.
- Enhanced shader flexibility by adding parameters for normal texture rotation and texcoord indexing.
- Simplified alpha testing implementation in both WebGL and WebGPU fragment shaders by adjusting the formatting of conditional directives.
- Ensured consistent handling of alpha cutoff logic across shader files, improving code readability and maintainability.
- No functional changes were made; the focus was on code clarity and organization.
…l for enhanced shader flexibility

- Introduced new uniform variables for shading shift, shading toony factor, and emissive properties, improving the shader's capabilities for various visual effects.
- Added parameters for normal texture scaling and UV animation, enhancing texture mapping flexibility.
- Updated the shader to support additional environmental and outline color factors, allowing for more complex material configurations and rendering options.
…de multiply support

- Added new parameters for shading shift and shade multiply textures, improving the shader's flexibility for visual effects.
- Implemented logic for sampling and applying shading shift and shade multiply textures in the fragment shader.
- Enhanced overall shading capabilities by introducing additional texture handling, allowing for more complex material configurations.
…nd direct lighting calculations

- Introduced a new linearstep function to improve shading transitions within the shader.
- Implemented direct lighting calculations, incorporating shading shift factors and toony adjustments for enhanced visual effects.
- Updated shading logic to utilize the new linearstep function, improving overall shading accuracy and flexibility.
…ions and lighting logic

- Removed redundant color assignment in MToon1SingleShader.frag.glsl to streamline the shading process.
- Initialized the rt0 variable in MToon1SingleShader.frag.wgsl to ensure proper color accumulation during lighting calculations.
- Enhanced direct lighting logic by incorporating color mixing based on shading, improving overall visual fidelity.
…ngleShader.frag.wgsl

- Introduced new texture bindings for matcap, rim multiply, emissive, and UV animation, enhancing the shader's visual capabilities.
- Added corresponding samplers for each new texture, allowing for more complex material configurations.
- Updated shader parameters to include options for rim lighting and UV animation, improving flexibility in visual effects.
…ader.frag.wgsl

- Implemented UV animation parameters including scrolling and rotation speed factors, enhancing dynamic texture capabilities.
- Introduced emissive texture sampling and calculations, allowing for more vibrant material effects.
- Updated shader logic to incorporate new UV and emissive features, improving overall visual fidelity and flexibility.
…ader.frag.wgsl

- Implemented direct lighting logic to enhance the shader's lighting capabilities, including color accumulation based on light sources.
- Added indirect lighting calculations with global illumination factors, improving the overall realism of material rendering.
- Updated shader comments with references to the VRM specification for better documentation and understanding of the implementation.
…g.wgsl

- Implemented rim lighting calculations to enhance the shader's visual effects, utilizing matcap textures and parametric factors for improved realism.
- Added emissive color support, allowing for dynamic lighting effects in materials.
- Updated shader logic to incorporate new rim lighting features, improving overall material rendering capabilities.
…wgsl

- Introduced outline color and lighting mix factors to enhance the shader's visual effects with outline rendering capabilities.
- Added functionality for sRGB output conversion, allowing for improved color accuracy in rendered materials.
- Updated shader logic to incorporate new outline features and sRGB handling, enhancing overall material rendering quality.
- Consolidated UV animation function parameters by removing unnecessary materialSID argument, enhancing code clarity and maintainability.
- Updated multiple texture coordinate calculations to utilize the revised uvAnimation function, improving consistency across shader implementations.
- Reorganized uniform variable declarations for better structure and readability, ensuring a more efficient shader setup.
- Added support for HDRI parameters in MToon1MaterialContent, improving material rendering capabilities.
- Introduced MutableVector4 and MutableVector2 for managing IBL and HDRI format parameters.
- Updated the constructor to set IBL and HDRI format parameters based on mesh renderer component properties, enhancing dynamic material behavior.
- Improved code structure for better readability and maintainability in handling HDRI-related settings.
…outline rendering

- Changed the vertex variable from a let to a var to allow for modifications during outline calculations.
- Updated the outline width calculation to directly modify the vertex position, improving the accuracy of outline rendering.
- Enhanced shader logic to ensure proper handling of vertex transformations, contributing to better visual fidelity in rendered materials.
- Added a check to skip processing for bone groups with no bones, ensuring stability during the import process.
- This change prevents potential runtime errors when accessing joint root entities, improving the robustness of the importer.
…sl for outline rendering

- Updated the vertex position calculation to set the z and w components to 0.0 instead of using the original vertex.z and vertex.w values.
- This change ensures that the outline rendering behaves correctly by ignoring the offset when the normal is directed toward the camera, improving visual fidelity in the shader's output.
…nt and shader calculations

- Refactored the indirect light intensity property in MToon0xMaterialContent to improve clarity and consistency in shader semantics.
- Updated the fragment shader to correctly apply lighting calculations, enhancing the overall lighting effects in the material rendering.
- Improved code readability by restructuring the indirect light intensity handling, ensuring better maintainability and understanding of the shader logic.
… parameter handling

- Added support for diffuse and specular IBL cube map samplers in MToon0xMaterialContent, improving material rendering with environment lighting.
- Updated shader logic in MToon0xSingleShader to incorporate IBL parameters, enhancing indirect lighting calculations and overall visual fidelity.
- Introduced new uniforms for IBL parameters and HDRI format, allowing for dynamic adjustments based on mesh renderer properties.
- Improved shader calculations for indirect lighting, ensuring accurate contributions from environment maps and enhancing realism in material effects.
…shaders

- Modified the normal texture coordinate calculations in both fragment shaders to use the transformed normal texture UVs instead of the original texture coordinates.
- This change ensures accurate normal mapping and improves the overall visual fidelity of the shader's output by correctly applying the normal transformations based on the UV animation.
- Added a new uvAnimation function to handle UV transformations, including scrolling and rotation based on time and animation parameters.
- Updated texture coordinate calculations to utilize the new UV animation logic, enhancing the visual effects of the shader.
- Improved overall shader functionality by integrating UV animation for various texture lookups, ensuring more dynamic and visually appealing material rendering.
- Implemented UV animation handling in ModelConverter and MToon0xMaterialContent, allowing for dynamic texture transformations based on animation parameters.
- Updated VrmImporter to include uvAnimationMaskTexture property, enhancing material property management.
- Enhanced MToon0xSingleShader with new UV animation logic, improving visual effects through scrolling and rotation of UV coordinates.
- Refactored shader and material content to support new UV animation properties, ensuring better integration and performance in rendering.
- Modified the fragment shader to include a reciprocal PI factor in the lighting calculations, improving the accuracy of color output.
- Commented out indirect lighting calculations to streamline the shader logic, preparing for future enhancements or adjustments.
- Improved code readability by clarifying the purpose of indirect lighting sections, ensuring better maintainability.
…ing and lighting calculations

- Reintroduced shaderity requirements for optical and PBR definitions, enhancing shader modularity.
- Added new bindings for diffuse and specular environment textures and samplers, improving IBL support.
- Refactored indirect lighting calculations to utilize new IBL parameters, ensuring more accurate lighting contributions.
- Improved code clarity by commenting out unused parameters and restructuring lighting logic for better maintainability.
- Updated MToon0xSingleShader.frag.glsl and MToon0xSingleShader.frag.wgsl to improve UV animation logic, allowing for dynamic texture transformations based on scrolling and rotation parameters.
- Refactored texture coordinate calculations to utilize the new uvAnimation function, ensuring consistent application of UV transformations across various texture lookups.
- Improved view vector handling by normalizing the vector before passing it to the TBN matrix, enhancing normal mapping accuracy.
- Enhanced overall shader functionality and visual effects through better integration of UV animation features.
…ndling and parameter integration

- Added support for IBL parameters in MToon0xMaterialContent, allowing for dynamic adjustments based on mesh renderer properties.
- Updated fragment shaders (MToon0xSingleShader.frag.glsl and MToon1SingleShader.frag.wgsl) to incorporate new IBL calculations, enhancing indirect lighting contributions.
- Refactored shader logic to utilize new MutableVector4 and MutableVector2 for better parameter handling and clarity.
- Improved overall shader functionality and visual fidelity through enhanced integration of IBL and HDRI format handling.
…rendering and material parameter handling

- Added functionality in ModelConverter to set MToon textures and parameters for outline materials, improving material integration.
- Updated MToon1SingleShader fragment and vertex shaders to refine outline rendering logic, ensuring accurate normal transformations and outline width calculations.
- Enhanced shader output by correcting vertex position calculations and optimizing normal handling for better visual fidelity.
- Improved overall shader performance and maintainability through refactoring and clearer parameter management.
…onePhysicsStrategy

- Introduced a new configuration parameter `physicsTimeIntervalScale` in Config.ts to allow dynamic scaling of physics calculations.
- Updated the `VRMSpringBonePhysicsStrategy` to utilize the new `physicsTimeIntervalScale` for calculating stiffness and gravity forces, enhancing the flexibility and accuracy of physics simulations.
- Improved maintainability by centralizing physics time interval management within the configuration.
@emadurandal emadurandal merged commit d65cb7a into main Dec 28, 2024
4 checks passed
@emadurandal emadurandal deleted the feat/improve-vrm-mtoon branch December 28, 2024 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant