Home Technical Talk

.fx shader with UV channel selection?

polycounter lvl 13
Offline / Send Message
GarageBay9 polycounter lvl 13
Does anybody have a DirectX viewport shader (.fx mat) that allows you to pick the UV channel of the normal map?

I'm working on an object with different mapping channels for the diffuse and normal, and neither Ben Cloward or Xoliul's shaders provide for that. :\

Replies

  • Surfa
    Offline / Send Message
    Surfa polycounter lvl 12
    I have one I made for myself that really isn't good enough to be released. I mean I spend like 5 mins on it ages ago. I will try to touch it up a little so it can be used to some degree.
  • GarageBay9
    Offline / Send Message
    GarageBay9 polycounter lvl 13
    Cool, thanks Surfa! Keep me posted. :)
  • Surfa
    Offline / Send Message
    Surfa polycounter lvl 12
    Ok I really can't remember how to use shader fx so I will look into the documentation tomorrow (getting a bit late here) but for now I hope this will do.
    http://icy-bee.co.uk/multi-channel-nrm-shader.rar

    Basically it take 3 target spots (lights) and expects a diffuse/spec as well as a normal. Hopefully after I have spend some more time I will add other options like opacity and gloss maps but for now I will catch some zeds.
  • GarageBay9
    Offline / Send Message
    GarageBay9 polycounter lvl 13
    Surfa wrote: »
    Ok I really can't remember how to use shader fx so I will look into the documentation tomorrow (getting a bit late here) but for now I hope this will do.
    http://icy-bee.co.uk/multi-channel-nrm-shader.rar

    Basically it take 3 target spots (lights) and expects a diffuse/spec as well as a normal. Hopefully after I have spend some more time I will add other options like opacity and gloss maps but for now I will catch some zeds.

    Hey, Surfa. I'm looking through the shader here and it looks like there's some provision for flipping the Y direction, but it's not completely set up. Do you mind if I mess with this some?

    EDIT: Okay, I have a selectable green channel flip working for the normal map - it's an ugly, ugly hack with a snippet of code I copied out of one of Ben Cloward's shaders, but it works. Surfa, shoot me a PM and I'll send you the flippable version.

    EDIT 2: EDIT HARDER: I take that back. It looks like I'm managing to swap two tangents somewhere instead of just flipping green. On further inspection this chunk of code looks like it was supposed to check for Y-up orientation (to differentiate between Max, Maya, etc), and it's swapping two different things instead of inverting just Y. Needs more work...
  • Surfa
    Offline / Send Message
    Surfa polycounter lvl 12
    Ok I update the link above with green channel flipping. I was kinda hoping that I would wake up and this would be added to other shaders. The problem with mine is I made it in shader fx and so the code is fairly messy. Also with other shaders they would have to just add this quick feature of allow multiple channels for the uv-coords, I on the other hand would have to add a lot more features to bring this up to scratch.


    Btw if you are wondering about flipping the green channel you just access the y value of the normalmap and negate it.
    if(UIBool_117 == 1) NormalMap_7502.y = -NormalMap_7502.y;
    
  • Xoliul
    Offline / Send Message
    Xoliul polycounter lvl 16
    I can add that, it's not hard i think. You just want to be able to pick the channel for the normalmap?
  • AlecMoody
    Offline / Send Message
    AlecMoody ngon master
    add modulate2x lightmaps on an independent channel as well!
  • GarageBay9
    Offline / Send Message
    GarageBay9 polycounter lvl 13
    Surfa wrote: »
    Ok I update the link above with green channel flipping. I was kinda hoping that I would wake up and this would be added to other shaders. The problem with mine is I made it in shader fx and so the code is fairly messy. Also with other shaders they would have to just add this quick feature of allow multiple channels for the uv-coords, I on the other hand would have to add a lot more features to bring this up to scratch.


    Btw if you are wondering about flipping the green channel you just access the y value of the normalmap and negate it.
    if(UIBool_117 == 1) NormalMap_7502.y = -NormalMap_7502.y;
    

    Thanks Surfa, this is perfect! I had trouble decyphering exactly which variable was the normal map's Y channel. I think what I was doing was transposing x and y somehow.
  • Surfa
    Offline / Send Message
    Surfa polycounter lvl 12
    Xoliul wrote: »
    I can add that, it's not hard i think. You just want to be able to pick the channel for the normalmap?

    Yes please. Also yeah if possible add a lightmap with a channel selection as well.
  • GarageBay9
    Offline / Send Message
    GarageBay9 polycounter lvl 13
    What I'd love to be able to do now is turn some of the lights off... I like to texture in a relatively neutral light environment, and I noticed last night that with the three default lights in the shader, it was really blowing out my diffuse.

    Man, I haven't done much code since high school... I wish I had a HLSL function reference.
Sign In or Register to comment.