Real-time Shadow Optimization

Hi,

I am using real-time shadows in my iOS game. It is a 3D action game.
There is only one directional light that casts real-time shadows.
My game runs well with 60 FPS. But my iPhone 6 is a little bit heating up.

Now, I am considering what are appropriate methods to optimize real-time shadows.
I am a big fan of real-time shadow, and I want to keep using it.
I have already reduced the global shadow distance and shadow resolution.

If I manually set many objects (Skinned Mesh Renderer, or Mesh Render) do NOT cast or receive shadows, this will dramatically improves the performance?

Why do you want to optimize if you have 60fps? Afaik it is not possible to prevent it from heating up, or do you know any 3D game where it doesn’t do that? I remember this to be a thing that was discussed as a reason why it makes no sense to use an opengl based 2D engine like Cocos2D for an app, if visually you don’t want to go beyond what the standard APIs for non-game apps provide.

I am sorry that I didn’t completely understand what you mean.
You mean if an app (3D or 2D game) runs at 60 FPS (not 30 FPS), the app always causes heating up issue?
You mentioned some discussions about this issue. Would you paste the related posts/articles into this thread?

1 Like

Exactly.

Can’t quote it here, it was years ago and on another forum (Cocos2D forum). Generally I think every 60fps openGL game will heat up your phone, but I don’t even own a smartphone so you might want to double-check that, just in case.

@Martin_H @Dan2013
Well, yes, any game made in unity3d will use processing power and that will warm/heat up your phone/tablet/pc/console. If you’re at 60 fps, that’s great. But if it’s using 100% of the cpu/gpu to do it and after optimization it would be 50% of the cpu/gpu, heat generation would be reduced and battery life would be improved.

@ your question;

Yes. It would improve performance (and therefore cpu/gpu usage if at fps cap). If it’s dramatic or not determines on your interpretation of dramatic and how much the shadow rendering costs. Another things to look out for is shadow cascades, as it’s basically acting like 2 or 4 lights with it turned on.

A last thing to look into is to see if your can bake the lighting for some objects and use the dynamic lighting for only the dynamic objects, but that depends a lot on game specifics.

1 Like

Thanks, I didn’t know that.

@Martin_H @Dan2013

Sorry, made a mistake:

I had no idea =(

Thanks for suggestions.
Actually, there is only one light in my scene.
It is a directional light.
It casts real-time shadows.

I’ve used realtime shadows on vita and mobile - it’s fine and realtime shadows are perfectly acceptable performance on these devices. Using skinned or normal meshes as caster/receiver won’t make much of a difference.

The big wins are from having a reduced range, and ensuring that you have as few meshes casting as you can get away with. Receiving in forward doesn’t really make too much difference.

The heating up thing is likely because it’s doing more work. You could cap the framerate to 30, and this would ensure it would do half the work. Really, capping framerate is pretty much the only thing you can do to lower heat in a situation like this. Have a menu option?

Ensure vsync is on, just in case.

1 Like

@hippocoder

Thanks for your suggestions.
Under quality tab of my game, “V Sync Count” is already set as “Every V Blank”.

When I set my game runs at 30 FPS, I always feel it is not smooth enough.
If I try to run an action game at 30 FPS, how would I make it looks smoother?

I also want to set the global state of “Shadow Distance” as 120~140, since I really want things like trees or obelisks to cast shadows to floor and characters. My game is a top-down Diablo-like action game. All particle systems (for ice/fire balls) in the game have “Max Particles” set less than 4.

Now, my plan is to manually modify all created scenes based on following rules:

  1. Keep static things like trees or obelisks casting real-time shadows, but not receiving real-time shadows.
  2. Moving characters do not cast real-time shadows (use faked shadows like black transparent quad instead). Moving characters receive real-time shadows.
    If I do these manual optimizations, will the performance be dramatically improved? Less heating up?

2369344--160903--PefTest.jpg

Smoothness at 30fps is achieved entirely from high quality motion blur. You could actually use amplify motion - it does have a lot of scalability.

Thing is you’re worrying about 60fps but most people will play it from 20 to any amount really depending on phone. Is it worth the worry?

@hippocoder
Thanks for your suggestion.

Amplify Motion is this asset?
https://www.assetstore.unity3d.com/en/#!/content/4243
I bought and tried Amplify Motion. I am still doing research on it.

There are some 60 FPS action/arcade games.
For example, this Mountain Goat game below runs at 60 FPS by default. It has explicit FPS options of 20, 30, 60 FPS. All moving things run much smoother in 60 FPS than in 30 FPS in this game.
https://itunes.apple.com/us/app/mountain-goat-mountain/id979415701?mt=8

I was doing testing all the time. I found those factors below are most important ones for heating up.
30 FPS vs 60 FPS (seems the most important factor)
polygon number (decided by model number)
real-time shadow

All phones heat up under stress if they can sustain 60fps. Simply because its doing more work.