-
Notifications
You must be signed in to change notification settings - Fork 202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LOOKDEVX-2124 - MaterialX Topo Handler #3445
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -82,8 +82,10 @@ void fixupVertexDataInstance(ShaderStage& stage) | |
|
||
static const std::string primvarParamSource | ||
= "vec([23]) [$](" + d(HW::T_IN_GEOMPROP) + "_[A-Za-z0-9_]+)"; | ||
|
||
static const std::regex primvarParamRegex(primvarParamSource.c_str()); | ||
static const std::regex primvarParamRegex(primvarParamSource.c_str()); | ||
static const std::string texcoordParamSource | ||
= "vec([23]) [$](" + d(HW::T_TEXCOORD) + "_[0-9]+)"; | ||
static const std::regex texcoordParamRegex(texcoordParamSource.c_str()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As you can see above, we already had code that cleaned up shader stream variable names that were generated for "geompropvalue" nodes. We need to do the same for variable names generated for the "texcoor"nodes used in LookdevX. |
||
|
||
// Find keywords: (as text) | ||
// | ||
|
@@ -94,16 +96,21 @@ void fixupVertexDataInstance(ShaderStage& stage) | |
// PIX_IN.(NAME) PIX_IN.st | ||
// | ||
|
||
static const std::string vdCleanupSource = "[$]" + d(HW::T_VERTEX_DATA_INSTANCE) + "[.][$]" | ||
static const std::string vdCleanGeoSource = "[$]" + d(HW::T_VERTEX_DATA_INSTANCE) + "[.][$]" | ||
+ d(HW::T_IN_GEOMPROP) + "_([A-Za-z0-9_]+)"; | ||
static const std::regex vdCleanGeoRegex(vdCleanGeoSource.c_str()); | ||
|
||
static const std::regex vdCleanupRegex(vdCleanupSource.c_str()); | ||
static const std::string vdCleanTexSource | ||
= "[$]" + d(HW::T_VERTEX_DATA_INSTANCE) + "[.][$](" + d(HW::T_TEXCOORD) + "_[0-9]+)"; | ||
static const std::regex vdCleanTexRegex(vdCleanTexSource.c_str()); | ||
|
||
std::string code = stage.getSourceCode(); | ||
code = std::regex_replace(code, paramRegex, "vec3 unused_$1"); | ||
code = std::regex_replace(code, vtxRegex, "$$$1( PIX_IN.$$$1 )"); | ||
code = std::regex_replace(code, primvarParamRegex, "vec$1 unused_$2"); | ||
code = std::regex_replace(code, vdCleanupRegex, "PIX_IN.$1"); | ||
code = std::regex_replace(code, texcoordParamRegex, "vec$1 unused_$2"); | ||
code = std::regex_replace(code, vdCleanGeoRegex, "PIX_IN.$1"); | ||
code = std::regex_replace(code, vdCleanTexRegex, "PIX_IN.$1"); | ||
|
||
#if MX_COMBINED_VERSION >= 13804 | ||
stage.setSourceCode(code); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -462,7 +462,7 @@ bool OgsFragment::isElementAShader() const | |
|
||
bool OgsFragment::isTransparent() const | ||
{ | ||
return _glslShader && _glslShader->hasAttribute(mx::HW::ATTR_TRANSPARENT); | ||
return isTransparentSurface(_element, mx::GlslShaderGenerator::TARGET); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using native MaterialX call. |
||
} | ||
|
||
mx::ImageSamplingProperties | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,8 @@ | |
/// @file | ||
/// OGS fragment wrapper. | ||
|
||
#include <mayaUsd/base/api.h> | ||
|
||
#include <MaterialXCore/Document.h> | ||
#include <MaterialXGenShader/Shader.h> | ||
#include <MaterialXRender/ImageHandler.h> | ||
|
@@ -16,7 +18,7 @@ namespace MaterialXMaya { | |
/// and outputs and embedding source code in one or potentially multiple target | ||
/// shading languages (GLSL is the only such language currently supported). | ||
/// | ||
class OgsFragment | ||
class MAYAUSD_CORE_PUBLIC OgsFragment | ||
{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Allow these classes to be used in LookdevX. |
||
public: | ||
/// Creates a local GLSL fragment generator | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Allows LookdevX to used the shadergen code.