How to create shader that fades based on two different connecting surface angles

Started by
4 comments, last by Radikalizm 8 years, 6 months ago
I'm working with Unity 5.x and trying create a shader that creates shadows at the edges of voxels similar to games like Trove and CubeWorld. You can see in this image below from my game (first image) that the shading between voxels is simply not there even with additional light sources. I believe that games like trove (second image) and cube world (third image) use a shader that creates a shadow between two voxels based on whether the two surfaces are meeting on converging right angles. Does anyone know how one would attain this effect in writing a unity shader? Right now I'm using the unity standard shader.
[attachment=29376:shadbetweenboxes.png]
Notice the shadow at the corner of two voxel surfaces, there is always a fading shadow at each voxel on two different planes.
[attachment=29377:shader2.png]
Here you can see two the same effect, there is a shadow at the edge of two different angles as the shadow fades.
[attachment=29378:shader3.png]
Advertisement

It looks like ambient occlusion.

Almost certainly what MarkS said. OP can check the following link for details on using ambient occlusion (via SSAO) in Unity: http://docs.unity3d.com/Manual/script-ScreenSpaceAmbientOcclusion.html

Sean Middleditch – Game Systems Engineer – Join my team!

Yes that's it, thanks. Unfortunately the Unity SSAO is almost useless so I'll have to find another solution or write my own Minecraft like AO.

Was reading through this, http://0fps.net/2013/07/03/ambient-occlusion-for-minecraft-like-worlds/, looks like it isn't too hard but within Unity sort of stuck on how to us a shader to go through the voxels or somehow join my chunkmeshcreator with the shader(?) blink.png

Unfortunately the Unity SSAO is almost useless...


Why do you say that? I missed the "Unity" part. Sorry.

A potentially cheaper solution would be to bake your AO into your vertex colors if you're dealing with cubes anyway. SSAO sounds like overkill for this situation.

I gets all your texture budgets!

This topic is closed to new replies.

Advertisement