How to scale a layer without bilinear interpolation

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
lynn
Regular
Posts: 28
Joined: Sat May 31, 2014 2:10 am
Contact:

How to scale a layer without bilinear interpolation

#1 Post by lynn » Mon Jun 30, 2014 4:41 pm

Is there a way to transform a layer with bilinear interpolation set to "False"?
I'd like to show a layer at double size without bilinear interpolation.
Last edited by lynn on Mon Jun 30, 2014 9:29 pm, edited 2 times in total.

User avatar
PyTom
Ren'Py Creator
Posts: 15893
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: How to use ATL Zoom without bilinear interpolation

#2 Post by PyTom » Mon Jun 30, 2014 5:20 pm

No - bilinear interpolation is hardcoded in at the moment.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

lynn
Regular
Posts: 28
Joined: Sat May 31, 2014 2:10 am
Contact:

Re: How to use ATL Zoom without bilinear interpolation

#3 Post by lynn » Mon Jun 30, 2014 5:23 pm

PyTom wrote:No - bilinear interpolation is hardcoded in at the moment.
Thanks for the quick reply. :)

So aside from ATL, is there any other way I could show a layer at double size without bilinear interpolation?

lynn
Regular
Posts: 28
Joined: Sat May 31, 2014 2:10 am
Contact:

Re: How to scale a layer without bilinear interpolation

#4 Post by lynn » Mon Jun 30, 2014 5:58 pm

I've tried using

Code: Select all

show layer mylayer at FactorZoom(2.0, 2.0, 0, bilinear=False)
Though the layer scales properly, setting the bilinear property to true or false seems to have no effect. It'll always use bilinear even if bilinear is set to false. Was that functionality taken out?

lynn
Regular
Posts: 28
Joined: Sat May 31, 2014 2:10 am
Contact:

Re: How to scale a layer without bilinear interpolation

#5 Post by lynn » Mon Jun 30, 2014 10:04 pm

Where exactly is this hard coded? Since my game is all pixel art, it may be easier for me to just adjust the code there rather than trying to do it dynamically.

In motion.py, I tried setting the bilinear parameter in ZoomCommon to False, but this seemed to have no effect either.

User avatar
PyTom
Ren'Py Creator
Posts: 15893
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: How to scale a layer without bilinear interpolation

#6 Post by PyTom » Mon Jun 30, 2014 10:47 pm

I don't think there's one place - it's throughout the code.

I'd suggest just doubling the pixels in an image program, and then using the pre-doubled images to make your game. That will likely work better than trying to synthesize the result on the fly.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

User avatar
Asceai
Eileen-Class Veteran
Posts: 1258
Joined: Fri Sep 21, 2007 7:13 am
Projects: a battle engine
Contact:

Re: How to scale a layer without bilinear interpolation

#7 Post by Asceai » Mon Jun 30, 2014 11:16 pm

You can still access nearest-neighbour scaling with the image manipulators im.FactorScale and im.Scale

lynn
Regular
Posts: 28
Joined: Sat May 31, 2014 2:10 am
Contact:

Re: How to scale a layer without bilinear interpolation

#8 Post by lynn » Thu Jul 03, 2014 11:29 am

For now, I've solved the problem by using im.FactorScale and condition switches for all images in my game. It's not an ideal solution because it means that I can't zoom in or out like I wanted, but it'll do. It would definitely help pixel artists if the option for non-bilinear scaling could be added back in renpy in the future. Linear interpolation is just not suitable for working with pixel art.

Post Reply

Who is online

Users browsing this forum: Hojoo