Commit Graph

40 Commits

Author SHA1 Message Date
Rezmason
f8959cd7d9 Renaming msdfSampler to linearSampler; adding loadShaderModule utility method; busting the rain render out of its render bundle (which won't be useful long-term). 2021-11-03 20:01:59 -07:00
Rezmason
b31e70c1e1 Removing the channel override in the vertex shader. 2021-11-02 07:35:19 -07:00
Rezmason
4294932d5f Fixed the flickering leftmost column. 2021-11-01 08:49:33 -07:00
Rezmason
348b07d237 Actually the ping-pong setup isn't necessary for this compute shader, since it does everything in-place.
Undid all the y-flips I could find, and they all canceled one another out, except for the glyph UVs in the fragment shader.
2021-11-01 08:38:48 -07:00
Rezmason
6460f4401a Ported the rain compute shader to wgsl. Tons of inverted-y errors abound. 2021-11-01 01:52:57 -07:00
Rezmason
1c1b1e4f03 We have ping-pong! And all the rain pass's shaders can coexist in one module! And I met and received ample help from @kainino0x and others on the WebGPU Matrix chat! 2021-11-01 00:29:16 -07:00
Rezmason
6f58882851 The MSDF stuff shouldn't be in its own uniform buffer. This is basically config stuff.
Added a compute pass that currently does nothing while I learn how to make use of it.
2021-10-31 20:00:11 -07:00
Rezmason
53e1c5502c There's no existing infrastructure for WGSL yet, so to clean up the shader I'm making do with some simple greps and short-term meticulousness. 2021-10-30 23:18:39 -07:00
Rezmason
375560d6a1 Fixed a math issue in the symbol UV function. 2021-10-30 20:30:55 -07:00
Rezmason
4ea6cadd2f Fixing some y-flip related stuff in the rain pass fragment shader. Consolidating and changing the type of a bunch of info in the config uniform. Improving the code comments. 2021-10-30 20:05:07 -07:00
Rezmason
d8701c9408 Ported the rain vertex shader to wgsl. 2021-10-30 18:07:07 -07:00
Rezmason
923992660c Ported the rain fragment shader to wgsl. Made a small change in both to the function that resolves the glyph symbol float to the coordinate of a glyph in the MSDF texture. 2021-10-30 14:49:06 -07:00
Rezmason
4dd0c1be50 Organizing shader functions' input and output types. I don't know if this is a good idea in the long run, but it seems useful in the short term. 2021-10-30 13:50:46 -07:00
Rezmason
cc75938fcb Passing all the rain pass configs through a giant struct into the rain shader. I've included the compute shader fields, because I have hope that the compute pass can use the same shader module. 2021-10-30 13:48:28 -07:00
Rezmason
1516f82554 Adding random functions to rain render pass shader 2021-10-30 08:41:00 -07:00
Rezmason
94f5f1e5ec Rearranging the shaders and scripts to hopefully make the project easier to work on 2021-10-29 09:27:28 -07:00
Rezmason
23d397fa11 Now that I can pack integer and float data into one uniform buffer, time.seconds can be represented as a float while time.frames is an integer. 2021-10-29 09:02:20 -07:00
Rezmason
e79e741fcf Fixed a struct layout bug. Struct layout and builder now support mixing integer and float data in a struct, and output an ArrayBuffer. 2021-10-29 07:43:39 -07:00
Rezmason
81f77c70ae Slowly working out what's required to support uniform buffers that store integers as well as floats 2021-10-29 00:38:58 -07:00
Rezmason
1b53b8be1f Experimenting with simplifying the names of the uniform buffers in the rain render pass shader. 2021-10-28 22:21:01 -07:00
Rezmason
c3254c3aa1 Adding WebGPU to TODO.md. Annotating the parts of the WebGPU code that involve uniform buffer layout issues. 2021-10-27 22:34:47 -07:00
Rezmason
c27c20f2cf Consolidating all the bind groups, because I only have four. Stuff shared between render passes will get isolated somehow, but it might be by binding one buffer to multiple render passes' bind group at zero rather than having more than one bind group. 2021-10-27 21:08:20 -07:00
Rezmason
a0649bdb34 Added screenSize in camera uniforms. 2021-10-27 20:51:22 -07:00
Rezmason
f2a54b3141 A little bit of shader variable renaming and const declaration during a walkthrough of the existing code on-stream 2021-10-27 20:00:39 -07:00
Rezmason
c716d30808 Merged the vertex and fragment shader WGSL files, because their bindings can't collide anyhow. The rain render shader now accepts a bind group of time uniforms, which change on every frame, as well as MSDF uniforms, along with an MSDF sampler and texture that's loaded in from the PNG. The shader currently renders the correct grid of quads for volumetric mode, displays the first glyph raw in each one, and every sixty frames, turns on and off the blue channel. 2021-10-27 19:04:02 -07:00
Rezmason
8c62146884 Fetching WebGPU shaders. Created my first bona fide pipeline. The vertex shader compares the built-in vertex index and the numRows/numColumns uniforms to produce a grid of quads with no vertex or index buffer whatsoever! 2021-10-27 19:04:02 -07:00
Rezmason
48a6f2cf34 Fixing a typo and adding looping functionality to the TODO list 2021-10-27 19:03:38 -07:00
Rezmason
69d4e7365c Renaming the shaders again, because the extensions I gave them were confusing GitHub's syntax highlighting. 2021-10-23 01:28:32 -07:00
Rezmason
cf5f8c2113 Simplifying rainPass.compute's weirder operations. 2021-10-23 01:12:31 -07:00
Rezmason
2265e3c937 Performing extensive cleanup and adding comments to rainPass.compute 2021-10-22 23:44:45 -07:00
Rezmason
af44126926 Renaming the data texture to "state" in the rain pass's render program 2021-10-22 22:58:10 -07:00
Rezmason
5c77e9b690 Renaming a value in highPass.frag 2021-10-22 22:57:37 -07:00
Rezmason
1a97861fed Resurrections version now vertically spaces the glyphs (groan). 2021-10-22 22:57:14 -07:00
Rezmason
6d8f5ba41a Overhauled the rainPass's support for the "operator" version of the effect. It now overrides the brightness of any glyph brighter than a threshold, which I think is a much clearer concept.
Also changed the way the glyphs cycle in the "operator" version, after noticing they only change once every four or five frames in the original effect.
2021-10-22 08:38:37 -07:00
Rezmason
7569246b5b Renaming rainPass shaders, and updating TODO. 2021-10-22 00:48:49 -07:00
Rezmason
d285697640 Documenting the passes and config variables. 2021-10-20 21:50:01 -07:00
Rezmason
4c6ff879fd Added some documentation, cleaned up some code, fleshed out the remaining work to make the project a little easier for newcomers to approach 2021-10-20 21:01:32 -07:00
Rezmason
f6e12ad795 Renaming renderer to rainPass, renaming its shaders, and cleaning up the main code a little. 2021-10-20 09:58:03 -07:00
Rezmason
4e88f68560 Whitespace fixes. 2021-10-20 08:26:16 -07:00
Rezmason
d8a1409907 Pushed virtually all the shader source into shader files that load as assets. 2021-10-20 03:20:46 -07:00