Announcement

Collapse
No announcement yet.

Dynamic blob shadow ?

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

    #46
    Try the oversized box method I mentioned above, and scale the Z down to be the "maximum cast distance" so it looks like your character is standing on tall platform boxes. Then you can do a few things to improve it:

    1) use worldposition behind translucency XY so the shadow is always on the floor below the character, the box just has to be long enough. You could also use a line trace to dynamically reposition the shadow but I wouldn't go down the route, I'd more make the effect a local thing that fades out since it would be cheaper and less unpredictable.

    2) by using the worldpos behind translucency Z and then using the cube shadows local bounds to normalize, you can create a fading effect that can both fade the alpha and fade to a separate wider/blurrier image (try channel packing 2-3 levels of blur) so that the shadows soften as they fade out.
    Ryan Brucks
    Principal Technical Artist, Epic Games

    Comment


      #47
      Hitting the wall here again (probably because I don't get along with shaders)

      Ryan, I don't mean to sound like a total d!ck (after your wrote down how to resolve it), but would it be possible if you could just modify my material to get it working per your specs and post it here? I am sure whole a lot of people would find it quite useful.

      Comment


        #48
        Yeah it would be great to have a cheap fake shadow example...
        Edge of Chaos RTS
        "Age of Total Heroes" - RTS Pathfinding and Movement System for UE4
        RTS Camera C++ Tutorial

        Comment


          #49
          Originally posted by sivan View Post
          Yeah it would be great to have a cheap fake shadow example...
          What I posted works, but not quite there yet because it clips into geometry and only works on the fixed Z of the world space.

          Comment


            #50
            I see, but I use landscape and some stairs beside flat surfaces...
            Edge of Chaos RTS
            "Age of Total Heroes" - RTS Pathfinding and Movement System for UE4
            RTS Camera C++ Tutorial

            Comment


              #51
              [MENTION=3692]RyanB[/MENTION]: Do you think you could make modifications to my material so we all could use it and learn from it? (or maybe a clean new material?)

              Thanks

              Comment


                #52
                I am sorry but I do not have time.
                Ryan Brucks
                Principal Technical Artist, Epic Games

                Comment


                  #53
                  Chiming in to say that this would be great. Understand RyanB is busy, but if any experienced technical artists could enlighten the rest of us plebs we would all be grateful. x
                  vr and new media installations
                  www.samuelwalker.xyz

                  Comment


                    #54
                    [MENTION=1680]motorsep[/MENTION] : I looked back at this thread and I noticed a mistake in the blueprint network: Per tick you create a new material instance. Instead you should create one material instance in the Construction Script and save the reference to a variable. Then you can change the parameters of the material instance per tick by referring to it via the variable.

                    Comment


                      #55
                      Originally posted by xDiavalx View Post
                      Instead you should create one material instance in the Construction Script and save the reference to a variable. Then you can change the parameters of the material instance per tick by referring to it via the variable.
                      How would I do that precisely? (sorry, I am not that proficient in Blueprint yet)

                      Thanks

                      Comment


                        #56
                        [MENTION=1680]motorsep[/MENTION] :
                        In construction script:
                        Click image for larger version

Name:	Capture.PNG
Views:	1
Size:	65.6 KB
ID:	1119792

                        Rightclick on the return pin and promote to variable to get the variable.
                        (Note that your variables will be different. I assign the seccond material slot, for example.)

                        In the Event Graph, you do the same as you did, but rip out the create material instance nodes and replace their references with the variable. (Drag the variable in, select "Get" and plug that into target.)

                        Also remove the "Set World Rotation" nodes. Those are for positioning stuff (geometry/components) inside the world. What you need to do is give the X Y and Z position of the center of your shadow (basically your hit location) to the Material via blueprint and then in the material you put a sphere mask at this position and compare that against you pixels' world position to generate a mask. - I will work it out for my own project and share a bit later (probably Monday).
                        Last edited by xDiavalx; 12-09-2016, 11:21 AM.

                        Comment


                          #57
                          In the material you basically need this:
                          Click image for larger version

Name:	Capture2.PNG
Views:	1
Size:	66.9 KB
ID:	1119796
                          the output of the SphereMask is your mask. Probably neet to 1-x and then multply it with your ground shader parts that you want to darken.
                          Hardness is how hard your shadow is.
                          Radius is the radius of the shadow.
                          PrimeLocation is the parameter you set with the blueprint. (X Y Z and the alpha is kinda wasted, but you could use it for something else. You can set a vector parameter instead of a float parameter, with a different blueprint node.)

                          Comment


                            #58
                            Originally posted by xDiavalx View Post
                            [MENTION=1680]motorsep[/MENTION] :
                            Also remove the "Set World Rotation" nodes. Those are for positioning stuff (geometry/components) inside the world. What you need to do is give the X Y and Z position of the center of your shadow (basically your hit location) to the Material via blueprint and then in the material you put a sphere mask at this position and compare that against you pixels' world position to generate a mask. - I will work it out for my own project and share a bit later (probably Monday).
                            That would great, thanks. I am not a material guy per se (come from pre-PBR, pre-shaders era), so all that stuff RyanB talked about just boggles my mind :P

                            Comment


                              #59
                              [MENTION=3692]RyanB[/MENTION] :
                              1.a.:Are Sphere_AO and SphereMask the same thing (under the hood)? - I guess SphereMask also has a built-in power function (to control the "Hardness").
                              1.b.: Is SphereMask as expensive as Sphere_AO with a power node and its position calculation tweaked?

                              2.a.: If I understood you correctly, the WorldSpaceBehindTranslucency method is performance equivalent to a decal actor, but has the advantage that it is possible to optimize the mesh shape (which saves on overdraw). Is this still correct? Are decal actors not more optimized, because they are built for the specific purpose?
                              2.b.: I can copy the WorldSpaceBehindTranslucency method from the Showdown VR demo, so this is not very important to me, but I suggest Epic could use the subUV-cut-out tech that you use for particles and apply it on decal meshes (as an opt-in option). Does that sound like a good idea?
                              2.c.: I compared the system suggested in 2.b. with the new decal mesh feature. And as far as I understand decal meshes derive their projection direction from their vertex or point normals. Is that correct?

                              3. How is the new forward render (theoretically) affecting the WorldSpaceBehindTranslucency and the decal method performance wise?

                              [MENTION=1680]motorsep[/MENTION]: You can get the CouchKnight project and look at the blueprint of the playable character (the knight girl). It has decals attached to its feet that function as shadows. You should try using that method.

                              If that doesn't work, you can get the showdown VR demo and look at the Robot blueprint in the scene. There is BlobShadow1 through 4 static meshes with an instance of the WorldSpaceBehindTranslucency material set up. I guess it is best if you just copy that.

                              Comment


                                #60
                                Originally posted by RyanB View Post
                                For bullettrain I solved it another way, using the vertex shader to shrink to the foot position and then re-expand along flattened local vectors.
                                Could you elaborate on this? - I am not quite clear on what this solves or where it is implemented. (Is this in the floor material or in meshes attached to the soldiers' feet?)

                                Is there any chance the Bullettrain project will be shared?

                                Originally posted by RyanB View Post
                                To support slopes the easiest method is oversized geometry and using the worldposition behind translucency.
                                Any ideas on how to support a very uneven surface with huge mesh gaps at 90degree angles?
                                I was considering using the WorldSpaceBehindTranslucency method with a height-fade based on worldposition (assuming that the actual movement of the shadow happens in a plane of a fixed height).

                                Comment

                                Working...
                                X