The Mixed Reality Forums here are no longer being used or maintained.
There are a few other places we would like to direct you to for support, both from Microsoft and from the community.
The first way we want to connect with you is our mixed reality developer program, which you can sign up for at https://aka.ms/IWantMR.
For technical questions, please use Stack Overflow, and tag your questions using either hololens or windows-mixed-reality.
If you want to join in discussions, please do so in the HoloDevelopers Slack, which you can join by going to https://aka.ms/holodevelopers, or in our Microsoft Tech Communities forums at https://techcommunity.microsoft.com/t5/mixed-reality/ct-p/MicrosoftMixedReality.
And always feel free to hit us up on Twitter @MxdRealityDev.
Transparency Shader
Howdy all. I tried searching the forum, but didn't see anything directly relating to this question. I'm also pretty new to shaders.
I'm trying to have a few transparent objects in my application, meaning I want to see obscured 3D models behind them. I've tried using the "Transparent/Diffuse" shader. It works in the Unity previewer, but as most of you probably already know, the HoloLens renders these materials pink.
I'm guessing instead of true transparency, there's gonna have to be something that makes the material color mix with black when not obscuring an object, and then using subtractive calculations when it is.
Is there already a shader out there for this kinda thing? Or will I have to roll my sleeves up and write my own?
Thanks in advance!
Best Answer
-
OptionsAlexD ✭✭✭
Take a look a the HoloToolkit Shaders. If you're not using HoloTooklit yet, you should definitely try it out. It's Open Source, available on GitHub and all you need to do is drag it to your Assets for a lot of great resources that will help you with your HoloLens project.
There are a number of transparent configurable shader options there, under the "HoloToolkit" namespace
5
Answers
Take a look a the HoloToolkit Shaders. If you're not using HoloTooklit yet, you should definitely try it out. It's Open Source, available on GitHub and all you need to do is drag it to your Assets for a lot of great resources that will help you with your HoloLens project.
There are a number of transparent configurable shader options there, under the "HoloToolkit" namespace
Toronto-HoloLens | Blog | @alexdrenea
Huh so I am using the HoloToolkit, and it looks like I didn't dive deep enough into the Assets directory. I've been setting the shaders programmatically so I've just been guessing at shader names. Thank you very much for the head's up! (Great name by the way.)
One last question, what's the practical difference between Blinn Phong, Lambert, and Vertex-Lit? I'm planning on just using primitive objects, so it looks like Vertex-Lit is the way to go for speed. But I'm just curious.
First, setting transparency is super easy in Unity. You just select (or create) your material, leave the shader at standard, and use the popdown to change Rendering mode from Opaque to transparent.
Next, the different shading algorithms like Phong and Lambert give the object a different look, its not so much about speed. Phong makes things look like shiny plastic, Lambert is more muted and good for natural looking objects. Normally these choices are made while making a model in a 3d modelling program like Blender rather than in the program.