Scenes

The puzzles from this category perform various operations with scenes and rendering.

Contents

Puzzles Reference

load scene + percentage

When this puzzle is triggered, the current scene is unloaded and a new scene is loaded from a specified .gltf file.

After loading is finished, the puzzles in the "when loaded do" slot are triggered. Also, there is an optional "on progress do" slot. Puzzles placed in this slot are continuously triggered during the loading and can utilize the "percentage" puzzle. Once the scene is loaded it's assigned a name which can be used to access and manipulate the scene via various object-related puzzles. By default the assigned name equals to the specified scene URL (e.g. 'path/to/scene.gltf'). The "alias" option if enabled allows to set the name manually.

Another optional "on error do" slot triggers in case of load errors (such as missing glTF file).

append scene + percentage

When this puzzle is triggered, a new scene is loaded from a specified .gltf file and appended to the current scene.

After loading is finished, the puzzles in the "when loaded do" slot are triggered. Also there can be enabled the "on progress do" slot. Puzzles placed in this slot are continuously triggered during the loading and can utilize the "percentage" puzzle. The "append scene" puzzle doesn't load cameras and lights from a new scene by default. This behavior can be changed in the puzzle's options.

Once the scene is appended it's assigned a name which can be used to access and manipulate the scene via various object-related puzzles. By default the assigned name equals to the specified scene URL (e.g. 'path/to/scene.gltf'). The "alias" option, if enabled, allows to set the name manually.

Another optional "on error do" slot triggers in case of load errors (such as missing glTF file).

unload scene

Unloads the specified scene or its part from the application. Use the empty text value in order to unload all scenes.

enable rendering

Resumes previously disabled rendering.

disable rendering

Disables rendering. The graphics won't be updated but the user events will be captured and animation timelines will progress.

You can use disable rendering for the purpose of saving batteries on mobile devices or laptops, and getting rid of cooler noise on desktops. You can also enable the anti-alias option to significantly increase the rendering quality and compensate the loss of performance. This option targets the next frame after the rendering stops.

create environment

Create a new image-based lighting and assign a background to the scene. This puzzle also creates a new material with the name specified as the first parameter and adds it to the scene. You can use this material to replace textures or colors of the environment.

The second parameter can be ether:

batch geometry

Merge geometry of a specified group of meshes to improve rendering performance. Upon execution, the puzzle collects meshes with similar properties, such as material in use, shadow settings, rendering order, etc, then creates and appends a new batch to the scene. Objects that can't be merged together are left intact.

To observe how batching works, just open the browser console:

In each "Adding batch object..." line you can see the name of the created batch object. This name consists of the name of the material forming the batch, the 'x' factor representing the number of meshes merged together and the "_batch" postfix.

For example:

Adding batch object: big_table_wood_x6_batch

line says that 6 meshes with the "big_table_wood" material were merged to a new batch object "big_table_wood_x6_batch".

Since the batch parts become "fixed" together, make sure you don't batch objects which you plan to move around, animate, or change individually from the batch.

export to gltf

Export your scene, model or a group of models to the glTF 2.0 format. Specify the only visible option to export only visible objects while the binary option is used to export to GLB (glTF Binary) format.

For best results, as well as for creating standard glTF files (without Soft8Soft/Verge3D extensions) that can be viewed by third-party glTF viewers (such as Microsoft Windows 10’s default glTF viewer), we recommend you to use glTF-compatible materials. See how to create them in Blender, 3ds Max, or Maya.

export to usdz

Export your scene or model to the Universal Scene Description (USDZ) format.

By using this puzzle, you can preview your scene on Apple devices in the AR mode. To do that, create the <a> HTML element on your app page and assign the link to the exported USDZ asset as its href parameter. See Augmented Reality demo as an example.

For best results, we recommend you to use glTF-compatible materials. See how to create them in Blender, 3ds Max, or Maya.

raycast

Cast a ray from the source point (or object) in the given direction and return a list of all intersections (if any). The third parameter of the puzzle is used to reduce a set of the intersected objects. Leave none or specify the name of your scene to intersect all objects located in the loaded scene.

The returned list contains a sequence of dictionaries with the following information:

The list of intersections is sorted by distance, closest first.

add fog

Add the fog effect to the scene. Use zeros either for RGB or for density to disable the added fog.

Having Troubles with Puzzles?

Seek help on the forums!