Skip to content

Commit cb2ee8f

Browse files
Site changes [skip-ci]
1 parent 2bd7950 commit cb2ee8f

File tree

2 files changed

+26
-14
lines changed

2 files changed

+26
-14
lines changed

extension-rive/index.md

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ brief: This manual describes how to show Rive animations using the Rive extensio
1313

1414

1515
## Requirements
16-
In order to use Rive animations you need to run Defold 1.2.188 or higher.
17-
16+
In order to use Rive content, you will need to run Defold 1.9.5 or higher.
1817

1918
## Installation
2019
Rive animation support in Defold is provided through an official Rive extension. To use Rive animations in a Defold project, add the following URL to the list of `game.project` dependencies:
@@ -23,18 +22,38 @@ Rive animation support in Defold is provided through an official Rive extension.
2322

2423
We recommend using a link to a zip file of a [specific release](https://github.com/defold/extension-rive/releases).
2524

25+
## Windows
26+
To use Rive on Windows, you need to make sure OpenGL 4.2 or later is used in the engine. To do this, set the `OpenGL version hint` to either 4.2 or `Use highest available`:
27+
28+
![Window setup](rive-windows-setup.png)
29+
30+
## Rendering
2631

27-
## Render script setup
28-
Rive components are rendered using a method called "Stencil, then cover" (StC). This requires Rive components to render with the stencil buffer enabled in the render script:
32+
The Rive extension is using a native renderer from the [Rive runtime]()https://github.com/rive-app/rive-runtime itself by issuing raw graphics API calls behind the scenes.
33+
The low-level renderer doesn't rasterize rive paths using regular triangles - instead a complex series of draw commands are issued that will produce smooth vector graphics.
34+
With this in mind, there are a few caveats for how the renderer works together with the regular Defold rendering.
35+
36+
### Projection matrix
37+
The Rive API does not have an exposed projection matrix that can be set, which means that in order to match the Rive coordinate space, a fullscreen projection is used in the render script:
2938

3039
```
31-
render.enable_state(render.STATE_STENCIL_TEST)
40+
render.set_projection(vmath.matrix4_orthographic(0, render.get_window_width(), 0, render.get_window_height(), -1, 1))
41+
render.set_viewport(0, 0, render.get_window_width(), render.get_window_height())
3242
render.draw(self.rive_pred)
33-
render.disable_state(render.STATE_STENCIL_TEST)
3443
```
3544

36-
For convenience, there is a modified render script included with this extension. Open your *game.project* file and modify the `Render` field in the `Bootstrap` section to use the `defold-rive/lua/rive.render` file from this extension.
45+
This means that you can put Defold and Rive content in the same coordinate space if you want to mix and match regular Defold content with Rive.
46+
47+
For convenience, there is a modified render script included with the projection matrix extension. Open your *game.project* file and modify the `Render` field in the `Bootstrap` section to use the `defold-rive/lua/rive.render` file from this extension.
48+
49+
### View matrix
3750

51+
View matrices are supported, but only in 2D space since Rive content is essentially orthographic by design.
52+
For example, using the view matrix from a camera component can be used to implement camera effects, such as screen shakes or as a regular game camera in 2D.
53+
54+
### Blending
55+
56+
Blending is currently only supported from within the .riv files themselves. Changing the blend mode on the component or the render script will have no effect.
3857

3958
## Concepts
4059
*Rive data file*
@@ -76,9 +95,6 @@ Apart from the properties *Id*, *Position* and *Rotation* the following componen
7695
*Rive Scene*
7796
: Set this to the Rive scene file to use for this model.
7897

79-
*Blend Mode*
80-
: If you want a blend mode other than the default `Alpha`, change this property.
81-
8298
*Material*
8399
: If you need to render the model with a custom material, change this property.
84100

@@ -89,10 +105,6 @@ Apart from the properties *Id*, *Position* and *Rotation* the following componen
89105
: Set this to the animation you want the model to start with.
90106

91107

92-
### Blend modes
93-
{% include shared/en/blend-modes.md %}
94-
95-
96108
## Runtime manipulation
97109
*Rive Model* components can be manipulated at runtime through a number of different functions and properties (refer to the [API docs for usage](/extension-rive/rive_api/)).
98110

extension-rive/rive-windows-setup.png

297 KB
Loading

0 commit comments

Comments
 (0)