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

[Merged by Bors] - gltf: load normal and occlusion as linear textures #1762

Closed
wants to merge 1 commit into from

Conversation

mockersf
Copy link
Member

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

@inodentry
Copy link
Contributor

  • 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

This should hopefully also resolve the issues outlined in the Mipmaps PR: #1685 , as they were also caused by this asymmetry / different load path for textures in GLTF/GLB leading to sampler parameters being ignored.

Copy link
Contributor

@inodentry inodentry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a concern that this PR might regress existing features provided by the asset system.

gltf::image::Source::Uri { uri, .. } => {
let parent = load_context.path().parent().unwrap();
let image_path = parent.join(uri);
let asset_path = AssetPath::new(image_path, None);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this PR no longer using the asset system to load external texture files (and not tracking the image path / not using it for the handle), and not adding them as asset dependencies, I suspect that might mean that the asset system is no longer going to detect if any of the referenced texture files is modified, which means that they will not be hot-reloaded.

(Instead, modifying the GLTF itself would now hot-reload everything, with all the external textures, as they are treated the same as embedded GLB textures.)

Further, we lose the performance/parallelism benefits that we had before, when textures were queued up to be loaded asynchronously by the asset system.

Copy link
Member Author

@mockersf mockersf Mar 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without a large rework, the asset server is not able to load this kind of assets with external configuration. I think losing the hot-reload of parts of a gltf in exchange for it being correctly loaded is a gain.

Longer term, the Distill integration should provide this feature.

For the async part, I have something working locally (that still need some light work), but would prefer this and #1632 merged first to avoid having too many pr touching the same parts at the same time.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, the current asset system is kinda limited and quirky, really looking forward to Distill. For now we have to make do with what we have, and I agree that loading and rendering the assets correctly should take priority over the features of the asset system working smoothly.

I am excited about your improvement/fix for async loading, sounds like it should address the performance issues when loading big GLBs with many large textures.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I think this is the right short term move. I don't think async will solve the performance issues with image loading. We aren't queuing up multiple async tasks at the same time, so while it might run the async task on a separate thread, we won't start the next one until the previous one is finished.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh nobody was claiming the current async stuff was a perf improvement. My bad!

@Ratysz Ratysz added the A-Assets Load files from disk to use for things like images, models, and sounds label Mar 26, 2021
@cart
Copy link
Member

cart commented Mar 26, 2021

bors r+

bors bot pushed a commit that referenced this pull request Mar 26, 2021
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 bors bot changed the title gltf: load normal and occlusion as linear textures [Merged by Bors] - gltf: load normal and occlusion as linear textures Mar 26, 2021
@bors bors bot closed this Mar 26, 2021
bors bot pushed a commit that referenced this pull request May 2, 2021
Adds an GitHub Action to check all local (non http://, https:// ) links in all Markdown files of the repository for liveness.
Fails if a file is not found.

# Goal
This should help maintaining the quality of the documentation.

# Impact
Takes ~24 seconds currently and found 3 dead links (pull requests already created).

# Dependent PRs
* #2064 
* #2065 
* #2066

# Info
See [markdown-link-check](https://github.com/marketplace/actions/markdown-link-check).

# Example output
```
FILE: ./docs/profiling.md

1 links checked.

FILE: ./docs/plugins_guidelines.md

37 links checked.

FILE: ./docs/linters.md
[✖] ../.github/linters/markdown-lint.yml → Status: 400 [Error: ENOENT: no such file or directory, access '/github/workspace/.github/linters/markdown-lint.yml'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'access',
  path: '/github/workspace/.github/linters/markdown-lint.yml'
}
```

# Improvements
* Can also be used to check external links, but fails because of:
  * Too many requests (429) responses:
```
FILE: ./CHANGELOG.md
[✖] #1762 → Status: 429
```
   * crates.io links respond 404
```
FILE: ./README.md
[✖] https://crates.io/crates/bevy → Status: 404
```
ostwilkens pushed a commit to ostwilkens/bevy that referenced this pull request Jul 27, 2021
Adds an GitHub Action to check all local (non http://, https:// ) links in all Markdown files of the repository for liveness.
Fails if a file is not found.

# Goal
This should help maintaining the quality of the documentation.

# Impact
Takes ~24 seconds currently and found 3 dead links (pull requests already created).

# Dependent PRs
* bevyengine#2064 
* bevyengine#2065 
* bevyengine#2066

# Info
See [markdown-link-check](https://github.com/marketplace/actions/markdown-link-check).

# Example output
```
FILE: ./docs/profiling.md

1 links checked.

FILE: ./docs/plugins_guidelines.md

37 links checked.

FILE: ./docs/linters.md
[✖] ../.github/linters/markdown-lint.yml → Status: 400 [Error: ENOENT: no such file or directory, access '/github/workspace/.github/linters/markdown-lint.yml'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'access',
  path: '/github/workspace/.github/linters/markdown-lint.yml'
}
```

# Improvements
* Can also be used to check external links, but fails because of:
  * Too many requests (429) responses:
```
FILE: ./CHANGELOG.md
[✖] bevyengine#1762 → Status: 429
```
   * crates.io links respond 404
```
FILE: ./README.md
[✖] https://crates.io/crates/bevy → Status: 404
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Assets Load files from disk to use for things like images, models, and sounds
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants