Dynamic blob shadow ?

As you may know, dynamic shadowing in mobile VR is a no-go.

Is there a way to have super basic blob shadows under the character?

In idTech 4 engine (Doom 3) there was a special type of light called blend light. You could create a blob shadow image and have it projected under character’s feet (light source would be attached to the character to follow around). Is something similar (or better and as cheap, performance wise) possible with UE4 ?

Thanks.

Im pretty sure 4.11 has introduced this to capsule components or something similar.

Yeah, saw that, but I don’t know if it will perform well in mobile VR.

You can use either a decal or the material function “world position behind translucency” to map a blob shadow that is attached to your character to the ground.

Which one is less performance taxing out of those two?

Are there any tutorials about either of those methods? (I am quite new to UE4)

Thanks.

well the ‘Worldpos behind translucency’ is in theory able to work on lower spec since it will not require gbuffer or decals to be enabled. If they are enabled I would expect a pretty similar cost for both methods but haven’t compared. I would probably use translucency for simplicity as well but thats just me.

Aye, but Google returns nothing about “world position behind translucency” :confused:

I found a link to blob shadows with UDK UDK | DevelopmentKitGemsCreatingASimpleBlobShadow but not sure if it’s translatable into UE4 as is (except Unreal script part).

noob question, in what context are you referring to with regards to the material function of blob shadow for “world position behind translucency” method? do you mean like a separate static mesh attached?

When you draw transparent object you can get world position from pixel behind it using “world position behind translucency” node. If you know position of shadow caster and receiver you can easily calculate blob shadow analytically. There is Sphere_AO node that you can use.

thanks! learnt something new

Would that be performance taxing in mobile VR ?

Not especially, but it will depend on how conservative you are with your mesh sizes and overdraw etc . I prefer the wpo-behind-translucency since it lets you cut your geo closer to your alpha to get to optimize the overdraw a bit more than you can do using a decal.

Aye, sounds almost like reading John Carmack’s twitter :stuck_out_tongue: I totally have no clue what you just said, , sorry :slight_smile:

I am surprised no tutorials available on this subject :frowning:

Overdraw is simply where multiple layers of translucency stack on screen. If your translucent material had black in the alpha, that means that parts of the material were “rendered” only to be invisible in the final result. Even though those pixels were invisible, they cost just as much as the visible pixels. So you can see how if you have a HUGE polygon just to have a small translucent effect, it will be very inefficient. Making the geometry fit closely around only the visible parts of your opacity mask is something you should always do when possible.

For instance if you have a blob shadow (round), then all of the corners of a square polygon are going to be wasted overdraw. Simply turning the quad into an octagon by cutting a bit off all of the corners will make a big difference and save many wasted pixels from rendering. You could tesellate more and more to reduce overdraw but at some point you would start causing the scene to be too expensive from polygons so it is best to find some middle ground. Ie just making the shape an octagon is a good compromise because its still low poly and cuts away most of the overdraw.

For a circle or blob shadow you could calculate the savings.

A square of pixels 100x100 has an area of 10,000 pixels that all have to be rendered.
A circle with a diameter of 100 has an area of only 7,853. So by rendering a circle using square geometry you would be wasting ~1,200 pixels or 12% of the cost. This is probably not a huge deal in this case but for some shapes it can make a huge difference.

for particle systems, a feature was recently added to cut out the geomtry specifically for subUVs automatically for particle systems. Probably 4.12.

Alright, thanks. Make sense. How do I set up the whole thing?

I assume I need to make octagon mesh with my black’ish blob image on it, bring it to UE4, attach it to the character at character’s feet and make it not show in the game. How do I set up material for it, so it’s “projected” to the floor/ground? Or is it a blueprint setup?

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.

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/uploads/2011/09/Shadowgun_Unite2011.pdf page 27.

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

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.

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.