renderer.setSize() inside Worker

Today I was working on implementing parallel processing to animate from a worker, and have everything working (including resizing, orbit controls, etc.) however, this one I’m a little puzzled on. Is there a better way to go about this? = {} // Offscreen Canvas does not have a Style!
renderer.setPixelRatio( devicePixelRatio )
renderer.setSize(width, height)
renderer.setClearColor( 0x000000, 0 )

Resorted to setting .style on the Offscreen Canvas to an empty object. Width / Height are being set from a Vue component on main thread as it resizes by styling and all appropriate settings are sent to the worker. Everything seems to be working flawless, including a column drag / drop which resizes the canvas. Chat GPT couldn’t answer why it was throwing errors, and google searches yielded nothing as to a how you’d do this “properly.” Soo, this was the fix.

Or perhaps I should submit a bug: Three.js should be updated to check if the Canvas has a .Style when setting the Width / Height to

You are supposed to call this method in workers like so:

renderer.setSize(width, height, false);

The third parameter controls whether the style attribute of the renderer’s canvas gets updated or not. Default is true.


Well sh**!! Could’ve sworn I checked the documentation, but, there it is… Funny how I got all of the more difficult stuff sorted out, and then this :smiley:

Kids, don’t drink and code.

Thank you for pointing out the simplest of solutions.