Broxxar / GlowingObjectOutlines

A technique for Glowing Object Outlines in Unity.
The Unlicense
161 stars 50 forks source link

Made an optimized version #6

Closed KarlRamstedt closed 6 years ago

KarlRamstedt commented 6 years ago

A classmate used your non-CMD version in a game project we worked on. It broke lighting and was horrendously annoying to implement with several different shaders; It was a mess, so I decided to take a closer look at it. Was very happy to find your CMD version, which is just vastly superior in terms of usability. In the process of implementing it in our game I rewrote and optimized a good chunk of it. Just thought I'd spread the joy, if you're interested :)

Main code changes can be found here if you wanna read them: GlowController, GlowObject.

Broxxar commented 6 years ago

Hey there! PR's are mainly reserved for version upgrades and glaring bugs. I cannot accept a PR that removes the code covered in the video as it would make people discovering the video now (over a year later) more confused that the implementation is completely different.

This is not meant to be a robust glow system that people can plug into any project, it is strictly example code to accompany the video. The Command Buffer version was only added as a toy example after some discussion in the comments/Reddit from when the video first released.

You're more than welcome to create a more comprehensive system and host in on github/personal website, sell it on the asset store, or do basically whatever else you want (the license on the repo is permissive of pretty much everything).

All that said, I am a big fan of student games and would love to see what you and your classmates have come up with! Feel free to DM me on Twitter or something.

KarlRamstedt commented 6 years ago

I think the CMD version is structurally simpler and easier to understand, but I do understand wanting to keep the stuff related to the video around. It'll always remain in the commit history though and can be be linked at will (for example, here's your first version of the GlowObject script, which was updated in your next commit).

But regardless of what you do with that, the main thing I wanted to share was just the optimizations for the CMD version. Which (mainly) are:

Note: RenderTextureFormat.DefaultHDR on RTs is important to avoid killing effects that rely on HDR color.

These 3 improvements might be worth having a look at integrating if you don't want to accept the PR.

The only functionality(robustness) missing that I think could be useful would be support for multiple cameras, but I don't have much interest in implementing that right now as I don't have a use for it. I just wanted to optimize it as much as I could. In terms of making robust, reusable systems I'd much rather keep working on my Interaction Framework that I created for the game. Now THAT is some interesting shit :smile: It's basically a system of actions (like playing a sound/animation) that can be triggered or chained in any combination, allowing you to hot-swap behavior and create complex interactions without writing/changing any code. The base is pretty much done, I just haven't nailed down all the script names/terminology yet, nor do I have any example scenes, so I'm unsure of whether to release it on GitHub yet.

As for the game itself, after our 10 week project I wasn't happy with performance, so I went on an optimization-spree, rewriting massive parts of our code-base. Performance has taken quite the up-turn after my optimization: 100-200FPS -> 350-900FPS at 1080p on my mid-range machine. With the saved performance I was able to add a couple nice (optional) visual effects. So the game is complete and available already, but my changes aren't available yet as I am still working on finalizing a build, which has taken its sweet time since I'm the only one on the team still working on the project. I'll drop you a link when I publish the updated build on Itch. (which might be a few weeks as I might work on the Guard AI a bit during my AI course)