Closed shrekshao closed 8 years ago
Do you recommend to try WebCL for this project?
I think Kai said WebCL is kind of dead. CPU-based light tiling seems like it'll be the best way to go :(
I'm pretty out of the loop here, but we definitely can't do something like, run a fragment shader over all the pixels in the tile gbuffer? Maybe each tile is 128x128 pixels, and we set a cap of 128 * 32 lights (pack each light's attributes into 6 floats or something). Each light could get a unique ID in the light gbuffer. That way, I think each thread would just have to compute which light/tile it is in charge of, compute if it intersects the tile, and write just that value as true/false.
Sounds like something worth a try. Actually we only need to store the light idx, no need to pack all attributes. The process as I understand goes like this:
Potential Problems/Limitations:
Overall I think it is worth a try. Thanks Gary. Let me know if there's any misunderstanding
Finally it turns out that even with gather approach, we still cannot use shader to assign lights to tile in parallel, since one single thread cannot write multiple pixels to texture (assign multiple lights to buffer). MRT won't work cuz the number is too limited compared to num of lights.
I'm finally falling back to use cpu to assign lights to each tile. Reading from multiple textures (functioning as tile-lightIdx buffer) is still doable (like Sijie Tian's Tile-based deferred one).
Let me know if there's anything I'm missing.