Announcement

Collapse
No announcement yet.

Is this possible

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

    #31
    Turns out that the material had to be set after the parameter node

    Click image for larger version

Name:	set.jpg
Views:	1
Size:	130.1 KB
ID:	1064716

    Comment


      #32
      Ok that makes more sense. I was going to post this earlier (sorry I should have...) that the DynamicMaterialInstance is creating a new instance of the material, so the material instance you had set in the Particle Editor wouldn't get updated with the new value. I was going to test it out first before posting but got sidetracked...

      Good to hear it's working properly now!
      Free Community Ocean & Sky Project || Join us on Discord! || Trello Roadmap

      Comment


        #33
        Awesome little read there!

        I've been also toiling away at this problem some time ago, though not to hide water but to punch holes in ceilings for embedded hallogen spots and other light fixtures, i got a bit stuck and left it for later.
        Currently i managed to create a shader that uses the coordinates of specific blueprints to create round holes at the coordinates of relevant blueprints. However i haven't managed to create any custom shapes.
        My end goal is to just have a blueprint section that i can just place in any of my light models and have it apply the effect, including custom values for square light fixtures like embedded fluorescent lamps
        Click image for larger version

Name:	iPgllWk.png
Views:	1
Size:	469.4 KB
ID:	1064860
        This solution was also limited to the amount of holes i put support into the shader, every hole needs a seperate mask "input" on the DMI shader.
        Click image for larger version

Name:	ZSt58vJ.png
Views:	1
Size:	120.0 KB
ID:	1064861

        Currently the radius is fixed, and the hole is spherical.
        here is the blueprint i'm using to create the holes:
        Click image for larger version

Name:	j8zOi3b.png
Views:	1
Size:	434.3 KB
ID:	1064862

        If somebody can help me with how to mathematically define rectangles (or other custom shapes) i would probably be able to get more use out of this application.

        Initially i thought it would just be as easy as just projecting a decal mask that overwrites the alpha of the shader it lands on, however decals support normals/diffuse/emissive but not opacity...
        Maybe this can be enabled in code however i'm not a programmer myself...

        If i can define all these variables i intend to use a custom struct value to quickly add public variables that allow for quick specification of the hole that needs to be created, like for instance "is sphere" , "is box", "use decal mask", "radius", "width", "length", "decal size", "transform" all combined into a "holeinfo" struct.
        Last edited by MissStabby; 01-05-2015, 10:56 AM.

        Comment


          #34
          First of all I'm not sure if this is the best solution in your use case. Assuming your ceiling lights never move it is probably a lot more efficient to just model the holes into the actual geometry. However if you have a good reason to want to do them like this here's some pointers:

          First of all I would place your hole shape math into a function instead of copying it a bunch of times. That should make your shader a lot easier to update.

          Second regarding your question if you could use decals: no, in UE4 decals are applied deferred after the scene was rendered, so they can alter the various g-buffer channels, but you can't reveal the anything underneath.

          Here's an example of a square hole mask function. I made the assumption that your ceiling is always horizontal so it ignores the Z axis, but you can simply translate the concept to three axis to create a cube mask:

          Click image for larger version

Name:	SquareMask.png
Views:	1
Size:	306.9 KB
ID:	1064864

          You can also do something similar to create a custom UV set. Plug this into a black and white mask as the UVs and you can cut holes in any 2D shape you could want:

          Click image for larger version

Name:	HoleUVs.png
Views:	1
Size:	286.2 KB
ID:	1064865

          Comment


            #35
            I agree with Arnage that the easiest solution would be to model the holes unless you are going for something specific

            This is what i have used to make a dynamic box mask and it worked for me

            Click image for larger version

Name:	BoxMask.jpg
Views:	1
Size:	225.0 KB
ID:	1064878

            Comment


              #36
              Hmm interesting, i'm definitely going to try this out!
              The reason i want to have the holes to be dynamic is so that it is easy to populate and tweak office ceiling with lights without having to adjust the models or bsp's
              With Houdini engine would be able to solve this problem quite easily with proper geo even, though at the moment i dont have access to this software.

              Comment


                #37
                Originally posted by MissStabby View Post
                Hmm interesting, i'm definitely going to try this out!
                The reason i want to have the holes to be dynamic is so that it is easy to populate and tweak office ceiling with lights without having to adjust the models or bsp's
                With Houdini engine would be able to solve this problem quite easily with proper geo even, though at the moment i dont have access to this software.
                We're working on it, stay tuned!

                Comment


                  #38
                  Now that i can mask my water plane, i'm trying to make it look thicker, but even if my plane is actually a thin box, once i mask it i can see inside it, there is no way that i can think of to make it look thick and not hollow

                  Can you guys think of a way to make a masked box look not hollow or is this just not possible?

                  Here is an example, once masked we can see inside the thin water surface box

                  Click image for larger version

Name:	waterplane.jpg
Views:	1
Size:	125.0 KB
ID:	1065690

                  Comment


                    #39
                    Technically a water surface has no thickness, so even if you gave it a side it wouldn't be very correct. The reason it often looks like it has a thickness is due to two effects:

                    - The very edge is often blurred because it is very close to the camera.
                    - The surface tension causes the surface to curl up where it connects to the glass.

                    Both of which are very expensive to do anywhere near accurately. However, both effects cause the edge to be less defined, while you now have a very hard edge that's distracting and calling attention to the inaccurate transition. A cheap trick to approximate this is to just alpha blend the edge for a very short distance. As your material is already translucent, and you also already calculate the distance for the mask, this should be practically free for your use case.

                    Comment


                      #40
                      Arnage!

                      By alpha blend do you mean a sort of fade out toward the player? I'm not sure how this effect would look but i could give it a try

                      This is the effect i'm after, where water seem to press against glass and creates the illusion of being thick, just as you said in your second effect example

                      Comment


                        #41
                        By the way i have noticed the same effect in the new game Dying Light while watching a stream

                        Click image for larger version

Name:	DL.jpg
Views:	1
Size:	121.2 KB
ID:	1065709

                        Comment


                          #42
                          Oh boy... This stuff hurts my brainz
                          | Finite State Machine | Savior | USQLite | Object-Pool | Sound-Occlusion | Property Transfer | Magic Nodes | MORE |

                          Comment


                            #43
                            The alpha blend tends to work good enough at an angle, but straight on you might need something more indeed. That dying light example is an interesting approach. A bit dark, but that wouldn't be a big issue in your case as your scene is quite dark anyway. I couldn't resist to prototype it a bit, here's a material function to create such a mask that you could use in the glass material of your helmet to create a similar effect:

                            Click image for larger version

Name:	WaterEdgeMask.png
Views:	1
Size:	175.1 KB
ID:	1065710

                            Comment


                              #44
                              Very interesting solution, for some reason i haven't thought about drawing the effect on the glass material instead, i wouldn't have known how to make the plane displacement match anyways, let me give your technique a try

                              Thanks!

                              Comment


                                #45
                                Originally posted by KhenaB View Post
                                Very interesting solution, for some reason i haven't thought about drawing the effect on the glass material instead, i wouldn't have known how to make the plane displacement match anyways, let me give your technique a try

                                Thanks!
                                No problem, that Dying Light screenshot seemed to add the mask in screen space, but as you need to have the helmet in front it seemed logical to add it to your world behind the glass instead. You could add another sphere just outside of the helmet to handle the mask, but that would result in two, almost screen filing, translucent objects instead of just one for the glass. So integrating it directly in the glass shader should save some performance.

                                Comment

                                Working...
                                X