Need help with Sun Rays in Roblox Studio

I just started working on my own space-themed game, however I want to get something done, but I just don’t know how. What I’m saying is that I want to make the sunrays appear when the camera is not looking directly at the sun, as seen in the image below. Is there anyway I can achieve this so the rays hit the planets without me having to look at the sun? I have tried looking all over developer hub but cannot find anything relating to my inquiry.

1 Like

What is your Lighting Technology set to?

Mine is currently set to shadow map.

How does Future Lighting look?

Custom_Sun-rays.rbxm (5.1 KB)
(I made this custom sun rays system a while ago for a game but this post made me finish it up.)

What it does is use built-in functions to check if the sun is on screen or close to being on screen. It has a few settings you can mess with to get a better result, and you can also change the sun ray texture.

Edit: I forgot to change the needsOnScreen variable to true, but that doesn’t really matter because I just realized it does nothing now that I modified the code (or at least I think so)

1 Like

Thanks! This works exactly as I wanted it to!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.