-
Notifications
You must be signed in to change notification settings - Fork 244
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
Cleanup pass on example shader and vk example-runner #109
Conversation
Nice! But I think you'll end up needing the depth buffer later, for future more complex examples. Also, vertex input I'd keep around for the same reason - that still needs to work with Rust shaders, so why not keep it so it gets tested? I do of course agree that removing this stuff makes the example code a lot nicer and shorter so if you intend to have a second bigger example-runner later, keeping this smaller one like this might be worth it. |
examples/example-shader/src/lib.rs
Outdated
#[spirv(builtin = "position")] mut gl_pos: Output<Vec4>, | ||
mut out_pos: Output<Vec4>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we call these out_pos
and out_pos_interpolator
or something? I would love us to not have the gl_
prefix anywhere if we can avoid it.
examples/example-shader/src/lib.rs
Outdated
tex_color *= Vec3::splat(0.04); | ||
tex_color += Vec3::new(0.0, 0.001, 0.0025) * 0.3; | ||
let tex_color = lin + l0; | ||
|
||
// Tonemapping | ||
let white_scale = 1.0 / uncharted2_tonemap(TONEMAP_WEIGHTING); | ||
let curr = uncharted2_tonemap(((2.0 / LUMINANCE.pow(4.0)).log2()) * tex_color); | ||
let color = curr * white_scale; | ||
|
||
color.pow(1.0 / (1.2 + (1.2 * sunfade))) | ||
let color = tex_color.min(Vec3::splat(1024.0)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about most of what's going on here, for example, I'm not even sure why the sky model chose to embed the tone-mapping operator in here to begin with (or even why it's doing srgb conversions tbh). It might be nicer to hoist all of that out of sky
all together?
One thing I do notice is that your change seems to remove the application of sunfade
. I suspect this was done to make the sun seem brighter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not even sure why the sky model chose to embed the tone-mapping operator in here to begin with
...
It might be nicer to hoist all of that out of sky all together?
Yeah it would... the tonemapping is really just because the sky is being displayed directly... so it makes sense to put it in the main frag shader and not in sky()
.
and while it does remove sunfade from here, I suspect that the application of sunfade
here was really just a hacked in "auto brightness slider" (which really shouldnt be done as a gamma anyway) based on a vaguely related value... it's still being used in the calculation of the rayleigh coefficient right after it gets defined.
while I agree that it's probable we'll want these things at some point, I'm a bit skeptical of having a unified example-runner that's capable of doing lots of things at this point... and in any case, it's quite easy to add those back in the same state they are now, since it's just copied from the |
Throwing in my two cents, I'm strongly in favor of nuking the Although, Viktor already started on the wgpu example, could use that as a base (So I'm in favor of doing whatever to the ash example right now, because I imagine it'll be gone soon) |
I'm sorta of the same mind haha. And don't worry, didn't put too much work into the ash one, the main purpose originally was actually just to change it so that the sky shader example works with no friction with the wgpu example Viktor started :D |
I would like the But do think we'll have to keep a |
Rebased on main and applied changes in order to normalize output between all three example runners. Also renamed |
Looks like there's still a fair number of references to Also there are two |
The |
Also, optional thing, winit is out of date ( |
What do we think about @hrydgard's comment?
I tend to agree with him - keeping it is probably best (which is why I +1'd it), but there may be other opinions here? |
I think my opinion is #109 (comment) and @khyperia 's is #109 (comment) |
@XAMPPRocky made a couple docs changes in 38d2735 that might be relevant for your review |
Oh @termhn this PR should probably update the screenshot in the README.md as well to the new one, would be less confusing for new people. |
- get rid of unused attributes in example shader - use negative viewport height to match wgpu
remove 'gamma correction' in favor of hardware srgb support
fix ci example name on maOS
Pushing the big green button manually 'cause mergify can't merge this one :) 🎉 |
out_pos
with correspondingin_pos
in the frag shader, which is what it's being used for (that's the data that gets wired to the fragment shader input at location 0, because the builtin "position" output is separate). We could also just scrap this output and use#[spirv(builtin = "frag_coord")]
in the fragment shader but I think it's helpful to have there in the example.wgpu
's (and DirectX's) clip space, useful if we want to directly use the same shader in WGPU example #92 because otherwise, it will be flipped