Giter Club home page Giter Club logo

stereokit-painttutorial's Introduction

This is a demo application, and 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 "inking" 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 3 project setup: one for .NET Core, one for Android, and one for UWP. Different projects deploy to different targets, I'll often use .NET for rapid development, then switch to Android or UWP for on-device testing.

You can switch between projects by right clicking on the project in the Solution Explorer, and selecting Set as Startup Project.

  • StereoKitInk - .NET Core
    • XR on Desktop (Quest + Link, SteamVR, WMR, etc.)
    • Simulator for development
    • No compile time
  • StereoKitInk_Android - Android
    • Android standalone headsets (Quest, Vive, Pico, etc.)
    • Low compile time
  • StereoKitInk_UWP - UWP
    • HoloLens 2
    • Slow 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 a menu that controls painting options. It's mostly composed of a built-in UI elements, but also illustrates how to use StereoKit's layout and interaction tools to create your own.
  • 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!

stereokit-painttutorial's People

Contributors

maluoi avatar reneschulte avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

stereokit-painttutorial's Issues

Draw on a 3D surface

Hi Nick,

I am trying to add some features to the StereoKit Paint App. One of the features I struggle to implement is drawing on a 3D surface. Rather than drawing on arbitrary space, I want to confine the drawing to only a 3D model surface (e.g. drawing on a cube surface only).

But I am kinda clueless about how to confine my drawing only on a 3D model surface. If you have any ideas that would be really helpful.

Thanks

Load and Save crashes the app on HL

I'm exploring your StereoKit. Love your intermediate mode approach here. Reminds me of good ol' OpenGL times.

Just tried the sample on an HL2 and got a crash when tapping Save or Load.

Can the Painting be exported as a 3d model(.stl, .obj)

Hello Nick!
I have tried looking at the code of this resource project, and learning so many things with this project, I have a particular doubt, Can I export the drawing as .stl or .obj file?
As a beginner I am just trying to figure out things in this project,
While saving the file the the SavePainting() function of program.cs is called which then further calls the ToFileData() function of Painting.cs is called which then further calls LinePointToString() function which is particularly defined to store each line point with a particular string in a defined format, and that file gets saved basically with that series of strings, While loading the saved file with the LoadPainting() this encoded strings are decoded in accordingly in the painting.cs and then further assigned to the painting.cs object and then the painting is again formed or loaded, correct me if I am wrong.

I am making a stereokit project related to this in which I can basically if possible export the drawings in a 3d model or 2D image of the drawing, is it possible
Thanks!

Exception thrown at 0x00007FFCF16BDFA1 (StereoKitC.dll) in StereoKitInk.exe

I wonder if anyone has had this and how can I troubleshoot?

[SK diagnostic] Initializing StereoKit v0.3.4-preview1...
[SK diagnostic] sk_gpu: Using Direct3D 11: NVIDIA GeForce GTX 870M
[SK diagnostic] Starting mixed reality mode
[SK diagnostic] available: XR_KHR_D3D12_enable
[SK diagnostic] available: XR_KHR_composition_layer_color_scale_bias
[SK diagnostic] available: XR_MSFT_perception_anchor_interop
[SK diagnostic] available: XR_EXT_win32_appcontainer_compatible
[SK diagnostic] available: XR_EXT_conformance_automation
[SK diagnostic] available: XR_MSFT_composition_layer_reprojection
[SK diagnostic] available: XR_MSFT_spatial_anchor_persistence
[SK diagnostic] available: XR_MSFT_controller_model
[SK diagnostic] available: XR_KHR_visibility_mask
[SK diagnostic] available: XR_EXT_samsung_odyssey_controller
[SK diagnostic] available: XR_EXT_debug_utils
[SK diagnostic] REQUESTED: XR_KHR_win32_convert_performance_counter_time
[SK diagnostic] REQUESTED: XR_KHR_D3D11_enable
[SK diagnostic] REQUESTED: XR_KHR_composition_layer_depth
[SK diagnostic] REQUESTED: XR_MSFT_unbounded_reference_space
[SK diagnostic] REQUESTED: XR_MSFT_spatial_anchor
[SK diagnostic] REQUESTED: XR_MSFT_spatial_graph_bridge
[SK diagnostic] REQUESTED: XR_EXT_eye_gaze_interaction
[SK diagnostic] REQUESTED: XR_MSFT_hand_interaction
[SK diagnostic] REQUESTED: XR_EXT_hand_tracking
[SK diagnostic] REQUESTED: XR_MSFT_hand_tracking_mesh
[SK diagnostic] REQUESTED: XR_EXT_hp_mixed_reality_controller
[SK info] Couldn't find our desired MR form factor, no MR device attached/ready? [XR_ERROR_FORM_FACTOR_UNAVAILABLE]
[SK info] MixedReality display mode failed, falling back to Flatscreen
[SK diagnostic] Starting flatscreen mode
[SK diagnostic] Created swapchain: 1280x720 color:rgba32_linear depth:depth32
[SK diagnostic] Initialized Platform
[SK info] Using audio backend: ISAC
[SK diagnostic] Initialized Audio

Exception thrown at 0x00007FFCF16BDFA1 (StereoKitC.dll) in StereoKitInk.exe: 0xC0000005: Access violation reading location 0x0000000000000000.

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.