Announcement

Collapse
No announcement yet.

Is this possible

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

    #16
    This is what i got so far with your technique Arnage, it feels good to have it working dynamically, this is looking very promising

    Comment


      #17
      Glad to have helped.

      Originally posted by KhenaB View Post
      I want to give your method a try, what would be the easiest way to calculate the bounds of each parts of the object, the sphere shape seems quite simple but let's say the helmet isn't perfectly round, would this have to be an equation done in the material editor with trial and error until the mask matches the mesh?
      Math is quite predictable, so trial and error is not necessarily required But yeah, if you need another shape you would have to adjust the math to approximate that shape. Also keep in mind that for other shapes you have to consider the objects rotation in addition to the location.

      One additional advantage of this method is that you can easily add other effects such as foam or waves near the sub in a more exact way then the common depth based methods would allow.

      Comment


        #18
        Originally posted by Arnage View Post
        Math is quite predictable, so trial and error is not necessarily required
        Oh you are absolutely right, but in my case i'm sure there will be a lot of trial and error involved

        Originally posted by Arnage View Post
        One additional advantage of this method is that you can easily add other effects such as foam or waves near the sub in a more exact way then the common depth based methods would allow.
        Yes, i have so many ideas that this technique will allow me to do, also i have noticed that viewed from the interior the mask doesn't have to be extremely precise for the effect to look right so this is even more reassuring

        Are there any good resources out there where i could learn how to create mathematical shapes in the material editor?

        Comment


          #19
          Originally posted by KhenaB View Post
          Are there any good resources out there where i could learn how to create mathematical shapes in the material editor?
          Not that I know of unfortunately. A good place to start might be the various gradient and procedural material functions that ship with the editor. They're mostly 2D and in UV space, but it should not be too hard to translate the concepts to 3D and world space.

          Some more ideas to extend this method:
          - Using a texture mask to define an extruded more complex shape around one axis and then using some additional math to define the behavior on the other axis. (might work well for the ship in your first post)
          - Using a 3D texture to define any shape you want.
          - Accessing the distance field data generated by the engine for DFAO. (Haven't tried this, so no idea how, but this would save you from having to manually create a 3D texture)

          These probably go beyond what you need, but might inspire others that read this thread.

          Comment


            #20
            Those are awesome ideas, you seem to have a vast knowledge of UE4 and logic in general, i wouldn't have gotten far without the community's help

            I'll play around a bit and see what i can come up with

            Comment


              #21
              This is kinda awesome.. I was always trying to find a way to mask water materials so that it doesn't show up inside the mesh of boats etc.
              It's seems pretty limited the way it is right know but if this is possible then it shouldn't be too hard to figure out how to do the same thing for any shape.

              I was wondering if it would be possible to adapt the technique used to make edge foam but instead use it to detect where the transparency should start in order to mask the inside.. or is that what you already tried in your previous attempt?

              4.10 Update! -> [Community Project] WIP Weather & Ocean Water Shader
              WIP Interactive Water Shader, WIP 2D Water Sim
              WIP FFT Ocean w/ Foam, Quad-tree Infinite Ocean LOD

              Comment


                #22
                In my previous attempt i was simply rendering the sphere at a custom depth and above the water so this is why it also was blocking the water where it shouldn't have

                I don't know about using the depth fade node, i'm sure there is an even better method out there to detect the mesh shape and mask it accurately but my knowledge of UE4 is too limited

                Comment


                  #23
                  We ran into this same issue while working on Bioshock Infinite.

                  The problem scene - (opening sequence) - Booker and Twins are on the boat* - Booker exits the boat and is given full camera freedom (this includes the ability to look back at the boat).
                  Issue #1 - The ocean was calculated with a vertex shader (vertex animation), which meant the waves pierced the hull and ignored the space in which air was suppose to occupy.
                  Issue #2 - After exiting the boat, this became even more evident as they began to row away from the lighthouse,, the water did not appear to be affecting the boat (foam, splashes, etc.).

                  Issue #1 Performance Solution: Since the player (Booker) was confined to the boat, we were able to simply change the rendering priority of the boat (and all objects within it) to a sort priority that was 1 level higher.
                  Issue #2 Solution: When out of the boat, there was no getting around the interaction and volume issue. I unfortunately am not able to give "all" the details, but I can steer you in one of the several right directions. When dealing with vertex information, it is impossible to add unique alpha maps (textures - such as the shape of the hull of the boat) into the equation. "I mean, it is possible, but dangerous and extremely performance heavy. Not to mention "in UE3" you had to modify a bit of code to do it". So with that in mind, the big question is, how do you mask off the vertex information to fit the shape of the boat? One solution is: There needs to be a texture map (alpha) of the shape of the boat. Then, this needs to be applied to a special material that can be projected through a light or dynamic decal onto a surface. You then need to bind the location of the dynamic actor (i.e. - the light or dynamic decal that is projecting the alpha texture) to the location of the boat. You then need to modify it so that the projected material (alpha texture) acts as a rendering mask for the ocean priority only. You then place a second (and much cheaper mesh) under the boat with another type of ocean material that is bound to the boats location. This material has a modified boat hull gradient falloff which is then driving a tessellation deformation (or just a deformation), which then conforms the underlying mesh with the top ocean plane "effectively stitching them together". Further modifications can be made so that the mask behaves as the boat rocks and drops farther into the ocean or raises out of it.

                  This solution is (roughly the same "if I am not mistaken" - as the one used on the opening sequence). After I brainstormed with the Lead VFX - Stephen Alexander - he took the concept and implemented it. So I am not sure of all the details he chose to implement, nor did I bother investigating his kismet setup and shaders. (Was busy trying to stay on top of all my tasks) ^_^

                  As a side note, this is not the only way to accomplish unique "boolean volumes". There are other methods, just gotta reach way outside the box to find them

                  You can see the end result of the implementation at 2:30 seconds:



                  -Jeremy-
                  Portfolio
                  UE3 - Advanced FX Masterclass Part 1 DVD
                  UE3 - Advanced FX Masterclass Part 2 DVD

                  Comment


                    #24
                    Thank you JBaldwin, very interesting read

                    Comment


                      #25
                      I have made some good progress, however i have some issue using my masks on particles, right now i'm setting up the masks in the particle's material but they don't seem to get masked, i have tried on gpu and regular particles

                      It's as if the particles will not spawn inside the mask, but already spawned particles won't get masked

                      Any ideas?

                      Comment


                        #26
                        @JBaldwin Thanks for the insights, always nice to read how others solve similar problems.

                        Originally posted by KhenaB View Post
                        I have made some good progress, however i have some issue using my masks on particles, right now i'm setting up the masks in the particle's material but they don't seem to get masked, i have tried on gpu and regular particles

                        It's as if the particles will not spawn inside the mask, but already spawned particles won't get masked

                        Any ideas?
                        Particle spawning should be completely independent of the material. Did you check in another viewmode if they really aren't there? My initial guess would be that the way you calculate your mask is not updated when the particles move, leaving the initially masked particles masked forever and the other never to be masked. Try plugging the mask into the emissive slot or enlarging them to usually be partially masked to more easily debug them.

                        PS. Did you post another question before? I got an email from the forum telling me so, but there was nothing in this thread...
                        Last edited by Arnage; 12-30-2014, 04:59 AM.

                        Comment


                          #27
                          I did some more testing and the mask seems to be working, but something is wrong with my material instance, the Location parameter doesn't update and the mask stays at 0,0,0, perhaps it has to be done differently for particles?

                          PS. Did you post another question before? I got an email from the forum telling me so, but there was nothing in this thread...
                          It was the same question but i decided to try something else before posting

                          The strange thing is that if i get the parameter value of the location and print it on screen it really works, it follows my player around, i'm not sure why the mask isn't moving, it works well with all my other actors
                          Last edited by KhenaB; 12-30-2014, 04:14 PM.

                          Comment


                            #28
                            I'm doing a series of tests to try and understand why i'm unable to change parameters in the particle's material

                            Here for example is a simple graph that i would expect to change the particle's material color to blue when i press T, but the color never changes, it changes if i do it directly in the mat instance, i'm not sure why it isn't working, i have masked all my actors this way

                            Click image for larger version

Name:	BlueTest.jpg
Views:	1
Size:	387.6 KB
ID:	1064683

                            Comment


                              #29
                              Hey Khena, looks like the Create Dynamic Material Instance node at the top of the picture doesn't have an asset selected for "Source Material".
                              Free Community Ocean & Sky Project || Join us on Discord! || Trello Roadmap

                              Comment


                                #30
                                Hi DotCam!

                                This is how i always set the graphs and it usually works, i did try with specifying the mat and it didn't help!

                                The strange thing is that if i put a "Set Vector Parameter Value" node in the construction script it works, i'm really confused, i must have missed something

                                This works perfectly

                                Click image for larger version

Name:	contscript.jpg
Views:	2
Size:	139.8 KB
ID:	1064686
                                Last edited by KhenaB; 12-30-2014, 07:27 PM.

                                Comment

                                Working...
                                X