Quantcast
Channel: Question and Answer » hlsl
Viewing all articles
Browse latest Browse all 69

How to write a custom shader in Unity 3D that lights up a specific pixel or group of pixel?

$
0
0

I’m making a FPS game in Unity, and I want the environment to light up as the player is shooting on his environment.
The map would be entirely put in darkness at the beginning, but as the player shoots the environment, it would be rendered with its “real texture”. So say I have a tree. First it is entirely black or greyish, but if I shoot somewhere, I would see some green.
To accomplish this, I’m using a raycast to get the impact point and so I can access any renderer of the point that the player is shooting on. I guess the next step would be to write a custom shader to light the exact pixel that is shot. Do you have any idea how I could write this shader or another way of doing this effect?

Regards


Viewing all articles
Browse latest Browse all 69

Trending Articles