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

problems with pipelined 3d examples #3198

Closed
adsick opened this issue Nov 26, 2021 · 16 comments
Closed

problems with pipelined 3d examples #3198

adsick opened this issue Nov 26, 2021 · 16 comments
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior
Milestone

Comments

@adsick
Copy link
Contributor

adsick commented Nov 26, 2021

Bevy version

latest (f3d4be3)

Operating system & version

Fedora 35

What you did

Ran new pipelined 3d examples

What happened

Summary: most examples work as intended, but others are 'wrong' or strange (look like something is missing)

Screenshots

pbr_pipelined:

image
note: regular pbr example works just fine.

shadow_caster_receiver_pipelined:

in this one pressing C or R has no effect on what is being displayed on screen.
image

texture_pipelined:

image
transparency doesn't work.

Additional information

hardware: Ryzen 5 3500u, iGPU: Vega 8, 12G Ram.

@adsick adsick added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Nov 26, 2021
@MinerSebas
Copy link
Contributor

The pbr_pipelined example will be fixed by #3182

@mockersf
Copy link
Member

mockersf commented Nov 27, 2021

pbr_pipelined issue is a regression introduced by #3192, fixed in #3200

shadow_caster_receiver_pipelined is a known "issue", examples were not updated after decision to disable shadows by default in #3126, fixed in #3201

texture_pipelined is from #3072, fixed in #3202

@superdump
Copy link
Contributor

pbr_pipelined issue is a regression introduced by #3192, fixed in #3200

shadow_caster_receiver_pipelined is a known "issue", examples were not updated after decision to disable shadows by default in #3126, fixed in #3201

texture_pipelined is from #3072, fixed in #3202

Thanks for noting these! And for submitting fixes. I have been testing with more advanced scenes which make specific use of these features or demonstrate issues with them and I missed updating the examples that they affect.

@alice-i-cecile alice-i-cecile added A-Rendering Drawing game state to the screen and removed S-Needs-Triage This issue needs to be labelled labels Nov 27, 2021
@alice-i-cecile alice-i-cecile added this to the Bevy 0.6 milestone Nov 27, 2021
@adsick
Copy link
Contributor Author

adsick commented Nov 27, 2021

after git pull I see beautiful shadows in 3d_scene_pipelined
but also not so beautiful artifacts in shadow_biases_pipelined
image

@superdump
Copy link
Contributor

The artifacts in shadow_biases_pipelined are intentional. It’s a bit of a playground to let people get a feel for adjusting the depth and normal biases for shadow maps. The instructions printed to the terminal tell you how you can adjust them. This has confused other people too so we should make the example’s intent clearer.

@adsick
Copy link
Contributor Author

adsick commented Nov 27, 2021

yesterday it was looking fine (so I didn't report here) but today I tested again and was surprised))

@adsick
Copy link
Contributor Author

adsick commented Nov 28, 2021

shadows in shadow_biases_pipelined still look kinda odd tho, I tried adjustments but they don't seem to make it better

@superdump
Copy link
Contributor

The default values that I found to work quite well are: depth bias 0.02, normal bias 0.6. Hopefully that helps you to see how adjusting the biases behaves.

@mockersf
Copy link
Member

#3200 was merged which should fix example pbr_pipelined, and it should also impact shadow_biases_pipelined

how it renders with the default values for me:
default-values

and with the values from Superdump:
superdump-values

@adsick
Copy link
Contributor Author

adsick commented Nov 28, 2021

I confirm that pbr_pipelined works (for me)

@mockersf
Copy link
Member

texture_pipelined should be fixed too now on main 🎉

Do you still have an issue with shadow_biases_pipelined?

@adsick
Copy link
Contributor Author

adsick commented Nov 30, 2021

I'll test texture_pipelined and this issue will probably be closed soon.
Speaking of shadow_biases_pipelined I guess mine looks just the same as yours, but shadows are kinda blocky. Isnt that a problem?

@superdump
Copy link
Contributor

I'll test texture_pipelined and this issue will probably be closed soon.
Speaking of shadow_biases_pipelined I guess mine looks just the same as yours, but shadows are kinda blocky. Isnt that a problem?

Absolutely. It’s not a bug though, rather that the shadow resolution is necessarily low with the current solution. I was working on a technique called cascaded shadow maps that will significantly improve the directional light shadow quality, but I thought it would need some more time to get it working well and have instead focused on getting my chain of branches merged so we could get to this point and move closer to a 0.6 release. Improvements will continue to come. :)

@mockersf
Copy link
Member

mockersf commented Nov 30, 2021

You can also increase (a little) shadow resolution with those two resources:

    App::new()
        .add_plugins(PipelinedDefaultPlugins)
        .insert_resource(bevy::pbr2::PointLightShadowMap {
            size: 2_usize.pow(13),
        })
        .insert_resource(bevy::pbr2::DirectionalLightShadowMap {
            size: 2_usize.pow(13),
        })

Screenshot 2021-11-30 at 09 27 55

And shadows seems to be better for me with a PointLight rather than a DirectionalLight:

Screenshot 2021-11-30 at 09 31 16

I didn't find any example showing those resources, should we add one?

You can add this system to the shadow_biases_pipelined example, it will crash if you decrease/increase the value too much.

fn adjust_shadow_map_sizes(
    input: Res<Input<KeyCode>>,
    mut pointlight: ResMut<PointLightShadowMap>,
    mut directionallight: ResMut<DirectionalLightShadowMap>,
) {
    if input.just_pressed(KeyCode::Key9) {
        pointlight.size /= 2;
        directionallight.size /= 2;
        println!("Shadow Map Size: {}", pointlight.size);
    }
    if input.just_pressed(KeyCode::Key0) {
        pointlight.size *= 2;
        directionallight.size *= 2;
        println!("Shadow Map Size: {}", pointlight.size);
    }
}

@adsick adsick closed this as completed Nov 30, 2021
@adsick
Copy link
Contributor Author

adsick commented Nov 30, 2021

I think that's cool (tweaking the system with resources) maybe it worth describing in examples.

@adsick
Copy link
Contributor Author

adsick commented Nov 30, 2021

And yeah, texture_pipelined works so I've closed the issue. Good job!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior
Projects
None yet
Development

No branches or pull requests

5 participants