How do I change sampling type during runtime?

0 favourites
  • 5 posts
From the Asset Store
Change delay, create new lines, "backspace" the text
  • Is there a way to switch between point and linear while the game is running?

    Vaguely related, is there a way to change the "Fullscreen in browser" setting (which is valid already in windowed mode, at least in all the browsers I've tried) without requesting fullscreen?

  • Trying one more time with a bump...

    Is the answer "no one knows" or "it's not possible"?

  • Hey derboo,

    Point & Linear

    I don't think you can change the sampling type at runtime.

    I'm not sure, but I think it might be because the canvas has to be set up differently, at the HTML5 level, for either render mode.

    You can change the pixel-rounding mode, at runtime, but that just snaps object visuals to integer coords for rendering, it doesn't affect the way textures are sampled. Though combining snapping with the pixelate effect shader might get you part way to recreating the look of point sampling, and it would be toggleable at run-time. Though there would be some discrepancies, when compared with actual point sampling.

    Just out of curiosity, why is it that you were interested in changing the sampling type at runtime?

    I vaguely remember looking for a way to do that quite a while back, but I don't recall why.

    Anyway, even if there's not a direct way to get the effect you want, there might be a workaround that could approximate what you're looking for. I'd be happy to suggest anything I can think of.

    I do have a thought on how you could effectively build your own custom point sampling system on top of the built-in Linear mode, in a way that would allow you to toggle it at runtime, though its efficiency might become an issue depending on the game and target platform. You could run the game in linear mode, use effects to pixelate individual objects (point sample their textures), and then pixelate the entire screen (point sample the canvas). I think that might almost perfectly recreate the point sampling look. Though the pixelate scale would need to match the scaling factor of the entire game. It could be a handful to set up and maintain, but the effect could be toggled on and off at runtime.

    Fullscreen in browser

    As for the "Fullscreen in browser" project property, I don't know of any way to change it at runtime, though I believe the "Crop" mode gives you enough freedom to recreate the appearance of any of the other scaling modes, though you'd need to build them yourself via events.

    For instance, the game I'm currently working on runs in Crop mode, but I have a custom scaling system (via events) that fits a GameBoy sized screen (160 x 144) into arbitrary monitor dimensions by integer up-scale. Likewise, I have a custom letterboxing system that can toggle letterbox bars to clip the screen, to show only the GameBoy screen (the 160 x 144 zone), or just let the game screen extend beyond GameBoy res to fill the monitor.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thanks for the elaborate reply! What I'm hoping to achieve is letterbox integer scale with point filtering on desktop devices but letterbox scale with linear filtering for mobile devices. I'll try fiddling around with the crop setting then, although the way things seem it may be easier to just export two separate versions for this...

  • We use autoscaling for everything:

    https://drive.google.com/open?id=0B-xiq ... 0lDRklrNVU

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)