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.
Spatial Mapping Flash/Scanning Effect
Hi,
I am wondering how to achieve similar spatial mapping effect like Hololens default one. I mean the one that displays flash effectfrom the nearby to faraway. It is really wonderful to illustrate the spatial mapping result.
Best Answer
-
thebanjomatic ✭✭✭
The (kind of) short answer is that you need to write a custom shader along with a script to drive and animate some of the shader parameters. At the simplest, you need a couple values:
1. Source position - in world coordinates
2. Effect radius - in meters (how far away the scan is from the source position
3. (optional) Effect strength - to fade in and outWhen you initiate the tap, you can set the source position shader parameter to be wherever in the scene the gaze raycast hits, and also initialize the effect radius to 0. And then once per frame (update function, etc) you would increase the effect radius and maybe attenuate the effect strength somehow to fade things in and out smoothly.
In terms of the actual shader, what you need to do is identify how far each pixel is from the source position. This can be done efficiently on a per-vertex level, by converting each vertex from object-space into world space, and then finding the distance from the source position shader parameter. This distance can then be used to modulate the color in the fragment shader.
6
Answers
The (kind of) short answer is that you need to write a custom shader along with a script to drive and animate some of the shader parameters. At the simplest, you need a couple values:
1. Source position - in world coordinates
2. Effect radius - in meters (how far away the scan is from the source position
3. (optional) Effect strength - to fade in and out
When you initiate the tap, you can set the source position shader parameter to be wherever in the scene the gaze raycast hits, and also initialize the effect radius to 0. And then once per frame (update function, etc) you would increase the effect radius and maybe attenuate the effect strength somehow to fade things in and out smoothly.
In terms of the actual shader, what you need to do is identify how far each pixel is from the source position. This can be done efficiently on a per-vertex level, by converting each vertex from object-space into world space, and then finding the distance from the source position shader parameter. This distance can then be used to modulate the color in the fragment shader.
I am also interested in that. Have you found a solution?