Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stars shining through objects #2

Open
kek opened this issue Nov 16, 2024 · 7 comments
Open

Stars shining through objects #2

kek opened this issue Nov 16, 2024 · 7 comments

Comments

@kek
Copy link

kek commented Nov 16, 2024

Hi, thanks for this plugin which looks really nice!

I'm learning Godot so this might be more of a beginner Godot question. But when I try adding starlight to my scene, the stars are visible through other objects that I placed in the scene. This effect is also visible in the demo project, as shown in the screenshot taken from that. I have a feeling I am missing some basic setting -- I have tried to change the rendering order for my other objects and such but no luck.

Screenshot 2024-11-16 at 11 37 57 AM
@tiffany352
Copy link
Owner

Are you on Godot 4.3+? There was a change to how shaders work in that version. I haven't put out a new version yet though. The fix should be very simple though. Change this line:

POSITION.z = 1.0 * projected.w;

to this:

	POSITION.z = -1.0 * projected.w;

@kek
Copy link
Author

kek commented Nov 18, 2024

Thanks! Yeah, I'm using the latest Godot. I tried changing the line that you suggest. Unfortunately, when I try that change in the demo project, it just makes the stars invisible.

@aganm
Copy link

aganm commented Dec 1, 2024

I figured it out.

tiffany was on the right track, gotta reverse the Z coordinate. But to reverse it is a division:

	POSITION.z = 1.0 / projected.w;

@kek
Copy link
Author

kek commented Dec 11, 2024

That is great. That solution works for me. Thanks for the help @tiffany352 and @aganm!

@KyleKirkpatrick
Copy link

	POSITION.z = -1.0 * projected.w;

This was actually the correct fix for me.

@aganm
Copy link

aganm commented Dec 12, 2024

Sounds like a bug with Godot engine. I will open an issue.

@tiffany352
Copy link
Owner

I pushed a bunch of commits with various fixes/improvements, including the suggested fix from the linked issue. I'll put out a new release once I'm a bit more sure I didn't break anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants