BJS 6: Same scene, different performance numbers. Where to start?

Testing the upgrade path to BJS 6.0 and ran into some issues, namely performance…

BJS 6.01
image

BJS v5.57.1
image

As you can see, we’re getting very different results… namely, WAY more active meshes, active everything, resulting in way more draw calls.

The above numbers were taken from the exact same camera angle and position in the same scene… and no code has changed.

Can you send me in the right direction here? This is a production product with very deep setup. I’ll try to create a playground, but right now I’m looking for some architectural thoughts on how this might even happen from v5 to v6.

Jerry

A lot of draw calls dude :see_no_evil:

Yeah… I know… but I’m trying to figure out why it changes from one version to another.

I see, looks pretty interesting. How could the numbers be so distinctive if the scene is the same? Can you doublecheck? You just did an npm update of the packages and this suddenly happened? Can you rollback to v5 (really just install the older libs) and check the counts?

Theyve pushed some perf related updates btw, maybe try on latest. If that doesnt help, I think the bones being there may be some kind of hint, seems weird to go from 0 bones to any

1 Like

There is really something strange going on, the total number of vertices is 0 in the first screenshot!

I don’t see anything that can explain this behavior between 5.57.1 and 6.1.0, because there are only few changes between the two versions:

Do you by any chance have a live link somewhere, so we can investigate the problem?

It’s really weird with times of draw calls after update. Do you have RTTs that are not rendered before? Like shadows, depthrenderer or any custom RTTs.

1 Like

Looks like the only way would be with the camera not being in the same exact spot so one sees all and the others sees nothing ???

Thanks, yep… I have literally have two versions live… one on v5, live, and one on my local machine. I’ll create a live version of that one… so I can rule out “localhost” issues, which I’ve had (they were related to webpack causing extra function calls) but that was the reverse of this issue performance-wise.

Basically, the scene loads and brings the user to the exact same point on both versions… and you then can see those differences, especially in the active meshes.

I am currently setting up a live link for both versions instances with a guest user account. I’ll have it ready this evening.

1 Like

Yeah… I hear you on that. I’ve dumped the camera position and orientation to make sure it was dead on exact!

Still… I’m not saying we’re not doing something bone-headed… but it sure will be interesting to find out what’s up.

yup I am genuinely curious about the issue :slight_smile:

same here! This is highly suspicious :slight_smile:

So… here are two live links to demonstrate the issue in this thread:

First, for BJS 5.57.1: https://test--scenegrinder.netlify.app
Second, for BJS 6.0.1: https://staging--scenegrinder.netlify.app

The system will ask you to login… please use:

username: tester@bjstest.com
password: test1234

Don’t worry about security here… it’s a throw-away account we’ll tear down when done.

After logging in, you’ll se one character called “Test Character.” Click it and it will take you to a SceneGrinder scene. If you do nothing after the scene loads, both scenarios will take you to the exact same camera position and angle.

You can bring up the debugger (assuming your focus is on the scene) by hitting “Alt-Shift-D” and keep in mind the debugger is shoe-horned into the scene, which is react around the edges, and sometimes the debugger doesn’t play nice within an existing react project. But, you should be able to use the debugger with no issues. There are a couple HTML overlays interfering with the top of the debugger. I just using my HTML console explorer to delete them, but if you need me to make them go away for the purpose of testing, I can.

Please let me know your thoughts and THANK YOU for your time and everything else you guys do.

Jerry

You are setting the performance priority mode to Intermediate in the 6.1 link. The problem is that this mode sets alwaysSelectAsActiveMesh = true for all meshes, which is counter-productive in your case because you have many meshes.

If you want to keep this mode, you should reset alwaysSelectAsActiveMesh to false after you create a mesh.

2 Likes

Ah… hmmm… I only added that in as a test. It was doing the same thing when NOT setting that mode. I will confirm, however.

Ok, so… yes… eliminating setting performance mode (my mistake) closed the gap… but not completely. There is still about 300 more draw calls and a lot more (millions) active indices and faces from one version to another. The active meshes, however, are exactly the same.

I have updated the live BJS 6 version… now BJS 6.2.0.

You should really make sure you use the exact same sources in both cases, and that only the BJS version changes…

In the 5.71 link, the second light is a point light, whereas in 6.2 it is a directional light with a shadow generator => it is the generation of the shadows which accounts for the 300+ additional draw calls.

1 Like

That is so odd. This is literally running the exact same source code. The thing that changes from the two deploys is the version of BJS being used. Everything else is loaded dynamically from the exact same database and object store. I do see a couple other differences now, too. It’s like the models load in differently from one version to the next. I am even seeing a height difference in one of the models.

I am investigating. @Evgeni_Popov thanks for the bump in the right direction.

Can u log the full requests including any url params coming from the client to the backend for each version?