-
-
Notifications
You must be signed in to change notification settings - Fork 35.2k
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
[WEBGL2] Transform feedback #14416
Comments
This seems nicer. But it depends of how much code it adds. |
@mrdoob how much code is too much code? Are there any guidelines for this? |
My opinion is that (1.) is much more versatile. Imagine you have some computations to do which have nothing or nearly nothing to do with what is visually represented. |
@yomboprime Yep, I'm currently working on the (1) option having in mind that we could use it to implement (2) to have some syntactic sugar for using it in just one pass. |
Looks like good proposal actually. |
Transform feedback is implemented in IMO, it's best for the project to not implement transform feedback in https://threejs.org/examples/webgpu_compute_geometry @mrdoob If you are okay with this proposal, we can close #14503, #26777 and this issue. |
@Mugen87 Sounds good 👍 |
I'm working on implementing transform feedback support on top of the WebGLRenderer to WebGL2 proposal.
I would like to get some feedback from the community about the following two approaches:
THREE.TransformFeedback
and we will call it with aBufferGeometry
and aProgram
:The constructor will create a copy of the buffergeometry that will then be used on
tick
to pingpong between these two geometries.As you can spot, we're calling
RASTERIZER_DISCARD
as we don't want to draw anything, we just want to do the computation stored on the program and save the values back to a buffer that will be used later to paint the geometry.An example of this approach is the WebGL2Particles demo by @toji
The key point here is that we're performing first the computation using a specific shader and we use these computed attributes to render the geometry using a https://github.com/toji/webgl2-particles-2/blob/gh-pages/index.html#L55-L74 unrelated to the transformfeedback.
Or we could use injection points for standard materials (Sorry I don't remember the current state on this @mrdoob @pailhead, but you get the point):
So the renderer and the related modules should take the transformFeedback attributes into account and generate the buffers, doing the pingpong (this could be defined on the material too), binding the tf and the attributes.
With this second approach we don't separate the computation from the actual rendering as we just do it in one pass.
An example of this implementation can be found here on the WebGL2Samples Where with just one drawcall you compute and render at the same time using just one program
The text was updated successfully, but these errors were encountered: