I want a 2d image of the sun at the sun position at the sky.
My solution is to attach a picture at the guiNode and tranform the world position to screen position.
But the problem is, that the sun is visible through the whole world because its on the guiNode.
I tried Bucket.Sky but thereby the sun disappears
Don’t put it in the gui node as it’s not a gui element. Put it in the sky but position it properly in the scene. Make sure to use the billboard control so it always faces the camera.
@alrik said:
-.- it works if I disable the fog post processing shader. are there any ways to get this work with fog shader enabled?
Not really. Fog as a post-processing effect has a few problems, things like this being one of them. It is indiscriminate since it operates on the whole rendered scene.
You can modify the Fog Filter to exclude the sky by making a minor alteration to the frag shader.
[java]
if (z == 1.0) discard;
[/java]
This is assuming that the depth is referenced by a variable named z… could be depth… or something similar. Anyways… use a local copy of the filter and the above line before the frag color is set and it will do what you are looking for.
EDIT: This is something that should already be part of the Filter (or at least I thought it was added way back when…) If it was… there should be a boolean uniform that can be set via the filter.
I guess if fogVal == 1.0 was discarded it might also unfog things that just happened to be at the far plane.
To the OP, if you are going to modify shaders then it’s probably better in the long run just to add fog to the regular shaders and avoid the extra post-processing pass and its limitations.