HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GenOptions.h
Go to the documentation of this file.
1 //
2 // Copyright Contributors to the MaterialX Project
3 // SPDX-License-Identifier: Apache-2.0
4 //
5 
6 #ifndef MATERIALX_GENOPTIONS_H
7 #define MATERIALX_GENOPTIONS_H
8 
9 /// @file
10 /// Shader generation options class
11 
13 
14 #include <MaterialXFormat/File.h>
15 
17 
18 /// Type of shader interface to be generated
20 {
21  /// Create a complete interface with uniforms for all
22  /// editable inputs on all nodes used by the shader.
23  /// This interface makes the shader fully editable by
24  /// value without requiring any rebuilds.
25  /// This is the default interface type.
27 
28  /// Create a reduced interface with uniforms only for
29  /// the inputs that has been declared in the shaders
30  /// nodedef interface. If values on other inputs are
31  /// changed the shader needs to be rebuilt.
33 };
34 
35 /// Method to use for specular environment lighting
37 {
38  /// Do not use specular environment maps
40 
41  /// Use Filtered Importance Sampling for
42  /// specular environment/indirect lighting.
44 
45  /// Use pre-filtered environment maps for
46  /// specular environment/indirect lighting.
48 };
49 
50 /// Method to use for directional albedo evaluation
52 {
53  /// Use an analytic approximation for directional albedo.
55 
56  /// Use a table look-up for directional albedo.
58 
59  /// Use Monte Carlo integration for directional albedo.
61 };
62 
63 /// Method to use for transmission rendering
65 {
66  /// Use a refraction approximation for transmission rendering
68 
69  /// Use opacity for transmission rendering
71 };
72 
73 /// @class GenOptions
74 /// Class holding options to configure shader generation.
76 {
77  public:
79  shaderInterfaceType(SHADER_INTERFACE_COMPLETE),
80  fileTextureVerticalFlip(false),
81  addUpstreamDependencies(true),
82  libraryPrefix("libraries"),
83  emitColorTransforms(true),
84  hwTransparency(false),
85  hwSpecularEnvironmentMethod(SPECULAR_ENVIRONMENT_FIS),
86  hwDirectionalAlbedoMethod(DIRECTIONAL_ALBEDO_ANALYTIC),
87  hwTransmissionRenderMethod(TRANSMISSION_REFRACTION),
88  hwSrgbEncodeOutput(false),
89  hwWriteDepthMoments(false),
90  hwShadowMap(false),
91  hwAmbientOcclusion(false),
92  hwMaxActiveLightSources(3),
93  hwNormalizeUdimTexCoords(false),
94  hwWriteAlbedoTable(false),
95  hwWriteEnvPrefilter(false),
96  hwImplicitBitangents(true)
97  {
98  }
99  virtual ~GenOptions() { }
100 
101  // TODO: Add options for:
102  // - shader gen optimization level
103  // - graph flattening or not
104 
105  /// Sets the type of shader interface to be generated
107 
108  /// If true the y-component of texture coordinates used for sampling
109  /// file textures will be flipped before sampling. This can be used if
110  /// file textures need to be flipped vertically to match the target's
111  /// texture space convention. By default this option is false.
113 
114  /// An optional override for the target color space.
115  /// Shader fragments will be generated to transform
116  /// input values and textures into this color space.
118 
119  /// Define the target distance unit.
120  /// Shader fragments will be generated to transform
121  /// input distance values to the given unit.
123 
124  /// Sets whether to include upstream dependencies
125  /// for the element to generate a shader for.
127 
128  /// The standard library prefix, which will be applied to
129  /// calls to emitLibraryInclude during code generation.
130  /// Defaults to "libraries".
132 
133  /// Enable emitting colorspace transform code if a color management
134  /// system is defined. Defaults to true.
136 
137  /// Sets if transparency is needed or not for HW shaders.
138  /// If a surface shader has potential of being transparent
139  /// this must be set to true, otherwise no transparency
140  /// code fragments will be generated for the shader and
141  /// the surface will be fully opaque.
143 
144  /// Sets the method to use for specular environment lighting
145  /// for HW shader targets.
147 
148  /// Sets the method to use for directional albedo evaluation
149  /// for HW shader targets.
151 
152  /// Sets the method to use for transmission rendering
153  /// for HW shader targets.
155 
156  /// Enables an sRGB encoding for the color output on HW shader targets.
157  /// Defaults to false.
159 
160  /// Enables the writing of depth moments for HW shader targets.
161  /// Defaults to false.
163 
164  /// Enables shadow mapping for HW shader targets.
165  /// Defaults to false.
167 
168  /// Enables ambient occlusion rendering for HW shader targets.
169  /// Defaults to false.
171 
172  /// Sets the maximum number of light sources that can
173  /// be active at once.
175 
176  /// Sets whether to transform texture coordinates to normalize
177  /// uv space when UDIMs images are bound to an image. Can be
178  /// enabled for when texture atlas generation is performed to
179  /// compress a set of UDIMs into a single normalized image for
180  /// hardware rendering.
182 
183  /// Enables the writing of a directional albedo table.
184  /// Defaults to false.
186 
187  /// Enables the generation of a prefiltered environment map.
188  /// Defaults to false.
190 
191  /// Calculate fallback bitangents from existing normals and tangents
192  /// inside the bitangent node.
194 };
195 
197 
198 #endif
ShaderInterfaceType
Type of shader interface to be generated.
Definition: GenOptions.h:19
HwDirectionalAlbedoMethod hwDirectionalAlbedoMethod
Definition: GenOptions.h:150
Definition: File.h:26
#define MATERIALX_NAMESPACE_BEGIN
Definition: Generated.h:25
bool fileTextureVerticalFlip
Definition: GenOptions.h:112
bool emitColorTransforms
Definition: GenOptions.h:135
HwDirectionalAlbedoMethod
Method to use for directional albedo evaluation.
Definition: GenOptions.h:51
Use opacity for transmission rendering.
Definition: GenOptions.h:70
HwTransmissionRenderMethod
Method to use for transmission rendering.
Definition: GenOptions.h:64
ShaderInterfaceType shaderInterfaceType
Sets the type of shader interface to be generated.
Definition: GenOptions.h:106
bool hwWriteDepthMoments
Definition: GenOptions.h:162
virtual ~GenOptions()
Definition: GenOptions.h:99
#define MX_GENSHADER_API
Definition: Export.h:18
unsigned int hwMaxActiveLightSources
Definition: GenOptions.h:174
string targetColorSpaceOverride
Definition: GenOptions.h:117
Use an analytic approximation for directional albedo.
Definition: GenOptions.h:54
bool hwNormalizeUdimTexCoords
Definition: GenOptions.h:181
Use a refraction approximation for transmission rendering.
Definition: GenOptions.h:67
HwSpecularEnvironmentMethod hwSpecularEnvironmentMethod
Definition: GenOptions.h:146
bool hwTransparency
Definition: GenOptions.h:142
bool hwWriteAlbedoTable
Definition: GenOptions.h:185
Use Monte Carlo integration for directional albedo.
Definition: GenOptions.h:60
HwSpecularEnvironmentMethod
Method to use for specular environment lighting.
Definition: GenOptions.h:36
bool hwWriteEnvPrefilter
Definition: GenOptions.h:189
bool hwImplicitBitangents
Definition: GenOptions.h:193
bool hwSrgbEncodeOutput
Definition: GenOptions.h:158
bool addUpstreamDependencies
Definition: GenOptions.h:126
bool hwAmbientOcclusion
Definition: GenOptions.h:170
HwTransmissionRenderMethod hwTransmissionRenderMethod
Definition: GenOptions.h:154
Use a table look-up for directional albedo.
Definition: GenOptions.h:57
FilePath libraryPrefix
Definition: GenOptions.h:131
bool hwShadowMap
Definition: GenOptions.h:166
#define MATERIALX_NAMESPACE_END
Definition: Generated.h:26
Do not use specular environment maps.
Definition: GenOptions.h:39
string targetDistanceUnit
Definition: GenOptions.h:122