Monday, March 4, 2013

InstantC 1.5 submitted to the Asset Store

Time for an update, InstantOC 1.5 comes with the following change-log:

Reduced flickering

Greatly improved stability of distant/sparse objects, no more flickering also with low sample values.
Objects that are going to hide themselves after the "hide delay" time, will do a last check to see if they can "see" the main camera, if not, they proceed hiding, else, they remain visible.

Easier setup

Added ability to automatically attach the IOClod component to objects at startup based on TAG, so You now add it manually only if You want to override global settings

Bug-fixing of IOChud component and Prefab

A special thanks to Guido Henkel for finding this two bugs in the IOChud component and Prefab.
The IOChud Prefab had a missing reference to the IOChud script (:-P).
The IOChud component was assuming the presence of a MouseLook script attached to the camera, thus firing an error if that was not the case.

Thursday, February 14, 2013

Monday, February 11, 2013

InstantOC 1.4 submitted to the Asset Store

InstantOC 1.4 comes with the following change-log:

Improved ray-casting algorithm (Quasi Random Halton sequence)

I changed the generation of rays from the Pseudo Random method of Unity (Random.value) to a Quasi Random method. It's the Halton sequence, this way the rays fired will cover the screen pixels faster, with less double rays (same pixel hit more than one time). This results in slighter popping of distant/sparse objects. It's noticeable mostly with low sample and hide-delay values, but honestly, I would have expected a bigger improvement. Because the Halton sequence method was a little slower than the integrated Random.value, InstantOC 1.4 creates an array of screen coordinates at startup, and the ray-casting iterates fast through it, hitting screen pixels in this "low-discrepacy" fashion thanks to the Halton sequence.
Result: occlusion culling is now slightly more efficient and with less overhead.



Left: 256 rays fired with the Halton method (Quasi Random)
Right: 256 rays fired with a Unity Random.value-like method (Pseudo Random)

Improved IOClod component

InstantOC 1.3 used coroutines to check if an object had to be hidden, and/or support the realtime shadows. It turned out, with really many objects coroutines were not so efficient. So now InstantOC 1.4 does his checks in the Update method, but only every x frames. It feels smoother and is more scalable.

Improved IOChud Prefab usability

Thanks to Ciro Continisio of Tiny Colossus for his usability hint, IOChud Prefab now lets you change InstantOC options temporarily disabling mouse-look! :-P

Bug-fixing of IOChud component

There was a bug in InstantOC 1.3 IOChud that caused degenerative loss of performance, while tweaking the options, it's solved now.

Wednesday, February 6, 2013

InstantOC bug hunting

There is a bug in InstantOC 1.3 in the 'IOChud' helper prefab.
Tweaking the options at runtime through the hud GUI slowly degrades the performance of InstantOC.
Toggling InstantOC on and off with the 'I' key should reset expected performance.
This bug does NOT AFFECT correct behavior of InstantOC in final builds (scenes without IOChud prefab).
I apologies for the inconvenience, currently working on the solution.
Stay tuned!

Tuesday, February 5, 2013

InstantOC 1.3 now live on the Asset Store!

The guys behind the Unity Asset Store are really awesome.
2.5 days, and boom! InstantOC 1.3 is live on the Store.

- full support of realtime shadows (for Unity Pro)
- various core optimizations
- updated sample scene

The tricky part was to let invisible objects correctly cast shadows without blowing up the performance gain.
In the InstantOC 1.3 beta I posted earlier, there was still a performance gain, but not so super awesome as before (without the realtime shadows support). In the WebPlayer demo with 5000 houses for instance, the fps with IOC enabled were about 26-28 and without IOC they dropped to below 3.
But it wasn't enough! Before realtime shadows they were 57-59! Ok there is the overhead of the shadows, but still I wanted more :-)
So the trick was to swap the shader of occluded objects with an invisible one that could cast shadows, only if they were "near" the player (a little bit more than the shadow distance setting).
All other "distant" objects would have been disabled (the renderer) as before.
This way the previous performance boost was nicely restored.