TroisCanvas

The TroisCanvas component wraps your Trois app:

<TroisCanvas>
    <!-- your Trois code here -->
</TroisCanvas>

You can pass several configuration props to a TroisCanvas:

NameTypeDefaultNotes
antialiasBooleantrueWhether or not to enable antialiasing on the renderer.
backgroundString, Number''Background color of the Trois app. Default black.
cameraanynullMain camera for the scene. Uses a PerspectiveCamera by default. See Custom camera example.
cameraPositionArraynullCamera starting position. Vector3 with components [x, y, z]. See Camera starting position example
cameraPropertiesObject{}Options to set on starting camera.
environmentStringnullEnvironment map to use. Automatically creates and adds the resource at the given path if specified. See example.
rendereranynullRenderer to use. Creates a WebGLRenderer if none specified.
rendererOptionsObject{ antialias: true }Parameter to pass to renderer on instantiation function. Ignored if renderer is set.
rendererPropertiesObject{}Properties to set on the renderer once it's been instantiated. Applies on custom and default renderers.

Camera starting position example

<TroisCanvas :camera-position="[0, 0, 10]">
    <!-- ... -->
</TroisCanvas>

Custom camera example

<TroisCanvas :camera="'$attached.camera'">
    <OrthographicCamera attach="camera" :args="[...]"/>
</TroisCanvas>

Environment map example

<TroisCanvas :environment="'/your/env-map.hdr'">
    <!-- ... -->
</TroisCanvas>