GithubHelp home page GithubHelp logo

boristype000 / unity-depth-camera-implementation Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jabrail-chumakov/unity-depth-camera-implementation

0.0 0.0 0.0 27.42 MB

Implementation of depth camera in Unity

C++ 0.19% C# 99.58% Objective-C++ 0.10% CMake 0.01% HLSL 0.08% ShaderLab 0.04%

unity-depth-camera-implementation's Introduction

Unity Depth Camera Implementation

Installation and setting up scene

  • Download and install Unity 2020+ (Note: probably it will work on other versions too)
  • Open Unity Hub and click on the New project tab. After that select 3D project, name it and set your location. Notice that the proposed depth camera will not work for HDRP and URP
  • In the Unity Editor you will see your new empty scene
  • Navigate to Project tab and create empty script there is desired folder. For example, create Scripts folder under Assets folder and create inside of it script by right clicking in empty space and then Create - C# Script. Name it depth_script. Then double click on it. Visual Studio will open
  • Inside of it paste code from depth_script.cs file
  • Now in Project tab create Material by right clicking in empty space Create - Material (name it depth_material). Besides that you need to create shader by repeating the same procedure, but choose Create - Shader - Standard Surface Shader (name it depth_shader). CLick on shader object and in Inspector window click Open
  • In opened IDE paste code from depth_shader file, save and close it
  • Then navigate to your newly created material file (depth_material one) and next to Shader option choose Custom/depth_shader. It should look like this:

  • Navigate to Hierarchy tab and create new camera object (right click and Camera) by naming it Depth Camera. You can delete Main Camera object from Hierarchy or hide Camera script from this object
  • You now need to add script to your Depth Camera object, which is called depth_script. Just click on Depth Camera game object and Add Component* from Inspector. In appeared list type depth_script and choose it
  • Drag newly created material object from Project tab next to Mat in Inspector window
  • In Depth Camera's Camera script, next to Clipping Planes set value for Near and Far as 0.1 and 20 respectively. For Depth choose -1. Your Camera script should look like this:

  • Your depth camera is ready! Just add some object to your scene and press Play button. In game mode you can move your object and observe how depth camera is works!
  • You can modify current script to save input from camera to your desired folder

unity-depth-camera-implementation's People

Contributors

jabrail-chumakov avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.