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
* Fix expired API and paths
* Fix mogwai option flags
* Fix typos and add description for reflect()
* Fix unfollowing codes to coding conventions
* Fix heading level of reflect() description
* Fix incorrect description of object
replace 'array' with 'dictionary' and fix typo of 'perframeCB'.
Copy file name to clipboardExpand all lines: docs/tutorials/01-mogwai-usage.md
+4-1Lines changed: 4 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,6 +24,7 @@ Run Mogwai from within Visual Studio (by pressing Ctrl+F5), or from the command
24
24
25
25
-h, --help Display this help menu.
26
26
-s[path], --script=[path] Python script file to run.
27
+
--deferred The script is loaded deferred.
27
28
-S[path], --scene=[path] Scene file (for example, a .pyscene
28
29
file) to open.
29
30
-l[path], --logfile=[path] File to write log into.
@@ -42,6 +43,8 @@ Run Mogwai from within Visual Studio (by pressing Ctrl+F5), or from the command
42
43
-d, --debug-shaders Generate shader debug info.
43
44
--enable-debug-layer Enable debug layer (enabled by default
44
45
in Debug build).
46
+
--precise Force all slang programs to run in
47
+
precise mode
45
48
```
46
49
47
50
Using `--silent` together with `--script` allows to run Mogwai for rendering in the background.
@@ -53,7 +56,7 @@ If you start it without specifying any options, Mogwai starts with a blank scree
53
56
With Mogwai up and running, we'll proceed to loading something. You can load two kinds of files: scripts (which usually contain some global settings and render graphs) and scenes.
54
57
55
58
### Loading a Script (.py)
56
-
Open the load script dialog by either going to `File -> Load Script` or hitting `Ctrl + O`. Navigate to the location of the script you wish to run and select it to load and run it. Alternatively, dragging-and-dropping a script into Mogwai will also work. Note that scripts intended for use with Mogwai must be written in Python. Full scripting documentation can be found [here](../Usage/Scripting.md).
59
+
Open the load script dialog by either going to `File -> Load Script` or hitting `Ctrl + O`. Navigate to the location of the script you wish to run and select it to load and run it. Alternatively, dragging-and-dropping a script into Mogwai will also work. Note that scripts intended for use with Mogwai must be written in Python. Full scripting documentation can be found [here](../usage/scripting.md).
57
60
58
61
Here, we'll load the Forward Renderer, located at `Source/Mogwai/Data/ForwardRenderer.py`.
Copy file name to clipboardExpand all lines: docs/tutorials/02-implementing-a-render-pass.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -82,4 +82,4 @@ You can adjust the description of the render pass library by adjusting the follo
82
82
const RenderPass::Info ExampleBlitPass::kInfo { "ExampleBlitPass", "Blits a texture into another texture." };
83
83
```
84
84
85
-
We will ignore further details regarding render passes and their implementation for the purposes of this tutorial. Additional information can be found [here](../Usage/Render-Passes.md).
85
+
We will ignore further details regarding render passes and their implementation for the purposes of this tutorial. Additional information can be found [here](../usage/render-passes.md).
Copy file name to clipboardExpand all lines: docs/tutorials/04-writing-shaders.md
+53-15Lines changed: 53 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@
4
4
5
5
# Writing Shaders
6
6
7
-
Now that we've written a basic render pass and render graph, let's look at writing more complex passes that use shaders. Falcor uses the Slang shading language and compiler, and files should use one of the following extensions: `.slang`, `.slangh`, `.hlsl`, `.hlsli`. For more information on best practices for working with shaders in Falcor, please refer to the *Using Shaders and Data Files* section of the [Getting Started](../Getting-Started.md) page.
7
+
Now that we've written a basic render pass and render graph, let's look at writing more complex passes that use shaders. Falcor uses the Slang shading language and compiler, and files should use one of the following extensions: `.slang`, `.slangh`, `.hlsl`, `.hlsli`. For more information on best practices for working with shaders in Falcor, please refer to the *Using Shaders and Data Files* section of the [Getting Started](../getting-started.md) page.
8
8
9
9
For this tutorial, we'll create a pass that renders a scene as a wireframe of a particular color.
10
10
@@ -53,10 +53,10 @@ While `create()` does not need to do more than calling the constructor and retur
Our first render pass had no need for a `Scene` object; however, this pass does and will need this function to set `mpScene`. We first need to set `mpScene` to the scene that's passed in then add all scene defines to `mpProgram`. We then create our `GraphicsVars` so that we can bind shader variables later in `execute()`. These are done like so:
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:
106
+
#### Binding the shader
107
+
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 a dictionary. Our shader requires a single color value, `gColor`, which is located inside the `PerFrameCB` constant buffer. This step should look like this:
With our scene, shader, and both the `GraphicsState` and `RasterizerState` set up, we can finally render our scene at the end of `execute()`. This is done through the `render()` method of `mpScene`, like so:
Using the Render Graph Editor, create a graph solely containing this pass then launch it in Mogwai. You should see a black screen as there is no scene currently loaded. Load a scene by going to `File -> Load Scene`, and you should now see the wireframe for the scene you selected. We used `media/Arcade/Arcade.pyscene`, which looks like this:
134
+
And you need to create CMakeLists.txt to include your C++ and Slang files in the build target.
Using the Render Graph Editor, create a graph solely containing this pass then launch it in Mogwai, or create a python script.
150
+
```python
151
+
from falcor import*
152
+
153
+
defrender_graph_WireframePass():
154
+
g = RenderGraph('WireframePass')
155
+
loadRenderPassLibrary('WireframePass.dll')
156
+
Wireframe = createPass('WireframePass')
157
+
g.addPass(WireframePass, 'WireframePass')
158
+
g.markOutput('WireframePass.output')
159
+
return g
160
+
161
+
WireframePass = render_graph_WireframePass()
162
+
try: m.addGraph(WireframePass)
163
+
exceptNameError: None
164
+
```
165
+
166
+
You should see a green screen as there is no scene currently loaded. Load a scene by going to `File -> Load Scene`, and you should now see the wireframe for the scene you selected. We used `media/Arcade/Arcade.pyscene`, which looks like this:
0 commit comments