![]() |
MaterialX 1.39.4
|
An implementation of TextureBaker based on GLSL shader generation. More...
#include <TextureBaker.h>
Public Member Functions | |
| TextureBakerGlsl (unsigned int width, unsigned int height, Image::BaseType baseType) | |
Public Member Functions inherited from TextureBaker< GlslRenderer, GlslShaderGenerator > | |
| void | setExtension (const string &extension) |
| Set the file extension for baked textures. | |
| const string & | getExtension () const |
| Return the file extension for baked textures. | |
| void | setColorSpace (const string &colorSpace) |
| Set the color space in which color textures are encoded. | |
| const string & | getColorSpace () const |
| Return the color space in which color textures are encoded. | |
| void | setDistanceUnit (const string &unitSpace) |
| Set the distance unit to which textures are baked. Defaults to meters. | |
| const string & | getDistanceUnit () const |
| Return the distance unit to which textures are baked. | |
| void | setAverageImages (bool enable) |
| Set whether images should be averaged to generate constants. Defaults to false. | |
| bool | getAverageImages () const |
| Return whether images should be averaged to generate constants. | |
| void | setOptimizeConstants (bool enable) |
| Set whether uniform textures should be stored as constants. Defaults to true. | |
| bool | getOptimizeConstants () const |
| Return whether uniform textures should be stored as constants. | |
| void | setOutputImagePath (const FilePath &outputImagePath) |
| Set the output location for baked texture images. | |
| const FilePath & | getOutputImagePath () |
| Get the current output location for baked texture images. | |
| void | setBakedGraphName (const string &name) |
| Set the name of the baked graph element. | |
| const string & | getBakedGraphName () const |
| Return the name of the baked graph element. | |
| void | setBakedGeomInfoName (const string &name) |
| Set the name of the baked geometry info element. | |
| const string & | getBakedGeomInfoName () const |
| Return the name of the baked geometry info element. | |
| const string & | getTextureFilenameTemplate () const |
| Get the texture filename template. | |
| void | setTextureFilenameTemplate (const string &filenameTemplate) |
| Set the texture filename template. | |
| void | setFilenameTemplateVarOverride (const string &key, const string &value) |
| Set texFilenameOverrides if template variable exists. | |
| void | setOutputStream (std::ostream *outputStream) |
| Set the output stream for reporting progress and warnings. Defaults to std::cout. | |
| std::ostream * | getOutputStream () const |
| Return the output stream for reporting progress and warnings. | |
| void | setHashImageNames (bool enable) |
| Set whether to create a short name for baked images by hashing the baked image filenames This is useful for file systems which may have a maximum limit on filename size. | |
| bool | getHashImageNames () const |
| Return whether automatic baked texture resolution is set. | |
| void | setTextureSpaceMin (const Vector2 &min) |
| Set the minimum texcoords used in texture baking. Defaults to 0, 0. | |
| Vector2 | getTextureSpaceMin () const |
| Return the minimum texcoords used in texture baking. | |
| void | setTextureSpaceMax (const Vector2 &max) |
| Set the maximum texcoords used in texture baking. Defaults to 1, 1. | |
| Vector2 | getTextureSpaceMax () const |
| Return the maximum texcoords used in texture baking. | |
| void | setupUnitSystem (DocumentPtr unitDefinitions) |
| Set up the unit definitions to be used in baking. | |
| void | bakeShaderInputs (NodePtr material, NodePtr shader, GenContext &context, const string &udim=EMPTY_STRING) |
| Bake textures for all graph inputs of the given shader. | |
| void | bakeGraphOutput (OutputPtr output, GenContext &context, const StringMap &filenameTemplateMap) |
| Bake a texture for the given graph output. | |
| void | optimizeBakedTextures (NodePtr shader) |
| Optimize baked textures before writing. | |
| DocumentPtr | bakeMaterialToDoc (DocumentPtr doc, const FileSearchPath &searchPath, const string &materialPath, const StringVec &udimSet, std::string &documentName) |
| Bake material to document in memory and write baked textures to disk. | |
| void | bakeAllMaterials (DocumentPtr doc, const FileSearchPath &searchPath, const FilePath &outputFileName) |
| Bake materials in the given document and write them to disk. | |
| void | writeDocumentPerMaterial (bool value) |
| Set whether to write a separate document per material when calling bakeAllMaterials. | |
| string | getValueStringFromColor (const Color4 &color, const string &type) |
Public Member Functions inherited from GlslRenderer | |
| ImageHandlerPtr | createImageHandler (ImageLoaderPtr imageLoader) |
| Create a texture handler for OpenGL textures. | |
| virtual | ~GlslRenderer () |
| Destructor. | |
| void | initialize (RenderContextHandle renderContextHandle=nullptr) override |
| Internal initialization of stages and OpenGL constructs required for program validation and rendering. | |
| void | createProgram (ShaderPtr shader) override |
| Create GLSL program based on an input shader. | |
| void | createProgram (const StageMap &stages) override |
| Create GLSL program based on shader stage source code. | |
| void | validateInputs () override |
| Validate inputs for the program. | |
| void | updateUniform (const string &name, ConstValuePtr value) override |
| Update the program with value of the uniform. | |
| void | setSize (unsigned int width, unsigned int height) override |
| Set the size of the rendered image. | |
| void | render () override |
| Render the current program to an offscreen buffer. | |
| void | renderTextureSpace (const Vector2 &uvMin, const Vector2 &uvMax) |
| Render the current program in texture space to an off-screen buffer. | |
| ImagePtr | captureImage (ImagePtr image=nullptr) override |
| Capture the current contents of the off-screen hardware buffer as an image. | |
| GLFramebufferPtr | getFramebuffer () const |
| Return the GL frame buffer. | |
| GlslProgramPtr | getProgram () |
| Return the GLSL program. | |
| void | drawScreenSpaceQuad (const Vector2 &uvMin=Vector2(0.0f), const Vector2 &uvMax=Vector2(1.0f)) |
| Submit geometry for a screen-space quad. | |
| void | setScreenColor (const Color3 &screenColor) |
| Set the screen background color. | |
| Color3 | getScreenColor () const |
| Return the screen background color. | |
Public Member Functions inherited from ShaderRenderer | |
| void | setCamera (CameraPtr camera) |
| Set the camera. | |
| CameraPtr | getCamera () const |
| Return the camera. | |
| void | setImageHandler (ImageHandlerPtr imageHandler) |
| Set the image handler used by this renderer for image I/O. | |
| ImageHandlerPtr | getImageHandler () const |
| Return the image handler. | |
| void | setLightHandler (LightHandlerPtr lightHandler) |
| Set the light handler used by this renderer for light bindings. | |
| LightHandlerPtr | getLightHandler () const |
| Return the light handler. | |
| void | setGeometryHandler (GeometryHandlerPtr geometryHandler) |
| Set the geometry handler. | |
| GeometryHandlerPtr | getGeometryHandler () const |
| Return the geometry handler. | |
Static Public Member Functions | |
| static TextureBakerPtr | create (unsigned int width=1024, unsigned int height=1024, Image::BaseType baseType=Image::BaseType::UINT8) |
Static Public Member Functions inherited from GlslRenderer | |
| static GlslRendererPtr | create (unsigned int width=512, unsigned int height=512, Image::BaseType baseType=Image::BaseType::UINT8) |
| Create a GLSL renderer instance. | |
Additional Inherited Members | |
Public Types inherited from ShaderRenderer | |
| enum class | MatrixConvention { OpenGL = 0 , Metal = 1 } |
| Viewing API matrix conventions designation (default to OpenGL). | |
| using | StageMap = StringMap |
| A map with name and source code for each shader stage. | |
Protected Types inherited from TextureBaker< GlslRenderer, GlslShaderGenerator > | |
| using | BakedImageVec |
| using | BakedImageMap |
| using | BakedConstantMap |
Protected Member Functions inherited from TextureBaker< GlslRenderer, GlslShaderGenerator > | |
| TextureBaker (unsigned int width, unsigned int height, Image::BaseType baseType, bool flipSavedImage) | |
| StringMap | initializeFileTemplateMap (InputPtr input, NodePtr shader, const string &udim=EMPTY_STRING) |
| size_t | findVarInTemplate (const string &filename, const string &var, size_t start=0) |
| FilePath | generateTextureFilename (const StringMap &fileTemplateMap) |
| DocumentPtr | generateNewDocumentFromShader (NodePtr shader, const StringVec &udimSet) |
| bool | writeBakedImage (const BakedImage &baked, ImagePtr image) |
Protected Member Functions inherited from GlslRenderer | |
| GlslRenderer (unsigned int width, unsigned int height, Image::BaseType baseType) | |
Protected Member Functions inherited from ShaderRenderer | |
| ShaderRenderer (unsigned int width, unsigned int height, Image::BaseType baseType, MatrixConvention matrixConvention=MatrixConvention::OpenGL) | |
Protected Attributes inherited from TextureBaker< GlslRenderer, GlslShaderGenerator > | |
| string | _extension |
| string | _colorSpace |
| string | _distanceUnit |
| bool | _averageImages |
| bool | _optimizeConstants |
| FilePath | _outputImagePath |
| string | _bakedGraphName |
| string | _bakedGeomInfoName |
| string | _textureFilenameTemplate |
| std::ostream * | _outputStream |
| bool | _hashImageNames |
| Vector2 | _textureSpaceMin |
| Vector2 | _textureSpaceMax |
| ShaderGeneratorPtr | _generator |
| ConstNodePtr | _material |
| ImagePtr | _frameCaptureImage |
| BakedImageMap | _bakedImageMap |
| BakedConstantMap | _bakedConstantMap |
| StringSet | _permittedOverrides |
| StringMap | _texTemplateOverrides |
| StringMap | _bakedInputMap |
| std::unordered_map< string, NodePtr > | _worldSpaceNodes |
| bool | _flipSavedImage |
| bool | _writeDocumentPerMaterial |
| DocumentPtr | _bakedTextureDoc |
Protected Attributes inherited from ShaderRenderer | |
| unsigned int | _width |
| unsigned int | _height |
| Image::BaseType | _baseType |
| MatrixConvention | _matrixConvention |
| CameraPtr | _camera |
| ImageHandlerPtr | _imageHandler |
| GeometryHandlerPtr | _geometryHandler |
| LightHandlerPtr | _lightHandler |
An implementation of TextureBaker based on GLSL shader generation.