Home Unreal Engine

postprocess material help

polycounter lvl 8
Offline / Send Message
MaVCArt polycounter lvl 8
so, i've been cursing at this all evening, and googling and asking around has got me well on my way to the result I want but i'm still bugged by a giant problem.

the result i'm trying to get here, is a fisheye effect, but only on the edges. sort of a vignette-masked distortion, if you will

a short explanation of how this shader works:

i use the screen size and screen pos nodes to calculate the distance of a pixel to the screen's center. this results in a vignette-like vector2 with a white center and grading outwards. I mask this texture using a regular gradient to be able to only use it on the edges of the screen, and then I add that final result to the texture coordinate node, and that result goes into the UV's of the scene texture sample, which goes into the emissive node of the material.

the problem i'm having can be seen in the second image.
I know where the problem is coming from:
by adding a value to the UV's, i'm basically offsetting them.
the problem is that I don't know how to fix this.
i'm guessing the calculation went wrong somewhere and this is the result of that, if so, i would very much appreciate some help

thanks in advance :)


capturemd.jpg

capture2ej.jpg

Replies

  • EmAr
    Options
    Offline / Send Message
    EmAr polycounter lvl 18
    I didn't build your setup but I think ticking "Screen Align" in the properties of your Scene Texture Sample node can help. It helped me in a similar situation.
  • MaVCArt
    Options
    Offline / Send Message
    MaVCArt polycounter lvl 8
    EmAr wrote: »
    I didn't build your setup but I think ticking "Screen Align" in the properties of your Scene Texture Sample node can help. It helped me in a similar situation.

    i tested that, but it doesn't change a lot. it only changes the screen's supposed center, but not the final result, or the offset problem
  • Ace-Angel
    Options
    Offline / Send Message
    Ace-Angel polycounter lvl 12
    Could try and see what happens if you get rid of the TexCoord in the final Add node and instead instead add 0.5?
  • MaVCArt
    Options
    Offline / Send Message
    MaVCArt polycounter lvl 8
    Ace-Angel wrote: »
    Could try and see what happens if you get rid of the TexCoord in the final Add node and instead instead add 0.5?

    that gets the weirdest result; the scene is so distorted it's not recognizeable anymore, as essentially you're distorting it more towards the center and less towards the outside.
    the texcoord node is there to have a scene to distort, basically, so that's not a option

    i might be going about this the entirely wrong way though, i just want a fish eye effect, so if anyone's got a better/easier option to do that, i'm open to suggestions :)
    i've tried it with a spherical normal map, but the compression's killing it, so there's another problem i'm dealing with... again, 'im open to any suggestions
  • Oniram
    Options
    Offline / Send Message
    Oniram polycounter lvl 17
    could maybe try increasing the UV size of the textcoord so that when it pulls the screen from the distortion it wont be pulling outside of its bounds. ive had this same issue happen with "heat wave" distortion effects along the edges of my screen.
  • Ace-Angel
    Options
    Offline / Send Message
    Ace-Angel polycounter lvl 12
    If you're using a Normal Map, where are you plugging it, I'm curious?

    Also, to get rid of the compression, I suggest importing your Normal Map as a TC_NormalMap compression, then switch it to a VectorDisplacment compression.
Sign In or Register to comment.