Skip to content

Commit

Permalink
HYDRA-1326 : Various fixes for the custom GLSLFX shader
Browse files Browse the repository at this point in the history
  • Loading branch information
lanierd-adsk committed Dec 10, 2024
1 parent 25ae907 commit 03c507d
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,15 @@ surfaceShader(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord)
//vec2 st = HdGet_st().xy;//This doesn't work unless you add a texture node in the material network

//Get the vertex colors from the prim vars of the quad primitive
vec3 vertexColors = HdGet_displayColor().rgb;
#ifdef HD_HAS_displayColor
vec3 vertexColors = HdGet_displayColor().rgb;
#else
vec3 vertexColors = vec3(1);
#endif

vec3 ambientColor = vec3(0);//Hardcoded
//Get the value of the custom color float3 parameter from the material, it is named "FVP_CustomColor"
vec3 diffuseColor = HdGet_FVP_CustomColor() *0.5 + vertexColors*0.5;//Blend the custom color with the vertex colors
vec3 diffuseColor = HdGet_FVP_CustomColor() * vertexColors;//Blend the custom color with the vertex colors
vec3 specularColor = vec3(1);//Hardcoded

vec3 n = Neye;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,11 @@ void MhCustomShaders::addedToModelCb()
//Data producer scene index interface is used to add the retained scene index to all viewports with all render delegates
auto& dataProducerSceneIndexInterface = Fvp::DataProducerSceneIndexInterface::get();
dataProducerSceneIndexInterface.addDataProducerSceneIndex(_retainedSceneIndex, noPrefix, (void*)&obj, FvpViewportAPITokens->allViewports,FvpViewportAPITokens->allRenderers);

//Update color
MPlug colorPlug(obj, mColor);
const double3& color = colorPlug.asMDataHandle().asDouble3();
UpdateColorInShader(color);
}

void MhCustomShaders::removedFromModelCb()
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 03c507d

Please sign in to comment.