What’s New in Jax – v0.0.0.8

I just pushed Jax v0.0.0.8 to RubyGems, so now I’ll take a moment and elaborate on what’s inside.

In terms of app-breaking stuff, there was only one change that you need to be aware of, and only if you’re using the “classic” Perlin noise functions that ship with Jax. The function “noise()” has been renamed to “cnoise()”. Simplex noise was not affected.

Now on to the good stuff. After pushing the ‘meadow’ demo, which uses vertex texture lookups, I found that vertex texture lookups are not supported on Windows at this time. In the meantime, there’s a GitHub repository that implements all flavors of Perlin noise without relying on texture lookups! And it’s licensed under MIT, to boot. Woot!

I did some quick, unprofessional benchmarks (I watched the recently-implemented framerate on my MacBook Pro) to confirm that the library is, indeed, considerably slower than the texture-lookup version. My framerate dropped from about 100 down to 50-60. Ouch. Since it’s slower, and not just by a few frames, I didn’t want to lose the texture lookups for those who could use them. I did, however, want the demo (and the functions!) to run for those who couldn’t.

The answer was to improve the shader preprocessor a bit, and take advantage of those improvements for Perlin noise. The result is Jax v0.0.0.8, now available. Here it is, in bullet form:

  • Added Jax.Shaders.max_vertex_textures to make accessible the number of vertex textures supported by the client.
  • Exposed a new local variable to the Embedded JavaScript used in shaders (the .ejs files) called shader_type. This is a string equal to either ‘vertex’ or ‘fragment’, and is particularly useful when you’re defining reusable function libraries where you don’t necessarily know which type of shader you’re in.
  • Jax built-in Perlin noise functions now silently fall back to the non-textured version if they are used within a vertex shader and VTL is not supported by the hardware. In all other cases, the texture lookup version is used for the speed benefit.

That’s it. Not a huge release, but a release with huge implications. As far as I know, the noise functions now run properly on all machines that run WebGL itself properly.

The best part about it is that when VTL support makes it to Windows, programs using Jax noise should automatically get a performance increase — just “because”.

(Note: about 20% of clients will continue to not support VTL even after this change goes through; those machines won’t get an automatic performance increase, but they will run Jax noise-based applications without issue. So that’s a pretty cool fringe benefit.)

Comments are closed.