Skip to content

Instantly share code, notes, and snippets.

View demonixis's full-sized avatar

Yannick Comte demonixis

View GitHub Profile

How to setup OpenXR

Basic Setup

  1. Start menu > Run
  2. Type regedit
  3. Locate HKEY_LOCAL_MACHINE\SOFTWARE\Khronos\OpenXR\1
  4. On the ActiveRuntime key

Oculus

  1. Set C:\Program Files\Oculus\Support\oculus-runtime\oculus_openxr_64.json for Oculus (CV1, S, Link)
@demonixis
demonixis / UnitySystemInfo.cs
Created January 30, 2014 06:59
Retrieving system informations with Unity.
// System informations with Unity
// Doc: http://docs.unity3d.com/Documentation/ScriptReference/SystemInfo-graphicsDeviceName.html
Debug.Log ("Device model: " + SystemInfo.deviceModel);
Debug.Log ("Device name: " + SystemInfo.deviceName);
Debug.Log ("Device type: " + SystemInfo.deviceType);
Debug.Log ("Graphics device name: " + SystemInfo.graphicsDeviceName);
Debug.Log ("Graphics device vendor: " + SystemInfo.graphicsDeviceVendor);
Debug.Log ("Graphics device version: " + SystemInfo.graphicsDeviceVersion);
@demonixis
demonixis / GetScreenInch.cs
Created October 15, 2015 12:46
A static method to retrieve the screen inch of an Android device in Unity
public static int GetScreenInch()
{
#if UNITY_ANDROID
var displayMetrics = new AndroidJavaObject("android.util.DisplayMetrics");
var heightPixels = displayMetrics.Get<int>("heightPixels");
var widthPixels = displayMetrics.Get<int>("widthPixels");
var xdpi = displayMetrics.Get<float>("xdpi");
var ydpi = displayMetrics.Get<float>("ydpi");
var x = widthPixels / xdpi;
var y = heightPixels / ydpi;
@demonixis
demonixis / detect_gpu.js
Last active June 25, 2020 22:44
Gets the user's GPU name using the `WEBGL_debug_renderer_info` WebGL extension. It returns a `string` with the graphics card name or `unknow` if the extension is not supported.
function getGraphicsCardName() {
var canvas = document.createElement("canvas");
var gl = canvas.getContext("experimental-webgl") || canvas.getContext("webgl");
if (!gl) {
return "Unknow";
}
var ext = gl.getExtension("WEBGL_debug_renderer_info");
if (!ext) {
@demonixis
demonixis / osvr_server_config.HDK13DirectModeLandscape+Kinect.sample.json
Last active May 26, 2020 20:11
Configuration file for the OSVR server using the HDK in Direct Mode, the Kinect V2 sensor and the Fusion Plugin. It's a bit experimental for now, the x and z axis are reversed with Kinect.
{
"description": "This configuration supports video (so-called 'positional') and IMU fusion tracking, in addition to orientation-only tracking, with the OSVR HDK. It is configured for RenderManager applications in direct mode (portrait) on HDK 1.3 optics.",
"display": "displays/OSVR_HDK_1_3.json",
"renderManagerConfig": "sample-configs/renderManager.direct.landscape.json",
"drivers": [{
"plugin": "com_osvr_VideoBasedHMDTracker",
"driver": "VideoBasedHMDTracker",
"params": {
"showDebug": false,
"includeRearPanel": true,
@demonixis
demonixis / PostProcessUWPShim.cs
Last active November 29, 2018 17:27
This WIP shim allows you to build the PostProcess Stack V2 for Unity with the Universal Windows Platform target. But before you have to add a little change in the `PostProcessEffectSettings.cs`. Please read the first comment.
#if !UNITY_EDITOR && UNITY_WSA
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
/*
You've to edit the file PostProcessEffectSettings.cs (~ line 27) and add a preprocessor instruction
@demonixis
demonixis / SlideLeftRightView.m
Last active February 27, 2018 19:08
A function to slide left or right an UIView with iOS.
// Change the position of the view on click with an animation
// _hidden is a private variable which is initalized to NO in the constructor.
- (void)onClickAction:(UIButton *)button
{
// First we must calculate the new position relative to the current position.
CGRect rect = CGRectMake(self.frame.origin.x, self.frame.origin.y, self.frame.size.width, self.frame.size.height);
if (_hidden)
rect.origin.x = rect.origin.x - 200;
else
@demonixis
demonixis / RudderVirtualDevice.cs
Created February 21, 2018 15:03
An input driver for InControl using the 3DRudder controller.
using InControl;
using ns3DRudder;
using Unity3DRudder;
using UnityEngine;
namespace Demonixis.MarsExtraction.Inputs
{
public class RudderVirtualDevice : InputDevice
{
private Axis m_Axis;
@demonixis
demonixis / BrowserVendor.js
Created May 16, 2014 08:42
Get the browser vendor with WebGL
// Chrome & Opera: WebKit
// Firefox & SeaMonkey: Mozilla
// IE11: Microsoft
// Other: Deprected Browser
function getVendor() {
var canvas = document.createElement("canvas");
var gl = canvas.getContext("webgl") || canvas.getContext("experimental-webgl");
return gl ? gl.getParameter(gl.VENDOR) : "Deprected Browser";
}
@demonixis
demonixis / OsvrDistortion.cs
Last active January 3, 2018 20:16
A distortion correction effect for Unity.
using UnityEngine;
namespace OSVR.Unity
{
[ExecuteInEditMode]
[RequireComponent(typeof(Camera))]
public sealed class OsvrDistortion : MonoBehaviour
{
private bool isSupported = true;
private Material distortionMaterial = null;