Hello. I am trying to build a 3d scene with procedurally generated skybox (the one built-in) that would show stars during the night.
My setup is simple: I have a light(sun) that revolves around and it’s intensity changes with the angle so that at night it goes to 0 and then it goes to 1 again for the day. I also have a particle system with spherical emitter and “fixed” particles on it’s surface that pretend to be stars.
The particle system’s sphere emitter does not have very big radius to avoid far clipping. As a result of that sometimes very far objects get rendered behind the stars. To fix this issue I thought that I would draw the stars in the scene without adding ZBuffer information to make all geometries in the scene draw over them. This way emitter radius is not important as the stars would always be the furthest objects.
I have created simple shader for the stars with “ZWrite Off” and “ZTest Off” and well, this does not work. It seems that skybox is drawn over my stars just like any other geometry. Trying with “Queue” = “Skybox+1” does not solve the issue. I have a feeling that there is something obvious that I am missing. I would be grateful if more experienced Unity users gave me some hint.
Thanks a lot.