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