Lexpartizan / Godot_sky_shader

MIT License
194 stars 23 forks source link

update README + fixing spelling + renaming zip file #7

Closed MJacred closed 4 years ago

MJacred commented 4 years ago

added to README

fixed spelling in button text

renamed zip file for actual targeted Godot version -> 3.1.*

SIsilicon commented 4 years ago

This is great, but I think this might've broken compatibility with my plugin.

Lexpartizan commented 4 years ago

As far as I understand, only two lines are responsible for the connection with the plugin. const IS_LEX_SKY = true and func _enter_tree(): add_to_group("__LEX_SKY__")

I have to clean up some duplicate things in the shaders.

SIsilicon, very big thanks, we take good picture!)) MJacred, Don't rush, first the smooth integration of god rays.

SIsilicon commented 4 years ago

That's the thing though. I removed that second one because it wasn't working out. Which is why I went for a constant instead. The README also doesn't inform about how you should use the zip file.

If I'm not mistaking, aren't you supposed you extract it, then use as a template for your project? Because if the files in that zip aren't in the root project, it won't work. Godot froze a couple of times because of invalid resource references in the Sky scene.

Lexpartizan commented 4 years ago

I fix readme tomorrow. The next task is to display the moon as a texture so that it doesn't stretch across the panorama. I'm not ready to solve it yet. I think we should somehow project the moon on the screen. Tomorrow I'll clean it up a bit and write instructions in the readme where to download and how to add Your plugin to project. I did not expect such attention to this project at all, so I did not think much about readme and other things)) Zip file temporary solution due to incompatibility with 3.1.2

SIsilicon commented 4 years ago

I thought the stretching was just caused by the FOV. I never actually noticed that. :P

Lexpartizan commented 4 years ago

Maybe I will look At your code and make a check on Your addon from my side? Not to trash Your addon with constants "Lex_Sky"

SIsilicon commented 4 years ago

You mean this part? https://github.com/SIsilicon/Godot-God-Rays-Plugin/blob/master/addons/SIsilicon.vfx.godrays/GodRays.gd#L19

Lexpartizan commented 4 years ago

if get_parent().get("IS_LEX_SKY"): light = get_parent().get_node("Sun_Moon") set_clouds(get_parent().get_node("cloud_viewport").get_texture())

SIsilicon commented 4 years ago

Yeah. That's checking for the constant alright.

Lexpartizan commented 4 years ago

Sow i can call GodRays.light and etc.

SIsilicon commented 4 years ago

Yeah it can be overridden by another script. It changes value whenever it get's parented or unparented.

func _notification(what : int) -> void:
    if what == NOTIFICATION_PARENTED:
        if get_parent() is Light:
            light = get_parent()

        if get_parent().get("IS_LEX_SKY"):
            light = get_parent().get_node("Sun_Moon")
            set_clouds(get_parent().get_node("cloud_viewport").get_texture())
        else:
            set_clouds(null)
    elif what == NOTIFICATION_UNPARENTED:
        light = null
        set_clouds(null)
Lexpartizan commented 4 years ago

I want to add god_rays as an option, becouse performance... like 2d clouds.

SIsilicon commented 4 years ago

It's already optional. Just hide the GodRays node. It won't render at all like that.

Lexpartizan commented 4 years ago

This cool!

Lexpartizan commented 4 years ago

I like that this effect works not only on clouds, but also comprehensively on Meshs.

SIsilicon commented 4 years ago

That's because it uses the depth buffer as a mask. Which is also why I haven't figured out how to downsample it for a performance boost.

Lexpartizan commented 4 years ago

This kind of thing, when you need to use vertex shaders or project something, baffles me. I can't adapt anything to it then.. I'm not far from drawing circles on shadertoy))

Lexpartizan commented 4 years ago

I think we can try replace float rand_from_seed() with texture noise...

SIsilicon commented 4 years ago

I think we can try replace float rand_from_seed() with texture noise...

That is definitely doable. I was just too lazy to get a noise texture :P

Lexpartizan commented 4 years ago

But this in not loops... I didn't notice right away.

SIsilicon commented 4 years ago

Huh? I'm sorry I don't understand what you're saying.

Lexpartizan commented 4 years ago

float rand_from_seed() not used in loops, this used once, unfortunately. There won't be much effect.

MJacred commented 4 years ago

That's the thing though. I removed that second one because it wasn't working out. Which is why I went for a constant instead. The README also doesn't inform about how you should use the zip file.

If I'm not mistaking, aren't you supposed you extract it, then use as a template for your project? Because if the files in that zip aren't in the root project, it won't work. Godot froze a couple of times because of invalid resource references in the Sky scene.

The explanation is indeed ultra-short. So far it's only sufficient for programmers and people with some experience in Godot, I guess...
I'll make another pull-request with suggested changes. We can discuss there before merging

SIsilicon commented 4 years ago

That's the thing though. I removed that second one because it wasn't working out. Which is why I went for a constant instead. The README also doesn't inform about how you should use the zip file. If I'm not mistaking, aren't you supposed you extract it, then use as a template for your project? Because if the files in that zip aren't in the root project, it won't work. Godot froze a couple of times because of invalid resource references in the Sky scene.

The explanation is indeed ultra-short. So far it's only sufficient for programmers and people with some experience in Godot, I guess... I'll make another pull-request with suggested changes. We can discuss there before merging

Sounds good to me.

SIsilicon commented 4 years ago

float rand_from_seed() not used in loops, this used once, unfortunately.

Oh that? Yeah the random value is picked once per pixel. It's used as an offset to sample the depth and cloud textures. That's how the dithering works.