Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 8 of 8

Thread: Mixing normal mapping and optic effects

Hybrid View

  1. #1
    Junior Member Newbie
    Join Date
    Apr 2012
    Posts
    4

    Mixing normal mapping and optic effects

    Afternoon everyone.

    I am trying to create an effect that uses reflection & refraction with a normal map, for effects like water, windows etc, unfortunately I have a very frustrating problem achieving this.

    I have 2 different shaders, one is normal mapping and the other gives optic effects with a cubemap (reflection & refraction), both shaders work perfectly. The problem is I'm trying to put both shaders together for the final effect, and of course failing at it.

    I know this is quite a big problem, but if anyone is able to spare a few minutes of their time I would be over the moon with joy!

    I thought it would be best if I gave you my shaders and images of the result with the shaders, so I put them all in a 7zip archive for you to view.
    BumpMap, Refraction shaders work, SGGlass is the problem shader.
    Password: theglass

    Shader link

    Sorry for asking for so much, I'm just frazzled now.

    Thank you.

    Edit: Forgot to mention, the final result I keep getting, it looks like the reflection/refraction is not using the normal thats obtained from the normal map, it just continues to look like the original refraction shader.

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Jan 2012
    Location
    Australia
    Posts
    785

    Re: Mixing normal mapping and optic effects

    If your shaders are working independently then I would look to make sure you haven't left a texture/transform matrix/normal map active from one stage that should be disabled before then second stage.

    I am not sure if I explained that well; but for a logic error in the code rather than in the shaders

  3. #3
    Junior Member Newbie
    Join Date
    Apr 2012
    Posts
    4

    Re: Mixing normal mapping and optic effects

    I've combed through my code for days now and unfortunately I cannot see such an issue So I'm guessing you see nothing wrong with the shaders either then?

    Actually ill also try and rephrase the goal (poor writing skills). The effect is essentially.. instead of using 1 normal from the quad for the reflection & refraction effect, I want to use a new normal at each fragment, extracted from the normal map.

  4. #4
    Advanced Member Frequent Contributor
    Join Date
    Jan 2012
    Location
    Australia
    Posts
    785

    Re: Mixing normal mapping and optic effects

    This is a bit beyond me; maybe someone else can help

  5. #5
    Junior Member Newbie
    Join Date
    Apr 2012
    Posts
    4

    Re: Mixing normal mapping and optic effects

    Alright, thanks for assisting

  6. #6
    Advanced Member Frequent Contributor
    Join Date
    Jan 2012
    Location
    Australia
    Posts
    785

    Re: Mixing normal mapping and optic effects

    This is DirectX but it might help

    http://rbwhitaker.wikidot.com/reflection-shader

  7. #7
    Junior Member Newbie
    Join Date
    Apr 2012
    Location
    Riley103
    Posts
    1

    Re: Mixing normal mapping and optic effects

    Quote Originally Posted by Cubehard
    Afternoon everyone.

    I am trying to create an effect that uses reflection & refraction with a normal map, for effects like water, windows etc, unfortunately I have a very frustrating problem achieving this.

    I have 2 different shaders, one is normal mapping and the other gives optic effects with a cubemap (reflection & refraction), both shaders work perfectly. The problem is I'm trying to put both shaders together for the final effect, and of course failing at it.

    I know this is quite a big problem, but if anyone is able to spare a few minutes of their time I would be over the moon with joy!

    I thought it would be best if I gave you my shaders and images of the result with the shaders, so I put them all in a 7zip archive for you to view.
    BumpMap, Refraction shaders work, SGGlass is the problem shader.
    Password: theglass

    Shader link

    Sorry for asking for so much, I'm just frazzled now.

    Thank you.

    Edit: Forgot to mention, the final result I keep getting, it looks like the reflection/refraction is not using the normal thats obtained from the normal map, it just continues to look like the original refraction shader.
    Thanks you for sharing

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •