A Spaceship - a demo that is a work in progress (WIP) An issue with glowing lights - my fix

I’ve been working on this demo for a number of reasons. I wanted to work some more on code around “walking a path”, talking animations, a kind of “follow” camera, and a “glow” effect. Here is the work so far :

The Spaceship

Hitting the “s” key will play first the “talk” animation and followed by the third-person walk. Hitting the “s” key again takes you on a different walk. In the top corner is some scene data - 15 draw calls, 18 meshes (the purple columns are instances).

Now you will notice some white vertical tubes - a single mesh that I want to make glow. And I used the following code :

//set the glow

var gl = new BABYLON.GlowLayer(“glow”, myScene, {
mainTextureSamples: 4
});

gl.intensity = 1.0;

And I get this :

Spaceship With Added Glow

The “lights” glow but the draw calls have climbed from 15 to 35! Is this normal?

So I modified the code for the “glow” like this :

var gl = new BABYLON.GlowLayer(“glow”, myScene, {
mainTextureSamples: 4
});

//include glow for just the light mesh
var theLights = myScene.getMeshByName(“wall_lights”);
gl.addIncludedOnlyMesh(theLights);

// set glow intensity
gl.intensity = 1.0;

And now I get this:

Modified Spaceship with glow

The draw calls drop back to 22, but rotate the camera left<>right and the lights now show through all the other meshes. I suspect It has to do with layers.

Any thoughts on what maybe I am doing wrong, or must I accept that jump in DCs ?

Stay Safe All, gryff :slight_smile:

Yes, I believe this is normal. As opposed to the highlight, the glow effect (layer) creates another pass on the scene render. Reason why I have started to abandon GL and work with just HL and direct light intensity.

Edit: In case you want to get a feeling of what it does/can do, you can check out my latest motorcycle project.
https://media-geneva.ch/demos/bjs/motorcycle/motorcycle-cdn-preview.html
Press 1 to 4 for the different front and back light states. By pressing 2 (full lights) you can see how the head and back lamps are nicely ‘glowing’. Though there is no GL in there. The result is achieved with a combination of HL, exploded emissive level (set at 2) on the reflector and glass and a directIntensity on the reflector and glass also pushed to 30 (for lights full). I found the final effect to be even better than when using GL. Hope this helps,

1 Like

“Kryten” :grin:. I saw the recent movie over Christmas.

On a more relate track, I was search docs for my own purposes on “renderingGroupId”. This term is not described beyond API docs. Guess you probably have to read the source code for that. I did get a hit on it for GlowLayer. Maybe query that to see if it the same across your scenerios. If different change it & see what happens.

@mawa : I took a look at your demo using the high lite method. I notice that when you hit the “2” key to activate the lights that the draw calls jump from 1358 to 1878 and the active indices and active faces increase dramatically.So it is having an impact.

When I try using a high lite layer with my spaceship, the draw calls are still elevated :slight_smile:

Modified Spaceship with High Light Layer

I will post my solution later today.

Stay Safe, gryff :slight_smile:

1 Like

Yes, I know that. But put a GL layer in there and I (probably you) get 50% more. I thought that this was already 50% saved. I’m eager to check out your solution :smiley:

Anyway here is my fix for “glowing”.

New Spaceship

It does not use layers but rather a “glow texture” that I used to texture the columns/lights. This texture was created in Blender and Gimp (see image below). The vertices count is up 300+ but the light is now a cylinder shape of which half is effectively hidden and can be removed to bring the vertices count below 6,000 again

@JCPalmer : I’m not sure it is a movie - more a special episode of “Red Dwarf” called “The Promised Land” that I saw on Prime Video. Instead of 30 minute episodes, this is series 13 that is a single 90 minute episode. The actor who plays “Kryten”, Robert Llewellyn, tells horrific tales about the makeup procedures he had to go through. Anyway, for you Jeff, enjoy my glow fix and some sound :slight_smile: Use Firefox as I have not yet added the Chrome sound fix as I want to add a GUI setup first.

The whole series is on Prime Video.

Stay Safe All, gryff :slight_smile:

Column/Light Texture

1 Like

It looks good. Though I’m afraid this will not work for my motorcycle front and back light. Thanks for sharing anyways. I might use this trick whenever I have a neon light on a wall.