You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Docs/Tutorials/04-Writing-Shaders.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -77,7 +77,7 @@ This function will need to perform several operations: create and bind an FBO fo
77
77
We can create and bind an FBO for our renderer to render to by first calling `Fbo::create()` on our output texture, clearing it to remove any data from previous executions (preventing it from leaving permanent trails if you try to move the camera), and calling `GraphicsState::setFbo()` to bind it. This step looks like this:
78
78
```c++
79
79
auto pTargetFbo = Fbo::create({ renderData["output"]->asTexture() });
We need to perform two operations here: indicate that we want to use a custom `RasterizerState` and bind all necessary values to our shader. We can indicate that we're using a custom `RasterizerState` by creating a `Scene::Renderflags` object and setting the flag `Scene::RenderFlags::UserRasterizerState`. Binding shader values is also fairly straightforward as Falcor allows you to set shader values in the `GraphicsVars` object in the same way as you would set values in an array. Our shader requires a single color value, `gColor`, which is located inside the `perFrameCB` constant buffer. This step should look like this:
Using the Render Graph Editor, create a graph solely containing this pass then launch it in Mogwai. Don't worry about needing to load a scene; Mogwai will load the Arcade scene by default. You should see something similar to this:
Model loading functions also provide an optional parameter for creating multiple instances of a model from file. The following example loads a model from file and creates two instances at positions [-5, 0, 0] and [5, 0, 0].
### [Index](../index.md) | [Usage](./index.md) | Scene Formats
2
+
3
+
--------
4
+
5
+
# Scene Formats
6
+
7
+
Falcor uses [Assimp](https://github.com/assimp/assimp) as its core asset loader and can load all file formats Assimp supports by default.
8
+
9
+
From assets, Falcor will import:
10
+
- Scene Graph
11
+
- Meshes
12
+
- Materials
13
+
- Diffuse Texture
14
+
- Metal-Rough Shading Model (Default)
15
+
- RGB: Base Color
16
+
- Spec-Gloss Shading Model (Default for OBJ only)
17
+
- RGB: Diffuse Color
18
+
- Specular Parameters Texture
19
+
- Metal-Rough Shading Model (Default)
20
+
- R: Occlusion
21
+
- G: Roughness
22
+
- B: Metallic
23
+
- Spec-Gloss Shading Model (Default for OBJ only)
24
+
- RGB: Specular Color
25
+
- A: Glossiness
26
+
- Normals Texture
27
+
- Occlusion Texture (Used for Spec-Gloss shading model only)
28
+
- Emissive Color/Texture
29
+
- The first camera
30
+
- Point lights
31
+
- Directional lights
32
+
- Keyframe animations
33
+
- Skinned animations
34
+
35
+
36
+
## Python Scene Files
37
+
38
+
You can also leverage Falcor's scripting system to set values in the scene on load that are not supported by standard file formats. These are also written in Python, but are formatted differently than normal Falcor scripts.
39
+
40
+
### Usage
41
+
42
+
The first line must be a Python comment containing only a path to the base asset to be loaded. File paths in Python scene files may be relative to the file itself, in addition to standard Falcor data directories.
43
+
44
+
```python
45
+
# BistroInterior.fbx
46
+
```
47
+
48
+
The asset will be loaded and will be bound to an object called `scene`. Through this object, you have access to any script bindings accessible through Scenes. See the [scripting documentation](./Scripting) for a full list of functions and properties.
49
+
50
+
Example:
51
+
52
+
```python
53
+
# BistroInterior.fbx
54
+
# Line above loads BistroInterior.fbx from the same folder as the script
55
+
56
+
scene.setEnvMap("BistroInterior.hdr") # Set the environment map to "BistroInterior.hdr" located in the same folder as the script
57
+
58
+
bottle_wine = scene.getMaterial("TransparentGlassWine") # Get a material from the scene by name
0 commit comments