0
\$\begingroup\$

I want to be able to have a gameobject that's basically just a black box on top of everything else. Then I want to be able to place other gameobjects which are just gradients on top of that and they should "cut out" of the black texture like this:

enter image description here

How can I achieve this sort of effect?

Please keep in mind that I have pretty much no experience with shaders :)

Here's a video that might help explain what I'm trying to achieve https://www.youtube.com/watch?v=L1dd4fkVSAM

\$\endgroup\$

1 Answer 1

0
\$\begingroup\$

I saw the video link you provided. I dont think you have to do much about shaders. This can easily be achieved by using lighting. Make the entire scene dark by deleting all the lights including directional light (or configuring the light to decrese its intensity). Assign a light (may be a point light) to the character and you get what you want. When the character moves, the area around the character would light up.

Otherwise if you want your black box to show gradients of textures dynamically, it needs shader programming. Hope this help.

\$\endgroup\$
5
  • \$\begingroup\$ Its a 2D game so I dont have any lights \$\endgroup\$
    – user61929
    Oct 19, 2016 at 5:36
  • \$\begingroup\$ 2D gameobjects by default doesnt not respond to lighting. Change your sprite shaders to Diffuse. Now your 2D sprites will respond to exterior lighting. \$\endgroup\$
    – Geo Baby
    Oct 19, 2016 at 6:57
  • \$\begingroup\$ Yes, but then everything doesn't become black \$\endgroup\$
    – user61929
    Oct 19, 2016 at 6:57
  • \$\begingroup\$ Do you know how I would go about writing a shader for this? \$\endgroup\$
    – user61929
    Oct 19, 2016 at 9:40
  • \$\begingroup\$ I download an asset from the asset store, it works now \$\endgroup\$
    – user61929
    Oct 20, 2016 at 17:29

You must log in to answer this question.