Home Unreal Engine

Unreal Shader Help

I've been trying to teach myself how to make custom shaders in the UDK Material Editor lately, but I'm stuck on how to get a shader to work how I want it to for a project I'm working on. Its going to be a modified glass glass type material that doesn't really make sense, but its purely for aesthetics. I'll try to explain what I'm looking for.

It needs to be a glass material that is only transparents through the area of the window the player is looking through. From the center of the players view, the opacity will gradually falloff until its opaque. Any ideas on how I could accomplish this? Let me know if thats not clear, I can try to explain it better.

Replies

  • JordanW
    Offline / Send Message
    JordanW sublime tool
    you can try doing a dot with cam vector and the normal, if that doesn't give a good falloff you could use a texture that uses coordinates from cameraworldposition that's screen aligned.
  • sprunghunt
    Offline / Send Message
    sprunghunt interpolator
    JordanW wrote: »
    you can try doing a dot with cam vector and the normal, if that doesn't give a good falloff you could use a texture that uses coordinates from cameraworldposition that's screen aligned.

    A simpler way to do this is to use the 'Fresnel' shader node and plug it into the opacity input of the shader. If you set the 'exponent' value of the fresnel node to something close to 1 it'll be pretty tight around the view of the player.

    Mathematically it's pretty much the same as Jordans suggestion but just a bit quicker :)

    Try it!
  • DarthNater
    Offline / Send Message
    DarthNater polycounter lvl 10
    sprunghunt wrote: »
    A simpler way to do this is to use the 'Fresnel' shader node and plug it into the opacity input of the shader. Mathematically it's pretty much the same as Jordans suggestion but just a bit quicker :)

    Try it!

    Wouldn't that just cause the opacity to be in the same spot and not move as the camera does?
  • sprunghunt
    Offline / Send Message
    sprunghunt interpolator
    DarthNater wrote: »
    Wouldn't that just cause the opacity to be in the same spot and not move as the camera does?

    A fresnel node uses a dot product of the camera vector and the normal vector.

    So it would move around as the angle and position of the camera moves in relation the surface the material is on.

    It's typically used on a water surface to make the water more opaque the further away from the camera it is.
  • Sean VanGorder
    Thanks guys, I'll try these out tomorrow.
Sign In or Register to comment.