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/guides/AdvancedTopics/ModularShaderDive.md
+4-4Lines changed: 4 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -5,16 +5,16 @@ title: Modular Shader Generator Deep Dive
5
5
6
6
# Modular Shader Generator Deep Dive
7
7
8
-
The modular shader generator is fairly simple to use, you just call the [GenerateShader](xref:VRLabs.ModularShaderSystem.ShaderGenerator.GenerateShader) method, pass in the destination folder path, the modular shader, and you're done.
8
+
The modular shader generator is fairly simple to use, you just call the [GenerateShader](xref:VRLabs.ModularShaderSystem.ShaderGenerator.GenerateShader(System.String,VRLabs.ModularShaderSystem.ModularShader,System.Boolean)) method, pass in the destination folder path, the modular shader, and you're done.
9
9
10
10
But it may be useful to know what happens underneath and talk about the generation steps.
11
11
12
-
First of all, the [GenerateShader](xref:VRLabs.ModularShaderSystem.ShaderGenerator.GenerateShader) is a wrapper that sets up one or more [ShaderContext](xref:VRLabs.ModularShaderSystem.ShaderGenerator.ShaderContext) objects, and these objects are what actually generate the shader.
12
+
First of all, the [GenerateShader](xref:VRLabs.ModularShaderSystem.ShaderGenerator.GenerateShader(System.String,VRLabs.ModularShaderSystem.ModularShader,System.Boolean)) is a wrapper that sets up one or more [ShaderContext](xref:VRLabs.ModularShaderSystem.ShaderGenerator.ShaderContext) objects, and these objects are what actually generate the shader.
13
13
This separation is done so that the generator is unified in all use cases, for example in the library it's used for both generating the shader and generating optimised shaders.
14
14
15
15
## GenerateShader method
16
16
17
-
In the case of the [GenerateShader](xref:VRLabs.ModularShaderSystem.ShaderGenerator.GenerateShader) method, it first retrieves and reloads all the used template assets,
17
+
In the case of the [GenerateShader](xref:VRLabs.ModularShaderSystem.ShaderGenerator.GenerateShader(System.String,VRLabs.ModularShaderSystem.ModularShader,System.Boolean)) method, it first retrieves and reloads all the used template assets,
18
18
then it evaluates all the possible variants combinations the modular shader has (as a reminder, variants are those templates that to be able to have the module toggled on and off, need to have the code actually removed, ending up with multiple shader files),
19
19
after that it generates the PropertyBlock string, which contains all properties declared in all modules (if you have the shader setup to use templates for properties, only the ones in the dedicated template in the modular shader asset is included here, the rest will be handled later with the other templates).
20
20
@@ -34,7 +34,7 @@ To finish it off, we load all the newly generated shaders and add a reference to
34
34
35
35
## The ShaderContext
36
36
37
-
As we previously said, a [ShaderContext](xref:VRLabs.ModularShaderSystem.ShaderGenerator.ShaderContext) takes care of generating a single shader file using the informations it has been given by calling its [GenerateShader](xref:VRLabs.ModularShaderSystem.ShaderGenerator.ShaderContext.GenerateShader) method.
37
+
As we previously said, a [ShaderContext](xref:VRLabs.ModularShaderSystem.ShaderGenerator.ShaderContext) takes care of generating a single shader file using the informations it has been given by calling its [GenerateShader](xref:VRLabs.ModularShaderSystem.ShaderGenerator.GenerateShader(System.String,VRLabs.ModularShaderSystem.ModularShader,System.Boolean)) method.
38
38
39
39
First it generates the name for both the file and the shader path in the material's shader selector, after that it generates the property section of the shader by using the provided property block or by generating its own if it's empty (in this case it makes the assumption that it's doing it for optimised shaders and does not include module's Enable properties).
0 commit comments