Home Technical Talk

[Maya Shaderfx] World Position, does it work?

polycounter lvl 6
Offline / Send Message
bitinn polycounter lvl 6
Hi all, here I am again asking about shaderfx:

So I have wired up my shaderfx to do some simple grunge mixing and decals, now I want to offset my grunge map based on object's world position.



Maya Shaderfx for Stringray PBS (basically the de facto PBR base) has 2 "world position" node:

- Position World (The world-space position of the object)
- World Position (The position of the vertex in world space)

By description I know I should use the first one, BUT: Maya warns me about "Position World" because of "VP2.0 consolidation, this may always return identity".

And in my test, it seem to break the whole rendering, causing model to be transparent (even though we are only mixing it with roughness).



"World Position" sorts of work, I am pretty sure it returns ALL vertices, so the rendering looks stretched (to be honest, I have no idea how panner node use these sets of positions behind the scene):



So my questions:

- Am I using Position World wrong??
- Can I extract just 1 vertex position from World Position??

Thx in advance

Replies

  • bitinn
    Offline / Send Message
    bitinn polycounter lvl 6
    Oh and if I tune Panner node "time" value, "World Position" (that's the one for vertex world position, not object world position), it does look ok.

    But I am not convinced it's working-as-intended.

    (Previously I used Y position for V speed but it's not quite right, as my up-axis is Y; though I can confirm the stretching comes from "time" value, not "speed" value)


  • shaderfx
    Offline / Send Message
    shaderfx polycounter lvl 9
    Hey @bitinn
    The 'Position World' is indeed supposed to be the correct node for this.
    Maya's viewport 2.0 'consolidation' can be turned off in VP2 settings if you really need it.
    Though this could come at a small performance hit for large scenes.

    One alternative might be to hook up  'Parameter' nodes instead to expose the world X,Y,Z to the outside of the shader (In Dependency graph).
    Then hook up the Position, X,Y,Z of the maya (shape) node to the shader.

    Not an ideal situation to have to do it that way, so ideally ADesk should fix the bug in 'Position World' if that node is not working...

  • bitinn
    Offline / Send Message
    bitinn polycounter lvl 6
    shaderfx said:
    Hey @bitinn
    The 'Position World' is indeed supposed to be the correct node for this.
    Maya's viewport 2.0 'consolidation' can be turned off in VP2 settings if you really need it.
    Though this could come at a small performance hit for large scenes.

    One alternative might be to hook up  'Parameter' nodes instead to expose the world X,Y,Z to the outside of the shader (In Dependency graph).
    Then hook up the Position, X,Y,Z of the maya (shape) node to the shader.

    Not an ideal situation to have to do it that way, so ideally ADesk should fix the bug in 'Position World' if that node is not working...

    Oh yeah, linking parameter could achieve that, I totally forgot, thx!

    As for Position World node, I have opened a ticket for Autodesk, just one more thing to fix for Stingray PBS material.

    Actually, since you are here Kees, may I ask 2 follow up questions:

    - I never quite understand why Maya has a ShaderFX material and Stingray PBS material, and they each have different graph nodes. Wouldn't you normally want a definitive set of nodes, and create material variant based on it?

    - There a bump node for Stingray PBS material, which can convert grayscale map into normal map, it takes 3 different vector3, Position / Normal / Color. I think Color is just a grayscale, but what are Position and Normal?



    (I couldn't find a doc for this node)
  • bitinn
    Offline / Send Message
    bitinn polycounter lvl 6
    Hmm unless I am mistaken, I am not sure it's possible to expose "Material Variable" and have it update on object world position change, I was trying to use driven key but that's really an animation thing.

    Maybe you are referring to ShaderFX material node not Stingray PBS material node? A screenshot might help me if you have the time :)
  • shaderfx
    Offline / Send Message
    shaderfx polycounter lvl 9
    Stingray PBS is a sub-set of nodes for ShaderFX internally.

    The reason they were separated was that the Stingray PBS material can contain only nodes that were supported by the Stingray game engine and its unique material.

    I personally also felt that ShaderFX was too complicated for a lot of artists and felt that having a simpler set of nodes in Stingray material was a better way to go. With Autodesk dropping the Stingray engine none of this probably makes sense any more, but at the time it kind of did :)

    'normal' is the geometry normal and 'position' the vertex or pixel position for the bump node.

    Material Variable should expose that variable to the Maya DG and then you should be able to use set driven key to drive that value in the shader.
Sign In or Register to comment.