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  hwTransparency(false),
84  hwSpecularEnvironmentMethod(SPECULAR_ENVIRONMENT_FIS),
85  hwDirectionalAlbedoMethod(DIRECTIONAL_ALBEDO_ANALYTIC),
86  hwTransmissionRenderMethod(TRANSMISSION_REFRACTION),
87  hwWriteDepthMoments(false),
88  hwShadowMap(false),
89  hwAmbientOcclusion(false),
90  hwMaxActiveLightSources(3),
91  hwNormalizeUdimTexCoords(false),
92  hwWriteAlbedoTable(false),
93  hwWriteEnvPrefilter(false),
94  hwImplicitBitangents(true),
95  emitColorTransforms(true)
96  {
97  }
98  virtual ~GenOptions() { }
99 
100  // TODO: Add options for:
101  // - shader gen optimization level
102  // - graph flattening or not
103 
104  /// Sets the type of shader interface to be generated
106 
107  /// If true the y-component of texture coordinates used for sampling
108  /// file textures will be flipped before sampling. This can be used if
109  /// file textures need to be flipped vertically to match the target's
110  /// texture space convention. By default this option is false.
112 
113  /// An optional override for the target color space.
114  /// Shader fragments will be generated to transform
115  /// input values and textures into this color space.
117 
118  /// Define the target distance unit.
119  /// Shader fragments will be generated to transform
120  /// input distance values to the given unit.
122 
123  /// Sets whether to include upstream dependencies
124  /// for the element to generate a shader for.
126 
127  /// The standard library prefix, which will be applied to
128  /// calls to emitLibraryInclude during code generation.
129  /// Defaults to "libraries".
131 
132  /// Sets if transparency is needed or not for HW shaders.
133  /// If a surface shader has potential of being transparent
134  /// this must be set to true, otherwise no transparency
135  /// code fragments will be generated for the shader and
136  /// the surface will be fully opaque.
138 
139  /// Sets the method to use for specular environment lighting
140  /// for HW shader targets.
142 
143  /// Sets the method to use for directional albedo evaluation
144  /// for HW shader targets.
146 
147  /// Sets the method to use for transmission rendering
148  /// for HW shader targets.
150 
151  /// Enables the writing of depth moments for HW shader targets.
152  /// Defaults to false.
154 
155  /// Enables shadow mapping for HW shader targets.
156  /// Defaults to false.
158 
159  /// Enables ambient occlusion rendering for HW shader targets.
160  /// Defaults to false.
162 
163  /// Sets the maximum number of light sources that can
164  /// be active at once.
166 
167  /// Sets whether to transform texture coordinates to normalize
168  /// uv space when UDIMs images are bound to an image. Can be
169  /// enabled for when texture atlas generation is performed to
170  /// compress a set of UDIMs into a single normalized image for
171  /// hardware rendering.
173 
174  /// Enables the writing of a directional albedo table.
175  /// Defaults to false.
177 
178  /// Enables the generation of a prefiltered environment map.
179  /// Defaults to false.
181 
182  /// Calculate fallback bitangents from existing normals and tangents
183  /// inside the bitangent node.
185 
186  /// Enable emitting colorspace transform code if a color management
187  /// system is defined. Defaults to true.
189 };
190 
192 
193 #endif
ShaderInterfaceType
Type of shader interface to be generated.
Definition: GenOptions.h:19
HwDirectionalAlbedoMethod hwDirectionalAlbedoMethod
Definition: GenOptions.h:145
Definition: File.h:26
#define MATERIALX_NAMESPACE_BEGIN
Definition: Generated.h:25
bool fileTextureVerticalFlip
Definition: GenOptions.h:111
bool emitColorTransforms
Definition: GenOptions.h:188
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:105
bool hwWriteDepthMoments
Definition: GenOptions.h:153
virtual ~GenOptions()
Definition: GenOptions.h:98
#define MX_GENSHADER_API
Definition: Export.h:18
unsigned int hwMaxActiveLightSources
Definition: GenOptions.h:165
string targetColorSpaceOverride
Definition: GenOptions.h:116
Use an analytic approximation for directional albedo.
Definition: GenOptions.h:54
bool hwNormalizeUdimTexCoords
Definition: GenOptions.h:172
Use a refraction approximation for transmission rendering.
Definition: GenOptions.h:67
HwSpecularEnvironmentMethod hwSpecularEnvironmentMethod
Definition: GenOptions.h:141
bool hwTransparency
Definition: GenOptions.h:137
bool hwWriteAlbedoTable
Definition: GenOptions.h:176
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:180
bool hwImplicitBitangents
Definition: GenOptions.h:184
bool addUpstreamDependencies
Definition: GenOptions.h:125
bool hwAmbientOcclusion
Definition: GenOptions.h:161
HwTransmissionRenderMethod hwTransmissionRenderMethod
Definition: GenOptions.h:149
Use a table look-up for directional albedo.
Definition: GenOptions.h:57
FilePath libraryPrefix
Definition: GenOptions.h:130
bool hwShadowMap
Definition: GenOptions.h:157
#define MATERIALX_NAMESPACE_END
Definition: Generated.h:26
Do not use specular environment maps.
Definition: GenOptions.h:39
string targetDistanceUnit
Definition: GenOptions.h:121