After adding volumetric objects to version 1.5 of the Advanced Surface Shaders package on the Asset Store, I thought I should put together a video showing some of what can be achieved with them. Click here to watch on Youtube This video was built using the volumetric objects as of version 1.5.2. We'll be adding more options to future versions as well as more shapes, the most exciting of which is the cone volume which so far in testing is able to produce some amazing looking light shafts, particularly with fog and dust textures. You can see more of the shaders and effects over in the Advanced Surface Shaders forum thread.
Thanks lars. Version 1.5.2 is available now and also contains cone volumes which are extremely useful for creating great looking light shafts for spotlights as well as many other potential uses. Click for larger version
This looks great. I'm curious, what technique did you use for this? I played around with volumetrics in Unity a while back using replacement shaders by rendering geometry additively into depth buffers - back then front faces then summing the distances to get the depth. Worked great for any volume shape, even non convex and intersecting volumes as well as camera-in-volume correctness. The main issue I ran into was, because I was doing it with replacement shaders everything had to be the one colour or if multiple volumes overlapped it wouldn't be able to blend the colours correctly. Always wanted to revisit it but never found the time - guess I don't have to now .
Thanks Cameron. While I obviously don't want to give all the details away here (owners of the package are of course free to check out the source), the current volumetric objects in the package (cube, sphere, cone) are actually only basic mesh objects (cubes at the moment) and the shape of the volume is created in the shader. Info about the shape is passed to the shader and raycasting is done on the GPU to determine if a pixel is within the volume and the distance the ray travels through the volume. The texturing inside the volume involves ray marching. I have started experimenting with applying volumetric effects to any geometry and it can be pretty cool too. I'll need to switch gears for a week or two with this package and focus on more shader variations for mobile platforms, but after that I'll look into adding support for arbitrary geometry. I think the use cases for that are far less common than those involving the 3 shapes available now though. Box fog volumes and light shafts are pretty commonly useful and awesome .
Thanks for the info, totally different approach to what I was doing - which was based on Nvidia's Fog Polygon Volumes paper. Not as advanced as what you're doing, loving the world space sampled textures.
Yeah, some similarities, but different. You approach was looking pretty cool. Volumetric rendering must be something Brisbane devs like to do. I'll probably see you next week at the Brisbane Indie Dev meetup .
I am very interested. Do you have any benchmarks (eg. Angrybot) running on mobile platform? I just want to know roughly how expensive this is on a mobile platform. Also, I have a suggestion - would be it possible to implement an option to extend the fog volume (and shape) to conform to the volume where it is in? eg. if you place it in a let's say pyramid shape room with the tick of an option, it will automatically conform to the shape and size of the room. Also does it support different fog/texture effects? Eg. can I load custom fog textures?
Amazing! That made the angry bots level a billion times better and more lifelike. Very subtle but really gives it that extra push in the right direction. Great work