unity: hunting for performance (again)

During this week, since we started creating the first alpha builds, we ran again into some performance issues. Unity is not that great in case of performance, but it’s not as easy as only blaming the technology. We wrote earlier about soe of these issues. So again, the mirror reflections were causing some heavy load on the drawcalls. So what we did was organize the scene better into layers, because to show correct reflections, only the player, the level and the surrounding foilage of the oasis have to be reflected, which are about 5 objects. So if you organize that properly, mirror reflection won’t be a problem at all. (we hab almost our entire scene get rendered twice before)

drawcalls_reflections

Second thing is batching things together. Our main objects  were these spike traps, which are animated if you run into them and runes, that are animated to make them better visible. So the first and most straightforward idea was to model a spike trap, give it a collider and animate it if this is hit. But this results in one drawcall per object, which is very bad. Since the unity batcher has some limitations and cannot batch things that are animated we had to bundle them.

drawcalls_01

So now ten spike traps are in one object, and controlled by bones, where each bones has a seperate collider (see next image). Then each bones animation (simple scale) is controlled by a script, so we didn’t have to create ten animations (one for each bone). This now reduced our drawcalls massively, so that we ar now at something like 800, which is still a lot.

drawcalls_bundling

Advertisements
Dieser Beitrag wurde unter Caravan, Ingame veröffentlicht. Setze ein Lesezeichen auf den Permalink.

Kommentar verfassen

Trage deine Daten unten ein oder klicke ein Icon um dich einzuloggen:

WordPress.com-Logo

Du kommentierst mit Deinem WordPress.com-Konto. Abmelden / Ändern )

Twitter-Bild

Du kommentierst mit Deinem Twitter-Konto. Abmelden / Ändern )

Facebook-Foto

Du kommentierst mit Deinem Facebook-Konto. Abmelden / Ändern )

Google+ Foto

Du kommentierst mit Deinem Google+-Konto. Abmelden / Ändern )

Verbinde mit %s