Ramiro Oliva, also known as Kronnect, talked about some of his assets on the Unity Store, his experience as a developer and work with digital fog in games.
Ramiro Oliva, also known as Kronnect, is a successful developer of tools for Unity Asset Store. He talked about some of his assets and developing experience, and expanded on working with digital fog in games.
My name is Ramiro Oliva, I’m a software engineer with +20 years of professional experience. I’m from Spain, 43 years old, married and have two kids. My passion for 3D and data visualization started a very long time ago in my teens when I enjoyed creating virtual environments using PovRay, coding demo scene effects and creating low-level tools in C/assembly with DJGCC such as ATILA, a generic 3D engine.
My professional career has been focused on enterprise software, mostly in R&D field as an engineer and technical director while I kept doing many side projects in my free time. They related to game and mobile development, image analysis and recognition.
It was in 2015 when I evaluated Unity as a platform for building a real-time collaborative data visualization project and soon my first asset for the platform was born: World Map Globe Edition. Since then, I’ve doubled down on Unity development as a full-time job and currently I keep evolving more than 20 assets under the Kronnect brand.
Fogs in 3D Games
As with any complex project, specific goals must be set. My view on fog is three-fold: firstly, it’s an important occlusion method which helps optimizing performance by seamlessly hiding geometry at medium/far distances (so those objects beyond a certain point can be unloaded/deactivated without the user noticing). At the same time, it increases realism, drives gameplay emotions, adds “substance” to empty spaces which otherwise could look boring. Finally, fog in 3D games also serves a functional role like the fog of war or void fog which helps focus the action on an area or helps the player move around.
In Unity, fog is added at the end of the shader pass or as a full-screen image effect which overlays or blends an amount of fog color according to the algorithm. The technique used to compute the fog amount and color varies from a simple linear or logarithmic calculation based on depth to most sophisticated and expensive physically-based approaches that use ray-marching, voxel space-partitioning and similar techniques to approximate light and shadow across the camera frustum.
Volumetric Fog & Mist Pack: How It Functions
Volumetric Fog & Mist uses a hand-optimized ray-marched algorithm to compute fog accumulation, light incidence, and dispersion across the air within camera frustum. For each ray, it modulates the opacity and color of each sample taking into account many factors like scene lights, shadows, volume shape, and self-occlusion. It creates a nice wide range of fog or mist effects from thick cloud formations to subtle animated mist over the fields or dramatic sand storms.
The asset is completed with an array of features that provides a lot of value to the developer out of the box such as fog of war, ability to place any number of fog areas, create empty areas using a fog void, support for +32 point lights even in forward rendering path, geometry mask, sky haze, sun shafts, smooth blending between zones, scripting support… to name a few.
At the core is a full-screen image effect attached to one or more cameras (multiple cameras are supported) which takes care of rendering all fog areas available in the scene. It uses both CPU and GPU culling to reduce the work amount and number of rays in the scene. Since it’s a full-screen image effect, its performance is independent of scene complexity.
It is also compatible with VR (Multi, Single Pass Stereo, and Single Pass Instanced rendering). The asset is also released for several Unity versions since the VR API has been changed. Hence Volumetric Fog & Mist is available for Unity 5.5.4, 2017.1, 2017.2, 2017.3 and 2018.3 and later. Obviously, this means a lot of effort to keep changes synced between versions, but it allows users to get the best API support for their Unity versions.
It requires neither compute shaders nor 3D textures so it’s compatible with many platforms (even modern iOS mobile devices) supporting Shader Model 3 or later.
Also, effects like Volumetric Fog & Mist tend to produce somewhat long compilation time due to the complexity and length of the shaders. To optimize that time, the asset includes the ability to scrap shader code that’s not being used according to the active feature set. It means the asset has the ability to modify the source of the shader by itself so the shader variants it produces are only those that you will need in your game at runtime, nothing else.
Finally, the package also includes a copy of Dynamic Fog & Mist which is also available as a separated fog asset and is more performant but simpler in terms of visuals. It’s a nice solution for improving the horizon or hiding far distances. Both can be combined in the same scene, for example, Dynamic Fog for improving the horizon appearance and Volumetric Fog for the rest of the effects.
Fog Effects & Light
When combining the fog effects with lighting, the challenge is to achieve a satisfying aesthetic/quality at a reduced performance impact.
Since fog effects are usually rendered as post-processing effects and are not integrated into the geometry pipeline, a realistic simulation can be expensive. To get a hyper-realistic quality you need to take into account all light types, shadows, media variation, gravity, wind, and turbulence and be able to render correctly in both short and large distances with sufficient detail while avoiding artifacts caused by low frequency color areas (banding), MSAA, transparent objects like water, particles, billboards, etc.
That means a lot of additional calculations per pixel, hence some commitments and tricks or optimizations must be done. Some lighting effects focus on adding “noise” to light frustum while others like Volumetric Fog & Mist focus on creating great-looking illuminated fog or cloud-shaped formations. Some effects focus on local areas while others are better to conceal distant landscapes or skies. Also, the way lighting influence is computed is critical to producing adequate results with many lights (Volumetric Fog & Mist can support 6, 12, 32 and even more point lights per ray in deferred and forward rendering path with minimum overhead). To reduce banding artifacts and improve performance when using many lights it uses analytic calculations for lighting influence per ray instead of sampling in each step across the ray.
In the end, there’s no single one-for-all fog solution. In fact, most projects combine several approaches.
Creating a Range of Packs for Developers
When you release tools or packs on the market, it boils down to user experience and managing user expectations.
I always put myself in the shoes of my customers while developing and testing my assets, from the description of the asset on the store to the first minutes after the installation. Testing functionality and performance is critical before releasing an asset. To ensure proper results I use a diverse number of devices including several Android and iOS mobile phones and tablets, VR devices like DK2 and Oculus Go, Mac (a laptop with integrated graphics and a top-end iMac) as well as two dedicated Windows machines with AMD and NVIDIA cards.
In addition to that, we as publishers need to test on several Unity versions. In my case, in addition to supporting the latest public version of Unity, I also ensure compatibility with Unity 5.5 or 5.6 and up. Most assets in my portfolio are, in fact, released for 2, 3 or more Unity versions to enhance compatibility.
Responsive support is equally important. Some assets are more complex than others and many Unity developers jump into the platform without knowing everything, so they usually ask for some tutorials or guidance. I really invest a lot of time into support and that includes keeping conversations and fast replies on my Discord channel, a traditional forum on my website at kronnect.com, Twitter, Youtube, and Facebook. Creating Youtube videos is in many cases a better way to reply to many complex questions by e-mail, Discord or forums as they can be leveraged by other users in the future and are more easily understood by non-English speakers.
Some of Kronnect’s Assets
Beautify uses a genuine image enhancement algorithm which improves image quality in a way you won’t want to disable it once you add it to the camera. It works out-of-the-box: just add it to the camera and it does magic. It comes with many options but the ability to have that nice improvement from the very first second is also welcome.
When developing Beautify I was really upset by the blur and dull aspect of many scenes. I wanted scenes to be vivid and intense like in real life, it’s not just increasing brightness or contrast but about adding “more detail”. So one day I was looking into the bilinear filtering and I thought: if everything has bilinear filtering by default, how would it look like if I apply something that reversed it? That was my inspiration for Beautify. After a couple of years, Beautify packs 20 combined filters which blend in the same final pass and result in better performance.
Beautify Depth of Field is inspired by “Efficiently Simulating the Bokeh of Polygonal Apertures in a Post-Process Depth of Field Shader” paper by McIntosh, Riecke, and DiPaola.
Another development aspect that worried me was productivity. I always recommend purchasing the best computer you can because you will iterate a lot during development and testing. The less time you wait while building the more time you can invest in your game. One thing everyone suffers from in Unity is the shader compilation stage. I found that due to the generic nature of assets, they tend to offer too much functionality and most compiled shaders are never used in your build so you’re wasting a lot of time and also space.
- Shader Control
Shader Control is an Editor extension that helps you find expensive shaders and allows you to remove many shader keywords. It contributes to improving your productivity by reducing build time. I have not seen a tool like this one that’s why I created it and also integrated the functionality in both Beautify and Volumetric Fog & Mist for their respective shaders.
- Highlight Plus
Highlight Plus is a selection tool which adds outline, glow (internal/external), overlay and see-through effects to any 3D object in the scene. It has been developed with platform compatibility and performance in mind so it is fully compatible with mobile devices, WebGL and other platforms. There’re other highlight tools based on screen effects but those are very expensive on mobile and they don’t support multiple cameras or VR very well out of the box.
Other assets in my portfolio are more niche although very advanced like the World Map series, effects like Global Snow and Liquid Volume, the Grid packs or frameworks like World Map Strategy Kit or Voxel Play which basically lets you create a voxel game very quickly. So I hope there’s always something interesting to pick up and speed the development of any project.
There’s a hidden but valuable benefit of creating such a diverse collection of assets: there’s a lot of feedback and experience that can be reused among assets. For example, some changes in the new Unity versions or fixes applied to certain assets help in overcoming certain limitations or similar problems in other assets. At the end of the day, the work invested in one asset helps the whole set. And ultimately that benefit ends in the hands of the users.
Ramiro Oliva/Kronnect, Software Engineer & Unity Asset Store Publisher
Interview conducted by Kirill Tokarev