How to best detect whether sun is visible on screen (ie. in frustum AND not occluded)

This is likely NOT a performant method but…

Run a line-trace from your char to the sun each tick, or so, several, etc… I am guessing it’s much more likely you will bump into something if you start from the character vs the sun. But you might have to trace quite a distance, that part is up to you.

It is only one line-trace, but as I understand it, the length you trace does impact performance, but again, it’s only the one, so?

3-4 frames, IS noticeable, if you are paying attention, but otherwise that’s a nice little cushion to work within?

If you don’t hit anything, then Bloom!

1 Like