- Home /
Shade effect
Hi! First of all, this is my first post so feel free to tell me if there's anything I'm doing wrong. Also English is not my main language, apologies. Anyway I want to create a shading effect as you can (kinda) see here with a dark hole in this box, currently it's just five transparent black cubes after each other, which is obviously not the correct way to do this. The idea is that this box will spawn items that come out of this hole and I thought this was a good way to prevent the player from seeing the objects being instantiated. I've tried lighting, post processing, but I can't seem to find a good way to do this. Any help is much appreciated!
Answer by gernomino · May 15 at 01:48 PM
To make the shading smooth with a single box, you could create a custom shader and material that has more transparency in certain spots, for instance using its local axis. Then apply the material to the black box. Not sure how dynamic this could be. I've only ever made one or two shaders and that was a few years ago.
This is essentially the same logic you'd use if you were writing a water shader. The further down or across it is, the less transparent it is. This url looks like it might be a good resource. https://www.noveltech.dev/unity-simple-water-shader-shadergraph
Another option would be to forgo the smoothing and create a simple black plane. If you ever played Borderlands, this is what they actually for where enemies spawn. The spawn locations have a black plane with little decoration around its borders to 'tie' it to the natural terrain. It's not really noticeable unless you walk up to inspect it.