HoloLens x Graphics 入門
Transcript of HoloLens x Graphics 入門
HoloLens x Graphics
HoloLens Graphics Tokyo HoloLens Meetup vol.2 - 2017/03/15hecomi
HoloLens https://github.com/hecomi/HoloLensPlayground
hecomi
@hecomihttp://tips.hecomi.com
HoloLens
HoloLens VR
Unlit/Color (0, 0, 0, 1) Holograms 101HoloLens
// a = ( (1 - a)) + a( +
https://developer.microsoft.com/ja-jp/windows/holographic/case_study_-_looking_through_holes_in_your_reality
Shader "HoloLens/Occlusion"{SubShader{Pass{ ColorMask 0 ZWrite On
CGPROGRAM #pragma vertex vert #pragma fragment frag ENDCG}}}
ColorMask 0
HoloToolkit-Unity Occlusion =
http://tips.hecomi.com/entry/2017/02/18/190949
OROR
Stencil { Ref [_Mask] Comp Equal}Stencil { Ref [_Mask] Comp NotEqual}Stencil { Ref [_Mask] Comp Always Pass Replace}
OK
HoloToolkit-Unity
HoloLens 5.0
struct v2f{ float3 worldPos : TEXCOORD0; ...};
v2f vert(appdata_base v){ ... o.worldPos = mul(unity_ObjectToWorld, v.vertex); ...}inline float toIntensity(float3 pos){ return frac(length(pos) - _Time.y);}
fixed4 frag(v2f i) : SV_Target{ float3 worldIndex = floor(i.worldPos.xyz * _TilesPerMeter); float3 boxelCenter = worldIndex / _TilesPerMeter; float intensity = toIntensity(boxelCenter); return _Color * intensity;}
Physics.Raycastr = speed * timecenter
https://developer.microsoft.com/en-us/windows/holographic/Hologram_stability.html HoloLens 0.85 m
https://developer.microsoft.com/en-us/windows/holographic/Hologram_stability.html
HoloLens 0.85 m
Fragments
float4 worldPos = mul(unity_ObjectToWorld, v.vertex);float3 dist = length(_WorldSpaceCameraPos - worldPos);fixed darkness = clamp((_Start - dist) / (_Start - _End), 0.0, 1.0);o.color *= darkness;
[maxvertexcount(3)]void geom(triangle appdata_t input[3], inout TriangleStream stream){ for (int i = 0; i < 3; ++i) { ... float4 worldPos = mul(unity_ObjectToWorld, v.vertex); float3 dist = length(_WorldSpaceCameraPos - worldPos); fixed destruction = clamp((_Start - dist) / (_Start - _End), 0.0, 1.0); ... v.vertex.xyz = (v.vertex.xyz - center) * (1.0 - destruction * _Scale) + center; v.vertex.xyz = rotate(v.vertex.xyz - center, random * destruction * _Rotation) + center; v.vertex.xyz += v.normal.xyz * destruction * _Position * random; o.vertex = UnityObjectToClipPos(v.vertex); ... stream.Append(o); } stream.RestartStrip();}
HoloLens https://github.com/hecomi/HoloLensPlayground