Proposed: Material Shader Graphic Shirt with Sharp Edges
The Context
In the vibrant and ever-evolving realm of virtual reality, personal expression is paramount. Users crave the ability to showcase their unique style and personality through their avatars. One powerful avenue for this self-expression is through avatar apparel customization. In this scenario, we’re exploring the creation of a virtual shirt adorned with two distinct patterns. These patterns are applied using SVG files that are converted into a signed distance field mask, ensuring the edges remain crisp and sharp.
The Problem Statement
At present, there’s no straightforward method to design a shirt featuring two different patterns using SVG files in MaterialX, while also maintaining sharp pattern edges. This proposal seeks to address and resolve this issue.
Describe how your proposal will work with code, pseudo-code, mock-ups, or diagrams
We can harness the power of MaterialX’s shader graph system to craft a custom shader for our shirt. Here’s a rudimentary sketch of how it might be structured:
# Import MaterialX library
import MaterialX as mx
# Create a new document
= mx.createDocument()
doc
# Create a new shader graph
= doc.addNode('shadergraph', 'myShaderGraph', 'surfaceshader')
shaderGraph
# Add two image nodes for our SVG patterns
= shaderGraph.addInput('pattern1', 'filename')
pattern1 = shaderGraph.addInput('pattern2', 'filename')
pattern2
# Convert SVGs to signed distance fields for sharp edges
= convertSVGToSDF(pattern1)
sdfPattern1 = convertSVGToSDF(pattern2)
sdfPattern2
# Add a mix node to blend the two patterns together
= shaderGraph.addNode('mix', 'mix', 'color3')
mix 'fg', sdfPattern1)
mix.setInputValue('bg', sdfPattern2)
mix.setInputValue(
# Connect the mix node to the shader graph output
shaderGraph.setOutputValue(mix)
Please note, this is a simplified example and may require adjustments based on your project’s specific needs.
The Benefits
Implementing this feature will empower users with additional options for avatar customization. This could potentially boost user engagement and satisfaction. Moreover, by utilizing signed distance fields, we can guarantee sharp pattern edges, enhancing the visual appeal of the shirt.
The Downsides
The primary drawback is that this feature could potentially amplify the complexity of the codebase. It may also necessitate additional resources for implementation and ongoing maintenance.
The Road Not Taken
An alternative approach might involve using a different library or tool that already supports this feature. However, this could potentially introduce other challenges such as compatibility issues or increased project complexity.
The Infrequent Use Case
This feature might not see frequent use if the majority of users favor simpler designs for their avatars’ clothing. Nonetheless, it could still prove beneficial for those desiring more advanced customization options.
In Core and Done by Us
This feature will be developed by the V-Sekai development team and will form an integral part of our project’s core functionality.
Status
Status: Proposed
Decision Makers
- V-Sekai development team
Further Reading
- V-Sekai · GitHub - Official GitHub account for the V-Sekai development community focusing on social VR functionality for the Godot Engine
- V-Sekai/v-sekai-game - GitHub page for the V-Sekai open-source project bringing social VR/VRSNS/metaverse components to the Godot Engine
AI assistant Aria assisted with this article.