Coder Social home page Coder Social logo

Comments (2)

tychedelia avatar tychedelia commented on September 26, 2024

@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:

  1. Add a new UserMeshInstancePlugin<T> that the user can add once per application, where T ensures proper alignment, etc.
  2. In order not to pollute all the rendering code with a new type parameter, this is going to be type erased as RawBufferVec<u32>.
  3. Pass this into the compute shader etc as an optional buffer that enables a shaderdef.
  4. In the compute shader, bind input, output, and a push constant (or whatever) that indicates the size of the data.
  5. After culling, write input to output at the same time as the mesh data.
  6. 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.

tychedelia avatar tychedelia commented on September 26, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.