Announcement

Collapse
No announcement yet.

How to get the HLSL code of the transform node?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How to get the HLSL code of the transform node?

    So far I manage to find worldPosition, cameraVector, ... And the TransformLocalVectorToWorld, TransformWorldVectorToLocal, and TransformLocalPositionToWorld.

    I cant find Transform positio from world to local.

    Is there a "easy" way to get the nodes code or some documentation to look?

    Check 3d tips! POLY DNA

    #2
    You can code inside Custom Node like this:

    Up to UE4.21:

    Code:
    SomeVector = normalize(mul(SomeVector, Primitive.WorldToLocal));

    For UE4.22 and up:

    Code:
    SomeVector = normalize(mul(SomeVector, GetPrimitiveData(Parameters.PrimitiveId).WorldToLocal));
    In this case the Local uses the Primitive where the material is running to correctly do the transform.

    When possible, try to leave some nodes outside the custom node (if you are using one) to do the transform and use a vector3 as input to the custom node.
    Nilson Lima
    Technical Director @ Rigel Studios Ltda - twitter: @RigelStudios
    Join us at Discord: https://discord.gg/FUwTvzr

    UE4 Marketplace: Cloudscape Seasons
    supporting: Community FREE Ocean plugin

    Comment


      #3
      Originally posted by NilsonLima View Post
      You can code inside Custom Node like this:

      Up to UE4.21:

      Code:
      SomeVector = normalize(mul(SomeVector, Primitive.WorldToLocal));

      For UE4.22 and up:

      Code:
      SomeVector = normalize(mul(SomeVector, GetPrimitiveData(Parameters.PrimitiveId).WorldToLocal));
      In this case the Local uses the Primitive where the material is running to correctly do the transform.

      When possible, try to leave some nodes outside the custom node (if you are using one) to do the transform and use a vector3 as input to the custom node.
      Thank you very much!!

      About that, my main concern is that Im sure that the code wont allways work without the compiler magic under the nodes. But that makes writing shaders much more complicated and slow.
      Why the need of GetPrimitiveData after 21? And what kind of primitiveData are available?
      Check 3d tips! POLY DNA

      Comment


        #4
        Originally posted by II_ADN_II View Post

        Thank you very much!!

        About that, my main concern is that Im sure that the code won't always work without the compiler magic under the nodes. But that makes writing shaders much more complicated and slow.
        Why the need of GetPrimitiveData after 21? And what kind of primitiveData are available?
        Every place you had before a Primitive.something need to be changed to that because the changes UE4.22 rendering module received, as for the reasons you can watch this video for the details:



        For the amount of operations you can do for a primitive (if you are not used to make shaders in OpenGL or HLSL, check for google definitions for HLSL primitives) they are mapped by the HLSL cross-compiler to these page details: https://api.unrealengine.com/INT/API...er-/index.html
        Nilson Lima
        Technical Director @ Rigel Studios Ltda - twitter: @RigelStudios
        Join us at Discord: https://discord.gg/FUwTvzr

        UE4 Marketplace: Cloudscape Seasons
        supporting: Community FREE Ocean plugin

        Comment

        Working...
        X