Home Unreal Engine

UDK - Material - Custom Tangent to World function without Node?

polycounter lvl 12
Offline / Send Message
Ace-Angel polycounter lvl 12
Hey to all,

I was wondering if any kind soul could fill me in on how to create in UDK a Tangent to World function without the need of the blasted node which keeps on killing my vertex colors.

I was scanning some information, and all of them seems to point at at this:

Normal Vector, Binormal Vector, Tangent Vector -> NormalXForm (Input1, Input2, Input3)

Of course, I could be sorely mistaken since in UDK your simply connect the Reflection Vector to the Transform node and make magic happen and I simply was reading information for other engines and such.

Bonus Question: Do the lights in UDK take into account Distance already or not?

Replies

  • |*BILLY$CLINT*|
    Options
    Offline / Send Message
    |*BILLY$CLINT*| polycounter lvl 11
    Try enabling the Per Pixel Camera Vector flag in the material settings. This will allow you to use Vertex Colors along side Transform's.
  • Ace-Angel
    Options
    Offline / Send Message
    Ace-Angel polycounter lvl 12
    No-can-do my good Sir, I'm using the custom Per-Pixel-Reflection function with a Normal Map, for Pixel Camera to work, I need to have a standard Reflection node, which doesn't account for a Normal Map, and which is also very expensive.

    So basically, I'm adding about 10 instruction to my entire shader everytime I need to make a world transform, because I'm subtracting my Reflection node from my Pixel-Reflection or Normal map before feeding it into my Transform node, just so my Vertex Colors can work.

    So yeah, a conundrum alright.
  • |*BILLY$CLINT*|
    Options
    Offline / Send Message
    |*BILLY$CLINT*| polycounter lvl 11
    Ace-Angel wrote: »
    No-can-do my good Sir, I'm using the custom Per-Pixel-Reflection function with a Normal Map, for Pixel Camera to work, I need to have a standard Reflection node, which doesn't account for a Normal Map, and which is also very expensive.

    So basically, I'm adding about 10 instruction to my entire shader everytime I need to make a world transform, because I'm subtracting my Reflection node from my Pixel-Reflection or Normal map before feeding it into my Transform node, just so my Vertex Colors can work.

    So yeah, a conundrum alright.

    So now I am a bit confused...What custom Per-Pixel Reflection map node are you reffing too? Is this something that you wrote in HLSL? Can you try and explain what your end result is and maybe we can come up with a solution / work around.
  • Ace-Angel
    Options
    Offline / Send Message
    Ace-Angel polycounter lvl 12
    The ones found in UDK function library, it's called CustomRelectionVector, you can feed it a Normal Map and acts just like a Reflection Node, but I'm trying to find a way to avoid Transform to World Node due to certain issues.
  • Vailias
    Options
    Offline / Send Message
    Vailias polycounter lvl 18
    Lol.. figured I'd duplicate something Epic did because I didn't notice it... identical node structure too with different placement in the graph lol.

    Short answer to your actual question: kinda.
    You'll need to do a matrix multiplication to get the tangent space reflection vector into world space.
    the mul(vector,matrix) hlsl function doesn't work in udk's custom node, which means you'll have to do it long hand, as well as construct a tangent to world matrix out of vectors.

    The short of it is, you probably could with enough effort, but it would be the same thing as using the transform node and also cost as many or more instructions.
  • Ace-Angel
    Options
    Offline / Send Message
    Ace-Angel polycounter lvl 12
    Ah bollocks, and here I was thinking it would be cheaper and solve my issue, ah well, guess it's double subtract again, thanks for the feedback.
Sign In or Register to comment.