Announcement

Collapse
No announcement yet.

Dynamic blob shadow ?

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

    #16
    There is no set way to do it, but here is one way you can do it.

    Start with a box mesh for now. Set the location to be roughly at your players feet and have the box be tall enough that it still stick all the way into the floor when your character stands on the steepest surface commonly found in your game.

    Then in your material simply do WorldPositionBehindTranslucency and component mask for R,G and then subtract ObjectPosition.

    That will give you coordinates centered on the characters feet where the center is 0. Now all we have to do is scale it to fit and bias so that 0.5 is the center for texture coordinates.

    So divide by object radius, this should give you coordinates roughly going -1 to 1. Also put a multiply or divide by scalar parameter here for hand adjustment. Then multiply by 0.5 and add 1 to get centered coordinates.

    Then just hook up the result as the UVs of any round alpha texture. There are a bunch of such textures in the engine content directory with various falloffs under the engine volumetrics folder.
    Ryan Brucks
    Principal Technical Artist, Epic Games

    Comment


      #17
      Using dynamic material instance you could even send couple capsules as vector parameters and calculate bit more accurate blob shadow that account player bone movement. This way you get nice dynamic animation for blob.
      http://blogs.unity3d.com/wp-content/..._Unite2011.pdf page 27.

      Comment


        #18
        I haven't made any complex materials in UE4 yet, so I'd be happy to conquer RyanB's method first. Plus, in mobile VR everything counts, so I am sure while Shadowgun's shadows are neat, they require slightly more computation.

        Comment


          #19
          fwiw the engine now supports dynamic soft shadows using a capsule like approach for indirect lighting. It is probably not the cheapest option for VR but the option is there for those curious. I believe 4.11 but I might be wrong about that.
          Ryan Brucks
          Principal Technical Artist, Epic Games

          Comment


            #20
            Originally posted by motorsep View Post
            I haven't made any complex materials in UE4 yet, so I'd be happy to conquer RyanB's method first. Plus, in mobile VR everything counts, so I am sure while Shadowgun's shadows are neat, they require slightly more computation.
            Shadowgun is mobile game from 2011 era. If that method works for them then it's work everywhere. Performance using texture vs 3 bones is quite similar.

            Comment


              #21
              I've been working a lot with movable characters lately, and while the feature to have capsule shadows is very nice, it is unfortunately more or less unusable in the majority of cases. For instance, most my characters get half their head lit up, and the rest goes completely black. I have the correct physics assets, but it looks really bad. Maybe you could add a slider to adjust the amount of shadow that is added or something simiilar, unless it's possible to get better quality.
              http://www.pixelpirates.se/
              Architectural and product visualisations

              Comment


                #22
                Btw, Showdown has blob shadows. Would those be mobile VR friendly?

                Comment


                  #23
                  The material will not be very expensive, but as with everything it depends on your overall scene budget and what you have room to render. If your scene is already very expensive then you may have to make room. Use profilegpu before and after adding these effects to gauge effect.
                  Ryan Brucks
                  Principal Technical Artist, Epic Games

                  Comment


                    #24
                    Originally posted by RyanB View Post
                    The material will not be very expensive, but as with everything it depends on your overall scene budget and what you have room to render. If your scene is already very expensive then you may have to make room. Use profilegpu before and after adding these effects to gauge effect.
                    I guess what I wanted to ask if Showdown's blob shadows are essentially the same as Unity's Shadowrun blob shadows (same look, as cheap performance wise).

                    Scene budget is 60 drawcalls and 100k tris (Oculus never specified, but I assume it's in the view, not the whole level).

                    Comment


                      #25
                      I'm not really in a position to comment on anything unity related. I've never even seen the unity editor.

                      With 60 draw calls you will have to choose your draw calls carefully. If you need to draw lots of blob shadows you could perhaps batch them and use vertex shader to map them to individual characters or something like that to use less draw calls. You would basically use vertex color or some other bakeable attribute to select which ones go where.
                      Ryan Brucks
                      Principal Technical Artist, Epic Games

                      Comment


                        #26
                        I've made something like this for Chasing Robbers:



                        and result:
                        Realtime Database Firebase | Ultimate Mobile Kit Firebase | Extended Facebook | Universal Mobile Ads | Google Analytics

                        Comment


                          #27
                          So, I finally got to the point where I have characters (simple animated actors) in my scene, and I loaded up Showdown demo to see how it's made. For once, there are no bipedal characters. So the only show that was there was from the big bad robot. It's the engine's sphere with blob textures on it and some really weird spaghetti material setup It certainly doesn't look like Shadowgun's blob shadow at all :/

                          Comment


                            #28
                            Originally posted by Kalle_H View Post
                            Shadowgun is mobile game from 2011 era. If that method works for them then it's work everywhere. Performance using texture vs 3 bones is quite similar.
                            They used this http://www.iquilezles.org/www/articl...o/sphereao.htm

                            Care to elaborate how to replicate all that in UE4 and yet have it working super fast on mobile? (I also sent you a PM )

                            Comment


                              #29
                              You could just copy/paste shader toy sphere occlusion function to custom node. https://www.shadertoy.com/view/4djSDy
                              Code:
                              // Sphere occlusion
                              float sphOcclusion( in vec3 pos, in vec3 nor, in vec4 sph )
                              {
                                  vec3  di = sph.xyz - pos;
                                  float l  = length(di);
                                  float nl = dot(nor,di/l);
                                  float h  = l/sph.w;
                                  float h2 = h*h;
                                  float k2 = 1.0 - h2*nl*nl;
                              
                                  // above/below horizon: Quilez - http://iquilezles.org/www/articles/sphereao/sphereao.htm
                                  float res = max(0.0,nl)/h2;
                                  // intersecting horizon: Lagarde/de Rousiers - http://www.frostbite.com/wp-content/uploads/2014/11/course_notes_moving_frostbite_to_pbr.pdf
                                  if( k2 > 0.0 ) 
                                  {
                                      #if 1
                                          res = nl*acos(-nl*sqrt( (h2-1.0)/(1.0-nl*nl) )) - sqrt(k2*(h2-1.0));
                                          res = res/h2 + atan( sqrt(k2/(h2-1.0)));
                                          res /= 3.141593;
                                      #else
                                          // cheap approximation: Quilez
                                          res = pow( clamp(0.5*(nl*h+1.0)/h2,0.0,1.0), 1.5 );
                                      #endif
                                  }
                              
                                  return res;
                              }

                              Comment


                                #30
                                [MENTION=348483]Kalle_H[/MENTION]: So, I would make a sphere, attach it to the character's feet bones and origin bone, and apply that custom node material and be done ?

                                Comment

                                Working...
                                X