Home Unreal Engine

Material shader - when model collides intersects another, add an edge?

polycounter lvl 10
Offline / Send Message
PogoP polycounter lvl 10
Hey guys, sorry about the cryptic thread title. I'll explain a little more.

I'm re-making an old Zelda dungeon in 3D to test out modularity for my university degree, and I'm wondering if it's possible to get the following water effect, where the edges are darkened, using a material shader:

water_example.png

As you can see, where the water meets a wall, it gets darker around the edges. I was wondering if it's possible to re-create this sort of effect using shaders.

In fact, how would you guys go about making such a water effect? Would you make it using a model you can layer above the ground, or would you make a material shader and apply it to the BSP (I don't want the water to be see-through)?

Thanks guys, hopefully you can shed some insight.

Replies

  • r_fletch_r
    Offline / Send Message
    r_fletch_r polycounter lvl 9
    There is no reason for the water to darken in that area other than that the wall is visible through the water. If your not making transparent water than why dont you include the darkening in the texture.

    Out if interest what engine are you using
  • PogoP
    Offline / Send Message
    PogoP polycounter lvl 10
    I'm using UDK. The thing with making the actual texture dark around the corners is that it won't tile, and the water fills rooms of all different sizes, so it'd have to be a dynamic effect.

    I just wanted to get some ideas because I'm not 100% sure how to go about doing it. I could just try the texture without the darkening, but I'm trying to stay true to the original game but with a bit of a handpainted twist on it.
  • Neox
    Online / Send Message
    Neox veteran polycounter
    just use depth biased blends or alpha can#t remember what exactly the term was, to controll the opacity of the water, where it intersects with other geometry it will become more transparent
  • haiddasalami
    Offline / Send Message
    haiddasalami polycounter lvl 14
    Could use a depth biased alpha but the only time I have used it was to get a softer effect when it intersects geometry.

    EDIT: Neox beat me to it :P
  • r_fletch_r
    Offline / Send Message
    r_fletch_r polycounter lvl 9
    Could use a depth biased alpha but the only time I have used it was to get a softer effect when it intersects geometry.

    EDIT: Neox beat me to it :P

    could you invert it and multiply it over the top?
  • haiddasalami
    Offline / Send Message
    haiddasalami polycounter lvl 14
    r_fletch_r wrote: »
    could you invert it and multiply it over the top?

    gonna check this real quick.

    EDIT: hmm well Depth Biased alpha returns a float (thus cant multiply and invert) and needs the material to be translucent. One way I thought it could work is if I specify the color of the opacity part and the main part and lerp them together but it doesnt turn out like how you want it. What i would do is make the wall bottoms dark and when you go the depth biased alpha running into the opacity it will grab that dark and put that. Along with a dest color (think thats the one) you can simulate a fog like in the water.
  • PogoP
    Offline / Send Message
    PogoP polycounter lvl 10
    Thank you for checking it out Haiddasalami. I'm so glad there are people like you that are in the technical know-how, on the internet!
  • Neox
    Online / Send Message
    Neox veteran polycounter
    the problem is it will apply to pretty much everything that hits the water, the player, enemies, anything really.
Sign In or Register to comment.