Jump to content

Render a smaller canvas upscaled


al404
 Share

Recommended Posts

No, i don't think that works like that, i use a software that compiles .less files and applies changes to the browser without reloading

if a comment the renderCanvas size i see a really tiny window, after adding 100% and recompiling it gets full browser windows size and is all blurry 

also i notices that the project i'm working on it gets slow on my mac when i keep the browser window at a large size if i scale to a smaller size it gets a good speed

so performance is influenced by viewport size

Link to comment
Share on other sites

Hello

7 hours ago, al404 said:

so performance is influenced by viewport size

You are not the first one, who came up with this idea, small image less computer power, big image more computer power.
 

7 hours ago, al404 said:

also i notices that the project i'm working on it gets slow on my mac when i keep the browser window at a large size if i scale to a smaller size it gets a good speed

You have to do your performance tests, to get an optimized performance result (small image) without losses to the quality. so your costumers have a thoughtless time while consuming your product and paying money. 
 

7 hours ago, al404 said:

if a comment the renderCanvas size i see a really tiny window, after adding 100% and recompiling it gets full browser windows size and is all blurry 

Yes, caching the result distort every scientific research. Press Ctrl+F5 (will un-blurry everything)
Make also sure babylonjs generate minimaps for you so you have a nice time while developing. And also your texture base size is fits for your needs.

Imagine the last game you were playing (in the last 30years), was a tiny little window, before your screen size was recomputed, isn't that fascinating ?
So many things to ask, this world is a beautiful place.

Keep on exploring

@Deltakosh maybe i'm also totally wrong

 

Link to comment
Share on other sites

To give more precision

Canvas size sets by CSS is the DOM element size.

canvas.width and canvas.height define the internal buffer size. This is used by webGL.

By default babylon.js sets canvas.width = canvas.style.width and canvas.height =canvas.style.height. Which means: 1 pixel for 1 pixel.

 

You can change this ratio with engine.setHardwareScalingLevel(2) (ie. the internal buffer will be twice smaller than the DOM element)

Link to comment
Share on other sites

Hello 
Just a note: i think its a trail an error to find the balance between performance and quality.

if you do real time competition on any file, particular images make also sure that your render loop of babylonjs has callback to rescale , you can search here in the forum, how to dynamically re scale canvas and engine.   

Link to comment
Share on other sites

You said your images are blurry, and i told you to Press Ctrl+F5

make also sure your render canvas has a rescale callback! 

if (BABYLON.Engine.isSupported()) {
        var canvas = document.getElementById("renderCanvas");
          canvas.style.width = "800px";
        canvas.style.height =   "600px"; 

//....

  window.addEventListener("resize", function () {
    engine.resize();
  });

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...