Researching a replacement for dynamic shadows continued…

I am still playing Nier: Automata so you will get a few of these pics for a bit.

A while back, I posted an article about researching a replacement for dynamic shadows.

On projects I have worked on we often default to using dynamic shadows to make stuff look good, but they can kill our performance on mobile. In order to hit the 60 FPS mark (or sometimes even 30) theya re one of the things we turn off. We then replace them with blob shadows, which are OK, but are still not as performant as we may like I found this advanced technique called graphics command buffers and a sample that includes decals in deferred shading. Decals are quite a nice way of creating blob shadows.
I have since knocked up a super quick test bed to see the difference between real time shadows, projectors and decal textures.
Realtime shadows:
Projector:
Decals:
And here are there corresponding BASIC stats:
Real time shadows:
Projector Blob Shadows:
Decal blob shadows:
Again, this is only a cursory test, but so far the decal blob shadows are edging out on the number of tri, batches and overall framerate. Of course this is needed to be taken with a pinch of salt and needs to be profiled more in other scenarios, however as a starting point it looks promising.
My next step is to see if I can create real time shadows using render textures and combine it with the decal techinque.
There is a warning here though that at time of writing this technique only supports deferred rendering and not ALL mobile gpus support it. However, I will press on and get a better overview of what hardware is affected, and come up with an alternative for that.

Very Simple Obscuring Object Culling

This little trick is from something that I worked on that involved robots. So I added the Robot from Infinite Warfare (a game which I have, but need to actually finish… like all my other games!). Essentially there was a character that moved around an environment and attacked enemies. The problem was he sometimes got obscured by the environment. As it was a prototype, I made the quickest and dirtiest thing I could and whacked it in.

As the diagram shows above I raycasted from the camer to the player character. If the raycast hits anything marked “Obstacle” or equivalent term the object is deactivated.

This is SUPPPEEERRR basic. There are some cleverer things you can do like do a box cast and seeing how much an object is inside the box cast and fade it out, but if you need to get somehting up and running quickly then this is a quick and dirty implementation.

Script Debugging Android Games in Visual Studio

It is common knowledge that I work on mobile games and of course Android is one of the¬†platforms we develop on. And from time to time we need to break point our code whilst it is running on device. Today however, I couldn’t remember how you do it. So I headed over to the Unity Manual, but there was lack of information how to do this in Visual Studio. It tells you how to easily attach to the MonoDevelop debugger, but not the Visual Studio one.¬†So we went looking for a way to do it. Unity Answers post does tell you how to do it, but it isn’t particularly well worded and also starts of with “I just went back to MonoDevelop” which quickly makes you stop reading the rest of his/her answer.

This is how you do it.

First follow the steps on this page of the manual:

https://docs.unity3d.com/Manual/AttachingMonoDevelopDebuggerToAnAndroidDevice.html

Then in Visual Studio go to the following menu:

debugger

In the next Window you should see “Android Player” (you don’t see it in the next image because I am not currently working in an Android project, but hopefully the giant arrow will help).

androidplayer

 

If you have an IP of a device you can also input it here. This also works for some of the other platforms including some of the consoles.