Apertus
  • Documentation
  • Introduction
    • Definitions
      • Coordinate systems
      • Primitives
    • Features
      • Basic
        • Nodes
        • Light sources
        • Geometries
        • Primitives
        • Texts
      • Environment simulation
        • Water
        • Sky
        • Terrain
      • Browser
      • UI technologies
        • HTML UI
        • Presentation
        • Gallery
      • PointCloud
      • 360
        • 360 Images
        • 360 Videos
      • 3D Model Formats
      • Scene Sharing
        • Multiplayer
      • Video and Voice Chat
      • Hand Tarcking
        • Leap Motion
      • Head Tracking
        • Fob
      • Displays
        • Multi Display
        • Cave System
        • HMDs
      • Industry
        • IoT, and Sensors
        • Robot monitoring
        • Robot calibration
  • Developers
    • Development Cycle
    • Architecture
      • Project folders
      • Configuration ecosystem
    • API
      • C++ API
      • JavaScript API
      • HTTP REST API
    • Getting Started
      • Creating a plugin
      • Creating a sample
  • Contribute
    • Report a Bug
    • Suggest a Feature
  • Tutorial - How to visualize CAD models in VR
    • Introduction
    • Import CAD Models
    • Convert CAD Models
    • Create Low-poly from CAD Models
    • Create Photorealistic CAD Models
  • Plugins - Photorealistic Render
  • Plugins - Physics
  • Tutorial - How to visualize Tensorflow training in VR
  • Tutorial - Virtual Learning Factory Toolkit Gamification
  • Overview
    • Introduction
    • Architecture
    • Use Cases
  • Installation
    • Windows
    • Android
      • How to use
      • Writing an application
    • MacOS
  • Build
    • Windows
      • How to build the source on Windows
    • Android
    • MacOS
  • Plugins on Windows
    • Photorealistic Render
      • How to use
      • How to configure
      • Features
      • Sample
    • Physics
      • How to use
      • How to configure
      • Features
      • Samples
      • Demo video
  • Plugins on Android
    • Java Native Interface
      • How to use
      • Extending the API
    • Filament render
      • How to use
      • How to configure
      • Developers
  • Plugins on MacOS
    • Untitled
  • Samples on Windows
    • Deep learning
      • Untitled
      • Use the Fastai-PythorchVR Sample
      • Use the HTTP API
      • Create HTTP Requests from Python
      • Demo video
    • Virtual Learning Factory Toolkit Gamification
      • Installation
      • Lobby - User Interface
      • Local - User Interface
      • Student - User Interface
      • Teacher - User Interface
      • VLFT Gamification Session
      • VR Mode
  • Virtual Learning Factory Application
    • Installation on Windows
    • Installation on Apple
    • Lobby
    • Single Player
    • Multi Player - Student
    • Multi Player - Teacher
Powered by GitBook
On this page
  1. Samples on Windows
  2. Deep learning

Use the Fastai-PythorchVR Sample

In this section we are going to go throughhow to use, set the sample for your needs. What parameters you can change, to get a better visualization. How to add/change texts. How to load the images.

PreviousUntitledNextUse the HTTP API

Last updated 5 years ago

You can find the file we need here : ...\ApertusVR\plugins\jsAPI\nodeJsPlugin\js\api\index.js In this file there is a function called app.post('/setfastai', function (req, res, next). This function handles all that we need.

First of all we will need the outermost else. In this section we get the image file names, and we create planes for them, and two coordiante axes.

  1. First we need a parentnode, we will call it 'xBox' (we are going to be using box objext for the x and y axes)

  2. We set the position of the parentnode, now to -20, 0, 10 = x,y,z

  3. Then we create the box with the name 'xAxis', we set it's dimension to 0.2, 200, 0.2 (it goes from bottom to top)

  4. Then we set it's parentnode to the one we created

  5. We color it with Manualmaterial, that we can create similalry, it's name will be 'xmat', and it will be red (1,0,0 RGB), after we creaated it we can add it to the box.

  6. Next we create Text so we can see what the axis represents, we will need a parentnode for that too(we create it the same way as before).

  7. createText() needs a string parameter, that will be it's name, and by default it will be the text displayed by it. You can change it with the setCaption() function.

  8. After this we have an x axis, you can create a y and/or a z axis likewise, but you must give them different names.

After the axis creation there is a for cycle that loads the images. This function '/setfastai' will be called with the data in req.body. The function need an 'IDs' field in the data, that contains the file names. or the file paths.

As you can see we start of by creating a parentnode again. After the we create a manualMaterial and a fileTexture. The createFileTexture function must be called with the file name. Unlike for the axis, now we don't give an RGB color but the fileTexture to the manualMaterial. After all of this is ready, the only thing left is to create the plane that will conain the image. It need 3 parameters, but we only need to care about size. You can set the other 2 to (1,1). We set the planes parentnode, and it's material.

Now we are ready, all the images are loaded, and displayed. The only problem is that they are in the same space. The outermost if takes care of moving the images to their appropriate positions.

In the branch first we check if all data that that we need is provided. Namely x, y, z positions.

If everything is there, we move on to go through all that positions, and put the planes(with the images) their corresponding place. The position data must be in the same order as the image paths/file names.

The first 3 lines are the most important. The coordinates are calculated outside of Apertus. As I mentioned above x, y, z positions will be sent from the model. So it is up to you how you calculate them. In this example we use a very basic calculation, because of this the images can have almost identical positions. For better visual we multiply the values, so we can see structures, and groups bettter. You can change these values to whatever you like. After that we just simple set the parentnodes' positions to the right spot. We set them by name in the same order we got the filenames.

If you don't use full paths just file names, then you need to place your files in this directory ...\ApertusVR\macros\sceneMaker\resources