Comments (2)
@pcwalton Tagging you because you suggested this as a solution, and it's a great idea that would really help advance using bevy for art :). Also, in reviewing the feasibility of implementing this, the most gnarly part passes through the preprocessing compute shader bits which you wrote.
My approach is basically going to be this:
- Add a new
UserMeshInstancePlugin<T>
that the user can add once per application, whereT
ensures proper alignment, etc. - In order not to pollute all the rendering code with a new type parameter, this is going to be type erased as
RawBufferVec<u32>
. - Pass this into the compute shader etc as an optional buffer that enables a shaderdef.
- In the compute shader, bind input, output, and a push constant (or whatever) that indicates the size of the data.
- After culling, write input to output at the same time as the mesh data.
- In the user's vertex shader, they are thus able to do
@group(0) @binding(6) var<storage> my_data: array<MyData>;
and use the instance index to look up their per-mesh data.
Does this general approach make sense? Do you have any other more general advice for how to approach this?
from bevy.
One of the problems here is that we have a lot of nice wrappers around things like gpu buffers, creating an "erased" variant for each one is a bit unfortunate. If we permitted the pollution of lots of the rendering code with a user supplied generic type, it would significantly help the implementation, but I'm not sure how to implement the default case where there is no user supplied mesh instance data without specialization (which would still make the code much uglier).
from bevy.
Related Issues (20)
- Add a `TimedCommands` `SystemParam` for easier delayed operations HOT 5
- Add support for letterboxing HOT 4
- Remove `StateTransition` schedule in favor of using observers HOT 5
- different wgpu_backend render total different with the same gltf model HOT 4
- When using multiple canvas, an error is displayed
- Implement `Component` for `Arc` HOT 5
- Border radius is scaled incorrectly HOT 2
- non-root `TargetCamera`s are not ignored HOT 1
- Resource doesn't get dropped on panic in system. Is this expected? HOT 4
- uberbuffers selects single mesh when two are added HOT 1
- Instance example magically inherits transform information of a random entity if any number of new pbr bundles is spawned HOT 3
- ImageAddressMode::Repeat "twitchy" texture rendering
- overflow evaluating the requirement &_: IntoIterator HOT 1
- Don't use `CARGO_MANIFEST_DIR` directly for changing the relative location of the assets directory
- bevy_ptr: unused align_of import in release mode
- overlapping viewport from different camera causes over-culling of entity rendering HOT 2
- Make `reflect::Map::drain` and `reflect::List::drain` take a mutable borrow instead of `Box<Self>`.
- Reflect derived traits on all components and resources HOT 6
- Mention `DynamicTyped` in docs
- On Steam Deck in gaming mode the screen does not update
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 bevy.