Comments (3)
It's not yet clear to me if we should just rely on users providing a Arc<vk::ImmutableImage<vk::Format>>
(perhaps behind some ImageRef
type alias) to the above textured
methods or if we should use an index into some other map of IDs to images.
One issue to consider on this topic is that images must be accessible via the fragment shader. This means providing samplers for each of the specified images along with some way of determining which sampler is being referred to in the shader code itself. If we allow users to pass pre-loaded images via the methods above, then we must support the case where the number of images changes during runtime. This suggests to me that we either need to:
- generate a new fragment shader each time a new set of images is seen and reconstruct the graphics pipeline,
- copy all the received images into a single
Image2dArray
, defeating the purpose of the users loading images onto the GPU in the first place, but allowing them to be indexed dynamically via the fragment shader or - create a new draw command for every new image (slow).
On the other hand, if we were to take ownership over the image creation process, we could load images directly into an Image2dArray
ready for runtime indexing.
It's worth noting that the Image2dArray
approach for dynamic image loading would be perfect in the case that many images are loaded at once, though would be quite inefficient in the case that many images were added or removed at runtime. This is because the entire Image2dArray
would have to be re-loaded every time an image was added or removed.
I wonder what other approaches exist for addressing dynamic numbers of images in shader code.
from nannou.
I would also consider fbos in the process from the start (with multiple render targets/sources) that might impose some restrictions on what you can use.
[Edit] Also, looking at how I would want the api to work, I think something along the line of draw.mesh().with_texture()
and draw.mesh().with_textures()
might be interesting to have. (I don't know what to pass to those but a reference to some image/buffer might be the most intuitive?)
It boils down to how you add your own shader in the end. Ideally I would want to swap one of the default shaders for my own and still get the same info in a intuitive way, where I would expect the textures to be available as samplers. It might mean a lot of work though to have this flexibility.
from nannou.
Closed via #484.
See the draw_texture*
examples for reference.
from nannou.
Related Issues (20)
- Intel HD Graphics 4600 (Windows): barebon app panics
- For some reason, my code runs my program faster whenever I interact with my keyboard. I've verified that it's just when using nannou, and I can't fathom what it is since the program has no user interaction.
- osc sender consumes local port but doesn't allow you to receive data
- Upgrade WGPU version
- Use newer wgpu/wgsl version
- Is it possible to render with a lower resolution within a higher resolution container/window? HOT 1
- RequestDeviceError on WSL2
- An error with the render pipeline on macOS
- Choosing which canvas to use with the `wasm-experimental` feature HOT 4
- Grayscale textures (LumaU8) showing up in red HOT 3
- Nannou application exits immediately on cmd-Q without invoking custom exit handlers
- Drawing a path with nannou::geom::path should expose lyon's end() method on builder
- Segmentation fault HOT 3
- ignore me HOT 1
- app.window_rect().x.step_by(50) fails as iterator HOT 2
- Maintenance status + becoming a maintainer? HOT 13
- Not found tags 0.18.1
- StrokeOptions absent from crate documentation
- Memory leak when running examples
- State of nannou, thoughts on direction (bevy plugins?), maintainers welcome HOT 14
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nannou.