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.
HLSL geometry shader not visible in emulator and device recorded video?
Hi all,
I’m a bit confused with regards to geometry shaders. After a shattered relation with Unity 3D about HoloLens development I’ve started experimenting with creating my own holographic application framework. As ingredients I took SharpDX, Artemis (an Entity Component Systems framework), some of the good aspects found in Unity 3D (like the hierarchy) and T4/XML powered templates (to provide some sort of rapid UI creation skeleton).
Everything has been going quite smoothly and nice except of my endeavors into HLSL. Being new to this I was pretty proud when I got the first triangles, cubes and later on textured meshes shown on the emulator. However, all of the experiments with drawing thick (2D/3D) lines using a geometry shader shattered at each attempt.
Somehow nothing showed up whilst all other shaders (textured, colored) worked as expected.
My confusion got even greater when I today had the change to run the whole on a HoloLens device. All of a sudden lines (and later on triangles) were shown when I ran my test application on the device instead of the emulator.
Next to that a video capture of the whole also did not record the visuals created by the shader pipeline in which the geometry shader was included.
So to summarize I have:
- A UWP HoloLens application based on the corresponding Visual Studio template.
- SharpDX 3.0.2 through NuGet.
- Geometry shader is based on the code on the page below but with changes to cope with the instance ID (SV_RenderTargetArrayIndex etc.):
http://www.gamedev.net/topic/609031-hlsl-line-geometry-shader/
And:
- On the emulator: No visuals for the geometry shader based lines. Everything else is fine.
- On the device: something that looked like lines. Everything else is looking superB
- When recording video on the device: Again no visuals. Everything else is fine.
To make a long story short: are there any quirks or known issues with regards to how (geometry) shaders do their magic?
Many thanks in advance,
Peter Vrenken
Best Answer
-
Options
Hi Peter,
AFAIK - no quirks to geometry shaders. They are used to create new primitives for the final pipeline phase and color Shader.
If possible can you show your logic where your shaders are being included. The default C++ /DirectX template utilizes logic that checks to see if the Instanced Drawing and renderTargetArray is supported. Keep in mind instanced drawing and render arrays are not supported in the Emulator, and thus the geometry shader is used to fill out the shader array for drawing the stereo instances.
I suspect that your logic isn't quite right, possibly related to not drawing on the correct instance. I think the emulator only uses 1 instance and drawing on the wrong one won't show render anything. However without seeing your directX code it's just a guess.
Dwight Goins
CAO & Founder| Independent Architect | Trainer and Consultant | Sr. Enterprise Architect
MVP | MCT | MCSD | MCPD | SharePoint TS | MS Virtual TS |Windows 8 App Store Developer | Linux Gentoo Geek | Raspberry Pi Owner | Micro .Net Developer | Kinect For Windows Device Developer
http://dgoins.wordpress.com5
Answers
Hi Peter,
AFAIK - no quirks to geometry shaders. They are used to create new primitives for the final pipeline phase and color Shader.
If possible can you show your logic where your shaders are being included. The default C++ /DirectX template utilizes logic that checks to see if the Instanced Drawing and renderTargetArray is supported. Keep in mind instanced drawing and render arrays are not supported in the Emulator, and thus the geometry shader is used to fill out the shader array for drawing the stereo instances.
I suspect that your logic isn't quite right, possibly related to not drawing on the correct instance. I think the emulator only uses 1 instance and drawing on the wrong one won't show render anything. However without seeing your directX code it's just a guess.
Dwight Goins
CAO & Founder| Independent Architect | Trainer and Consultant | Sr. Enterprise Architect
MVP | MCT | MCSD | MCPD | SharePoint TS | MS Virtual TS |Windows 8 App Store Developer | Linux Gentoo Geek | Raspberry Pi Owner | Micro .Net Developer | Kinect For Windows Device Developer
http://dgoins.wordpress.com
Hi Dwight,
thanks for the input!
it was definitely an issue with the logic on my side. To be precise with how the vertex and geometry shaders were configured and the instance ID's propagated.
But next to that we have jumped off the SharpDX bandwagon and onto the Urho one. In my humble opinion it provides more of the basic plumbing like a Entity Component Systems based approach, primitive/text/geometry rendering and a huge amount of out-of-the-box working shaders.
Greetings from the Netherlands,
Peter Vrenken