Got some simple materials working. Struggled for a while because nothing I changed seemed to have any effect. Finally figured out that the problem was that I’m using mesh “instances” instead of actual meshes for each individual object on the screen, and instances can’t have their own unique material. Instances are a technique used to draw lots of copies of the same mesh without hurting performance. Each one can be moved, rotated, etc, but certain things (like the material) is the same for all instances of a mesh.

Here’s an example of BablyonJS drawing a thousand instances of a single cube.

In the image at the top of this post, you can see some transparent materials on those little dots. Those are my bullet meshes. I want them to be much brighter and have a glowy effect. Just need to learn a little more about the material system. It can do just about anything, with one notable exception being lots of independent lights. You’re only allowed eight lights in a scene, which is a really old-school restriction. That was a limitation of graphics cards in the 1990s. Modern engines allow you to have thousands of lights with barely any performance loss. BabylonJS claims to support 16 (on some systems) but it crashes for me if I try to go beyond eight.

Also added pause/unpause via the escape key.

Version here.

Latest version here.

Leave a Reply

Your email address will not be published.