Announcement

Collapse
No announcement yet.

DestDepth and DestColor

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    DestDepth and DestColor

    Ok, I am trying to make a water material that changes opacity based on how deep the water is. Well, from what I have read, DestDepth returns the depth behind the pixel being rendered into a value between 1 and 16,777,215.

    Now the question I have is... does it take into account the distance of the player from the material? Because I can get it to work correctly when I am close, but when I zoom out to a birds eye view, it just turns 100% opaque.

    The other questions I have is... how in the world do you use DestColor. Like the most simple way you can think of. Take it and multiply it by a constant3vector and then connect it to what? Does it go into your diffuse? I can't ever get any result with it.

    #2
    Ok, figured out the DestDepth. For those of you who may want to know. DestDepth returns the depth of the pixel being rendered behind the material IN RELATION TO the distance of the player camera. Once I realized that, I just used PixelDepth to subtract from DestDepth. This gives you the distance between the material and the pixel being rendered behind it.

    Now if I could just figure out DestColor.

    Comment


      #3
      DestColor - take color behind the pixel.

      Comment


        #4
        Thanks Flint. I knew that already. However I can not figure out what to do with it. Basically, I imagine you would multiply it to your main diffuse/emissive so that it would look like it was altering the color of the materials behind it. However, that doesn't seem to work.

        Comment


          #5
          Care to share your material setup? I'm trying to create some water and I'd like to get some pointers.

          Hourences' tutorial instructed to use DepthBiasedAlpha. It fades the material away near geometry the material collides with. Would it do the same thing you're trying to achieve?

          Comment


            #6
            Originally posted by musilowski View Post
            Care to share your material setup? I'm trying to create some water and I'd like to get some pointers.

            Hourences' tutorial instructed to use DepthBiasedAlpha. It fades the material away near geometry the material collides with. Would it do the same thing you're trying to achieve?
            Musilowski, my ocean material is nearly 120 instructions now. It has a lot of vector math and other calculations. I would prefer not to post it until it is finished however. Still, if you need help, just ask whatever you want in this post and I will answer what I can.

            Comment


              #7
              Okay. You and KazeoHin competing or something?

              I'd like to know how exactly one changes the color of the water (perhaps using DestColor as you're doing). And what is the math to change the opacity of the water using DestDepth? And pointers on using a cube map of sorts to create reflections?

              Comment


                #8
                Originally posted by musilowski View Post
                Okay. You and KazeoHin competing or something?

                I'd like to know how exactly one changes the color of the water (perhaps using DestColor as you're doing). And what is the math to change the opacity of the water using DestDepth? And pointers on using a cube map of sorts to create reflections?
                Well, I have found a use for Dest Color, However working with it is rather difficult, because it does not allow for UV distortion. I would rather use good 'ol transparency.

                Comment


                  #9
                  Originally posted by KazeoHin View Post
                  Well, I have found a use for Dest Color, However working with it is rather difficult, because it does not allow for UV distortion. I would rather use good 'ol transparency.
                  Yeah, I finally got DestColor to work, but it seems so pointless. Like you said, if something is transparent, its already going to effect its color... so I don't see any reason to use it unless you are creating a very complicated scene. Usually details like that are not even noticed by the normal players anyways.

                  I am not competing with KazeoHin... I just love working in the unreal editor, I am about to go to graduate school just so I have more free time to do so! I LOVE IT!!! My problem is that I have so many projects its hard to focus on just one.

                  Oh.. and I have seen KazeoHin's ocean material, its magnificent. Kazeo, if you read this... it took me forever to make mine emulate wave foam when waves hit objects. I finally got it, but the amount of instructions are not worth it for most occasions, so I added a switch to enable/disable it. When disabled, it just keeps foam around objects instead of spreading it when a wave hits it...


                  I have been looking into expanding it from just a material though. Instead, adding particle/mesh emitters to create real waves. Larger the further away, and smaller as they get close. In my testing, it seems that doing this actually produces a more optimized approach while giving it an even better look. You might want to look into it if you have not already.


                  This is the first time I have attempted to create reusable assets this advanced that could be used in any area of any level. Honesty, I am beginning to wonder if it is worth it. I can get better results by creating materials specifically designed for a location/mesh.



                  Now, down to the help:

                  To use cubemaps, Hourences: http://book.hourences.com/tutorialsue3mated2.htm
                  If you are using cubemaps, you color is usually going to be produced by that. So in essence, it is created by the color of the sky.

                  To make the opacity based on your ocean depth, you take a DestDepth MINUS PixelDepth. Now divide that by a number of your choice (I use 2000). This number is how you scale the depth. You probably will want to clamp that all off into a range of 0 and 1. Plug that into the opacity/alpha of whatever you want.

                  If you don't understand these instructions just let me know, I will make a video tutorial when I have time if you need me too.

                  Comment


                    #10
                    Thanks for replying. I'd say this gets me quite long forward. If I run into trouble I'll post a question.

                    Comment

                    Working...
                    X