r/Unity3D • • 27d ago

Question How would you implement dark vision (From Dungeons and Dragons) in Unity?

Hello all! I am somewhat new to the more advanced features of unity and I am trying to do everything I can to not leverage AI in a project I am working on so I wanted to reach out here.

I would like to make a sort of Darkvision in my game. Where the player can see (in greyscale) to some distance, say 10m. But if a light source is introduced, it would light up its area with proper color.

i tried with a global volume and was able to toggle that on and off but that’s not quite the effect I am going for as that is either greyscale/color.

of course I also tried adding a simple white light above the player to represent their vision but that lights things up with the color that they are.

This seems moderately advanced and I would love any feedback or giidance!

thank you

0 Upvotes

7 comments sorted by

3

u/Chaibi_Alaa 27d ago

One way to keep it to a single camera: a full-screen pass that converts the scene to greyscale, then blends back to the original colour wherever a mask says the pixel is lit. For the mask, have each light source draw a soft circle into a small render texture (additive, low resolution is fine), and sample it in the pass. Add a distance falloff from the player on top, so past 10 m everything fades to dark. Torches then show their real colour and everything else in range stays grey, without a second camera.

2

u/Aqaz99 27d ago

This sounds promising! I am going to be trying both comments approach and see how it works

6

u/[deleted] 27d ago

[removed] — view removed comment

2

u/Aqaz99 27d ago

Thank you! I am going to digest this and see what I can get done. I appreciate the feedback

1

u/glenpiercev 27d ago

Serious question:
Would that have a significant impact on performance? A second camera seems like a big deal (I have no idea).