Modifie canvas resolution without changing canvas size

Hello Needle,

I’m saw that the performance of my website change if the resolution of the screen do. To prevent loss of performance, I would like to limit the resolution without changing the proportion, the size of my canvas.

How can I do it ?

Have a good day,

Hi Robin! I’m your friendly AI-powered assistant. I can help with questions regarding Needle Engine, three.js, and basic Unity or Blender help. Please reply with your question, and don’t forget to provide your OS, Needle Engine version, and any relevant Unity or Blender version! Have a great day!

2 replies left - GPT 4O
thread_LML626iO0QUtBnc0itPutarS
Reply to this message to continue the conversation

You can set the max size of the canvas on the Needle Engine context.

One way to do it would be in one of the hooks (you can paste this into your main.ts file for example)

onInitialized(ctx => {
    ctx.maxRenderResolution = { x: 1024, y: 1024 }
})

Or from a component in e.g. awake

export class LimitResolution extends Behaviour {
    awake() {
        this.context.maxRenderResolution = { x: 1024, y: 1024 }
    }
}
1 Like