Occlusion Culling and Render Scale

Hey guys. Have you implemented these features or tested other implementations with this engine?

Original Post on Discord

by user 263677777536876546

:wave: render scale exists in three, you can access that via this.context.renderer.setPixelRatio
https://threejs.org/docs/#api/en/renderers/WebGLRenderer.setPixelRatio

Occlusion Culling: we’re doing regular frustum culling for all meshes, bringing over baked occlusion culling data from Unity isn’t supported right now but there are three-based occlusion culling solutions you may be able to use - what’s your usecase for it?

thanks! :cactus: it s for our website that contains multiple rooms with a camera transitioning between them. the problem is that sometimes it hangs on safari ios and the page automatically reloads. i m searching for solution for a better framerate on mobile devices :slightly_smiling_face:

by user 263677777536876546

also, the performance is pretty impressive regarding that i m testing on an iphone xs, but it has some stuttering at certain points

by user 263677777536876546

i just found out that this stutter only happens on production build. i also tried changing his.context.renderer.setPixelRatio but it didn t change the resolution

by user 263677777536876546

this.context has a scale property i think, need to check the exact name tomorrow

When it reloads is there any data that is progressively loaded e.g. due to objects becoming visible (or videos starting or something similar)? Are those production builds? Did you change the texture compression settings (to e.g. webp). It may be caused by out of memory if there are many large progressive textures loaded with webp compression (when objects become visible)

thank you! there were some textures in the scene with the compression set on “auto”. those caused the memory spike :slightly_smiling_face:

by user 263677777536876546

What kind of textures where those? Auto does by default use KTX2 compression (wether ETC1S or UASTC depends on the channel/slot/usage of the texture e.g. if it’s a normal map or a albedo map)

1 normal and aprox 15 albedos

by user 263677777536876546

How big are those textures? Maybe it’s worth / necessary to clamping their max size (you can do it in the texture settings for Needle Engine only - they will then be resized on export/during compression)

i solved it by choosing the right size and compression

by user 263677777536876546

Which size was it before/is it now? And which compression did you choose?

UASTC for normal and ETC1S for albedos. I didn t measure the size before, but the loading time improved drastically :slightly_smiling_face:

by user 263677777536876546

Sorry bad wording: I meant which resolution/maxSize did you have for the textures before? Or did you not change that?

i changed it to 512x512 maximum. there were some with 2048x2048

by user 263677777536876546

it has the property resolutionScaleFactor but i have to upate the domElement width and height in lateUpdate() in order for it to fill the entire screen:

        this.context._resolutionScaleFactor = .5;
        this.context.renderer.domElement.style.width = this.context.domWidth + "px";
        this.context.renderer.domElement.style.height = this.context.domHeight + "px";
        ```

*by user 263677777536876546*