-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[Merged by Bors] - Add PBR textures #1632
Conversation
for input_variable in module.enumerate_input_variables(None).unwrap() { | ||
if input_variable.name == GL_VERTEX_INDEX | ||
|| input_variable.name == GL_INSTANCE_INDEX | ||
|| input_variable.name == GL_FRONT_FACING | ||
{ | ||
continue; | ||
} |
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 might misunderstand the point of this condition, if so I'd love to learn. But wouldn't a more long-term solution be (snipped some use
changes for clarity):
diff --git a/crates/bevy_render/src/shader/shader_reflect.rs b/crates/bevy_render/src/shader/shader_reflect.rs
index 238da1ef..95761fed 100644
--- a/crates/bevy_render/src/shader/shader_reflect.rs
+++ b/crates/bevy_render/src/shader/shader_reflect.rs
@@ -31,8 +32,9 @@ impl ShaderLayout {
// obtain attribute descriptors from reflection
let mut vertex_attributes = Vec::new();
for input_variable in module.enumerate_input_variables(None).unwrap() {
- if input_variable.name == GL_VERTEX_INDEX
- || input_variable.name == GL_INSTANCE_INDEX
+ if input_variable
+ .decoration_flags
+ .contains(ReflectDecorationFlags::BUILT_IN)
{
continue;
}
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.
Oooh that does seem like a win / appears to do what we want it to.
2021-03-12_11-37-48.mp4 |
Rebased on pbr. |
Rebased on the latest pbr. |
And rebased onto main now that #1554 has been merged. |
Should the standard shapes like cube or sphere provide the |
@@ -310,7 +380,9 @@ void main() { | |||
vec3 diffuse_ambient = EnvBRDFApprox(diffuseColor, 1.0, NdotV); | |||
vec3 specular_ambient = EnvBRDFApprox(F0, perceptual_roughness, NdotV); | |||
|
|||
output_color.rgb = light_accum + (diffuse_ambient + specular_ambient) * AmbientColor; | |||
output_color.rgb = light_accum; |
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.
Tiny comments here would make it easier for folks new to rendering to figure out exactly what's happening here.
See the // tone_mapping
comment just below.
Transferring @pkupper's comment from Discord for discoverability:
|
Possibly. Do we want to pull that into this PR? (neutral question) It has both pros and cons, I think, but I guess it does make sense to make this more fit for general use, rather than having to add that in a separate PR.
This is actually pretty similar as above, except for externally loaded models. I guess it makes sense too.
After @pkupper pointed out the other samples, I found there's actually a really good sample for testing this PR, which is NormalTangentMirror. I considered adding an example with these models, but it would add quite a bit of extra size, which I'm not sure is good. Maybe in a separate repo? Later, anyway. |
We're hitting a minor snag, where The effect of this is that I don't really know where to start fixing this. If somebody is able to help out, so I don't have to also dig into the Asset system, please do. Otherwise I may look into it this weekend or next week. |
I think a second PR is fine for adding the missing tangent vertex attributes. |
Rebase on #1762 in progress... |
Load textures from gltf as linear when needed. This is for #1632, but can be done independently and won't have any visible impact before. * during iteration over materials, register textures that need to be loaded as linear * during iteration over textures * directly load bytes from external files instead of adding them as dependencies in the load context * configure the texture the same way for buffered and external textures * if the texture is linear rgb, set as linear rgb
bors r+ |
This PR adds normal maps on top of PBR #1554. Once that PR lands, the changes should look simpler. Edit: Turned out to be so little extra work, I added metallic/roughness texture too. And occlusion and emissive. Co-authored-by: Carter Anderson <[email protected]>
Pull request successfully merged into main. Build succeeded: |
This PR adds normal maps on top of PBR #1554. Once that PR lands, the changes should look simpler.
Edit: Turned out to be so little extra work, I added metallic/roughness texture too. And occlusion and emissive.