Git Product home page Git Product logo

stereokit-painttutorial's Introduction

StereoKit Tutorial - Finger Painting

This is an introductory tutorial for StereoKit, aimed at introducing people to the basics of how to draw and interact with Mixed Reality content! It just so happens that finger painting is a relatively straightforward thing to code, and is pretty fun at the same time.

You'll find out how to create a core application loop, radial hand menus, easy window menus with automatic layout, object-based menus with more explicit layouts, and file pickers. You'll also see how easy it is to draw models, lines, and interact directly with your fingers!

While I could have gone wild on adding features, this project is intended as a readable, easy to understand learning resource! It's an example of how to do things, and a good starting point for those that might be interested in creating a similar feature for themselves. It's not meant to be an exhaustive or fully featured product.

Pre-requisites

This project uses:

This project uses StereoKit to render and drive this as a Mixed Reality application, which allows us to run on HoloLens 2 and VR headsets! That's all that's in here besides the tutorial code :)

Project Layout

Since this is a pretty simple tutorial, there's not a lot of files here! But there are some things to make note of. This solution uses a 2 project setup: one is .Net Core, and one is UWP. Different projects support different features and targets, and I often switch between them based on what I'm working on.

  • .Net Core Project
    • WMR VR Desktop
    • Flatscreen Desktop
    • Leap Motion articulated hands
    • No compile time
  • UWP Project
    • HoloLens 2 + articulated hands
    • WMR VR Desktop
    • Flatscreen Desktop
    • Controller simulated hands
    • Some compile time

The project consists of only 3 code files, and a few art assets! The code aims to be very readable, and is also rich with comments to explain less intuitive items.

  • Program.cs
    • This contains the application logic, the hand menu, and the application menu! It's a great place to start, since the application menu ties everything together.
  • PaletteMenu.cs
    • This is an object menu that controls painting options, it's designed to represent a real-world object: the painting palette. It's composed of a couple touchable 3D models for color that are placed in very specific locations, and a more traditional UI slider that controls stroke size.
  • Painting.cs
    • This class encapsulates the idea of the finger painting itself! It manages hand input, and converts it into 3D lines. It also is responsible for saving and loading painting files. You can find use of StereoKit's Hierarchy system here as well.

Questions or problems?

If you've got questions about how this works, or how to get it running, let me know over in the Issues tab! Alternatively, you can find me online over on Twitter - @koujaku, feel free to send me a note there too!

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.