Hello, is there a shader that will make a glass object look good on Android and iOS?
Hello Tomislav,
For creating a glass shader that looks good on Android and iOS, you can consider using a shader that supports transmission and volume features to achieve realistic glass effects. According to the information available, the KHR_materials_transmission
extension allows rendering of glass-like materials in a way that is compatible with mobile devices (see the documentation).
In Needle Engine, you would likely use a PBR (Physically Based Rendering) shader that supports these features. You could work with the UnityGLTF framework to utilize the UnityGLTF/PBRGraph
material for export, which supports modern material extensions such as transmission and rough refraction (see the documentation).
Ensure your shader also considers being lightweight to maintain performance across various mobile devices. This is crucial due to the computational limitations typical of mobile platforms.
To implement this:
- Set up the necessary shader parameters to control transmission and roughness.
- Test on both Android and iOS devices to ensure performance and appearance.
- Export the shader using UnityGLTF to maintain compatibility (see the documentation).
If you need a starting point, the sample codes and shader development kits can be found in the Needle Engine samples repository.
I hope this helps! Feel free to explore more advanced settings or libraries like glTF and Three.js for optimization and additional features. For more guidance, you can check the Needle Engine documentation and samples.
24 replies left
thread_qVmgd35VLo3WGc5exQn3GU7f
Reply to this message to continue the conversation
The AI assistant is almost right here. Glass materials are explained in the UnityGLTF docs, but for completeness I’m gonna post it here as well.
- Create a new material
- Switch the shader to UnityGLTF/PBRGraph
- Enable transmission (which is what makes glass look like glass in contrast to opacity)
- Set transmission to 1, roughness to 0, metalness to 0
- If you want to be able to preview the glass material in Unity, add this renderer feature (in URP):
or this script in BiRP:
Optionally you can also turn on volume, thickness, and/or dispersion to make more realistic glass. These additional features are not supported in QuickLook at the moment, but regular full-glass materials are supported there as well.
Thanks