• Register
Post news RSS Distortions, Explosion Rings, and Sorting

Found (and worked around) a quirky issue with Unity's rendering, and got our explosion rings back in the process. Detonators are cool again!

Posted by on

Found an interesting bug on friday.

So, when a detonator explodes, it sets off all the blocks of matching color, and you get your chain reaction string of explosions. Cool. The detonator itself gets an extra bonus effect. Firstly, it gets a shockwave ring of whatever color the detonator itself was. Secondly, it gets a distortion ring that continues further out than that, which causes that next-gen framebuffer ripple everybody loves. The bug was, only the distortion was showing up.

Distortion Ring & Explosion Ring

At first I couldn't even replicate the problem. Turns out, this only showed up after the guy making the Steam build deleted their Unity library folder and re-compiled everything, so something changed with the asset. We moved to 5.2.1f1 recently so odds are something's different with assets in that version.

Looking at the shader I was expecting to find that one of them depth writes and this was simply an ordering issue that wasn't visible before, but no such luck. Both the visible ring and the distortion ring do not use the depth buffer. Eventually I noticed that if I went into the Unity scene view and moved one of the objects both would show up just fine.

That suggested a sorting problem, so I tried moving the visible ring into a queue one higher, but still it didn't show up. Ten higher didn't work either. Changing the mesh didn't even make a difference. Really, really strange.

So ultimately how did this get fixed? By adding one thousandth of a unit to the Z position. Everything's fine after that. This feels like it's probably a gotcha with Unity's sorting at the moment, as I couldn't find any reason for it in any of the assets. It's interesting that it's asset dependent though, when using leftover assets from the previous version of Unity this wasn't a problem.

Anyway, that having been sorted we're down to only one known issue, which should get fixed monday. It's also a Unity quick, in that setting resolution in-game seems broken in DX9 mode in 5.2. Steam says about 20% of players use DX9 so we'd rather not just punt on it. We'll probably prompt the user to restart the game when they do a resolution change in DX9, for now.

Hopefully, that'll take us to ship. Anode's fun and looking good, and we've smoothed out everything else we're aware of at the moment.

Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.