# Day, sunset and night backgrounds in Ren'Py

> Markdown version of https://anibg.com/guides/renpy-day-night-backgrounds/ · Everything on the site: https://anibg.com/llms.txt

How to put a three-time background set into a Ren'Py project, cut between the hours with a dissolve, and let one variable pick the right picture. Written against the Ren'Py 8.6 documentation.

Updated: 2026-11-29

Every scene in the [library](https://anibg.com/backgrounds.md) is a set: the same room from the same camera, at day, sunset and night. In a visual novel that lets you change the hour without the room moving. This guide covers where the files go, the few lines of script you need, a variable that chooses the time for you, and what to do when your project isn't 1920×1080. The [visual novel page](https://anibg.com/for/visual-novels.md) has the short version.

## Put the set in game/images

Download the set (.zip) from a scene page, for example [Window-side classroom](https://anibg.com/backgrounds/classroom/window-side-classroom.md). Inside are three JPGs and a licence file:

```text
bg window_side_classroom day.jpg
bg window_side_classroom sunset.jpg
bg window_side_classroom night.jpg
LICENSE.txt
```

Copy the JPGs into your project's `game/images/` folder. A subfolder such as `game/images/backgrounds/` is fine: Ren'Py searches every folder under `images`, and the folder name does not become part of the image name. Keep `LICENSE.txt` with your project notes; Ren'Py ignores it either way.

## Why you don't need image statements

The Ren'Py documentation (Displaying Images, "Images Directory") says that for a `.jpg`, `.jpeg`, `.png`, `.webp`, `.avif` or `.svg` file under `images`, "the extension is stripped, the rest of the filename is forced to lowercase, and the resulting filename is used as the image name if an image with that name has not been previously defined."

So `bg window_side_classroom day.jpg` becomes the image `bg window_side_classroom day`, and this works with nothing else defined:

```renpy
label start:
    scene bg window_side_classroom day
    "The last bell rang an hour ago."
```

The first word, `bg`, is the image's tag. All three files share it, so a new background always replaces the old one. The place name is written with underscores so it stays one word. If you ever write your own `image bg window_side_classroom day = ...`, yours takes priority over the file.

## Dissolve from one hour to the next

```renpy
    scene bg window_side_classroom sunset with dissolve
    "Nobody came to collect the keys."

    scene bg window_side_classroom night with Dissolve(2.0)
    "Across the road, the flats lit up one window at a time."
```

`dissolve` takes 0.5 seconds. `Dissolve(time)` sets your own length; one to two seconds suits a change of hour.

![The window-side classroom split into three vertical bands: the left band at day with blue sky, the middle at sunset in orange light, the right at night in blue shadow. Desks, windows and the chalkboard continue across the joins.](https://anibg.com/guides/img/renpy-day-night-backgrounds-bands.webp "One scene, three files. The joins fall on the same desks because the camera never moved.")

A dissolve between two unrelated pictures reads as a cut to somewhere else. Between two pictures of the same desks, the outlines stay put while only the colour and shadows move, so it reads as the same room, later. That only works if the edges line up, which is why each set is generated once and relit for the other times instead of being painted three times. How we do that, and where it still slips, is in [Day, sunset and night that match](https://anibg.com/guides/consistent-day-night-backgrounds.md).

`scene` clears the whole layer, sprites included. If characters are on screen and you only want the light to change, use `show` instead: because the tag `bg` is already showing, the new picture replaces the old background where it is, and the sprites stay.

```renpy
    show bg window_side_classroom night with dissolve
```

## Let a variable choose the time

Once a story has more than a few locations, writing the time into every `scene` line gets tedious and easy to get wrong. Keep the time in one variable and build the image name from it:

```renpy
default time_of_day = "day"

init python:
    def bg(place):
        name = "bg {} {}".format(place, time_of_day)
        if not renpy.has_image(name):
            name = "bg {} day".format(place)
        return name

label start:
    scene expression bg("window_side_classroom")
    "Lunch break."

    $ time_of_day = "sunset"
    scene expression bg("window_side_classroom") with dissolve
    "Club activities ran late."

    $ time_of_day = "night"
    scene expression bg("school_rooftop") with dissolve
    "The door to the roof wasn't locked."
```

`scene expression` takes any expression that gives an image name. A string with no dot in it is read as the name of an image, so `bg("school_rooftop")` at night returns `"bg school_rooftop night"` and Ren'Py finds the file from the rooftop set. Because the variable is declared with `default`, it is saved with the game, and a loaded save comes back at the right hour. The `has_image` check falls back to the day picture when a place has no file for the current time, which matters once you add rain or snow for some places only.

Ren'Py also has dynamic images (`"bg window_side_classroom [time_of_day]"`) and `ConditionSwitch`. Both re-check the variable at the start of every interaction, so the picture changes on the next line after the variable does. The explicit `scene` line above keeps the change, and its transition, where you wrote it.

## If your project isn't 1920×1080

When you create a project, the Ren'Py launcher offers 1280×720, 1920×1080, 2560×1440, 3840×2160 or a custom size, and calls 1920×1080 "a reasonable compromise". It is the default, and at that size the backgrounds fill the screen as they are.

In a 1280×720 project, Ren'Py does not shrink a bigger picture to fit. The default placement centres an image horizontally and aligns it to the bottom of the screen, so you would see only the bottom middle of the room. Either resize the files to 1280×720 before they go into `images` (on a Mac, `sips -Z 1280 *.jpg` in a folder of copies does it in place), or scale them in the script:

```renpy
transform fit_screen:
    xysize (config.screen_width, config.screen_height)

label start:
    scene bg window_side_classroom day at fit_screen
```

Resizing the files is the better choice: the game gets smaller and the picture looks the same.

For a 2560×1440 or 3840×2160 project, scaling a 1920 picture up makes it soft. [Studio](https://anibg.com/studio.md) can produce any library scene at 4K (3840×2160). To change an existing project's size, the launcher's "Change/Update GUI" asks again, but it overwrites most GUI images and `gui.rpy`, so back them up first.

## Sprites and the floor

The scenes are framed at eye level, with the lower middle left open: floor, an aisle, a path. Ren'Py's `left`, `center` and `right` positions all align to the bottom of the screen, so a full-height sprite drawn with its feet at the bottom of its canvas stands on that floor in front of the furniture.

![The back of a classroom at day, looking towards the chalkboard. Two tall rounded outlines on the left and right of the open aisle show where standing sprites would go.](https://anibg.com/guides/img/renpy-day-night-backgrounds-sprites.webp "Where sprites stand: the aisle and floor in the lower middle are left clear.")

Two things help a sprite look as if it is in the room. Put its eye line near the background's horizon (the camera height), since an eye-level camera sees a standing person's eyes at about that line. And match the light: a sprite shaded for daylight looks pasted onto a night room. A tint per time is a cheap fix:

```renpy
transform night_tint:
    matrixcolor TintMatrix("#9aa3c8")

label night_scene:
    scene bg window_side_classroom night
    show hana at center, night_tint
```

Replace `hana` with your own sprite's tag. Pick the tint colour from the background itself; the colour chips on each scene page give its five main colours.

## Rain, snow, phone and 4K

The library has day, sunset and night. For rain or snow in the same place, a vertical 9:16 crop or a 4K file, open the scene in [Studio](https://anibg.com/studio.md) and choose what to change; it keeps the composition. Name what you get the same way, for example `bg window_side_classroom rain.jpg`, and the `bg()` function above picks it up when `time_of_day` is `"rain"`.

## Before you submit to a jam or a store

Every image here is AI-generated. The [licence](https://anibg.com/license.md) lets you use them in games you sell, without credit. Platforms and jams have their own rules: some jams ban AI-generated assets, Steam asks you to disclose them, and itch.io has a disclosure field. [Using AI backgrounds commercially](https://anibg.com/guides/ai-backgrounds-commercial-use.md) goes through what each one says.

## In the library

Scenes this guide talks about, as full sets. Free at 1920×1080.

- [Window-side classroom](https://anibg.com/backgrounds/classroom/window-side-classroom.md) (bg-001): https://anibg.com/i/s/bg-001/day-1920.jpg
- [Back of the classroom](https://anibg.com/backgrounds/classroom/back-of-the-classroom.md) (bg-013): https://anibg.com/i/s/bg-013/day-1920.jpg
- [Rainy window classroom](https://anibg.com/backgrounds/classroom/rainy-afternoon-classroom.md) (bg-440): https://anibg.com/i/s/bg-440/day-1920.jpg
- [School rooftop](https://anibg.com/backgrounds/rooftop/school-rooftop.md) (bg-004): https://anibg.com/i/s/bg-004/day-1920.jpg
- [Student bedroom](https://anibg.com/backgrounds/bedroom/student-bedroom.md) (bg-002): https://anibg.com/i/s/bg-002/day-1920.jpg
- [One-room apartment](https://anibg.com/backgrounds/bedroom/one-room-apartment.md) (bg-021): https://anibg.com/i/s/bg-021/day-1920.jpg
- [Country train platform](https://anibg.com/backgrounds/train-station/country-train-platform.md) (bg-006): https://anibg.com/i/s/bg-006/day-1920.jpg
- [Ticket gate hall](https://anibg.com/backgrounds/train-station/ticket-gate-hall.md) (bg-044): https://anibg.com/i/s/bg-044/day-1920.jpg

## Try it in Studio

> An empty school corridor after club activities, lockers along the left wall, windows on the right, eye-level view, floor clear in the middle

Open in Studio with this prompt: https://anibg.com/studio/?prompt=An+empty+school+corridor+after+club+activities%2C+lockers+along+the+left+wall%2C+windows+on+the+right%2C+eye-level+view%2C+floor+clear+in+the+middle&time=sunset&utm_source=agent&utm_medium=llms

## Other guides

- [One prompt, six image models: which paints anime backgrounds best](https://anibg.com/guides/best-ai-model-for-anime-backgrounds.md): In November 2026 we sent the same classroom prompt to six image models and set the pictures side by side, with what each one cost us. The free one held its own.
- [How to write a prompt for an anime background with no one in it](https://anibg.com/guides/anime-background-prompts.md): The rules we now write every library scene by, each next to the picture it changed. Every prompt on this page was sent exactly as shown, to Dreamina 5.0 at 2K.
- [Why AI anime backgrounds look flat](https://anibg.com/guides/why-ai-anime-backgrounds-look-flat.md): Our first 424 library scenes were made under house rules that caused six problems, each shown here on a picture of ours. The model was not the cause: the same model painted the better pictures.
- [One background in day, sunset and night, without the room moving](https://anibg.com/guides/consistent-day-night-backgrounds.md): Every scene in our library is one picture, relit twice. This is how we do it with an image model, the sentences we send, and the four things that go wrong.
- [A background behind your VTuber model in OBS](https://anibg.com/guides/obs-vtuber-background.md): Canvas, layer order, getting the model in with a transparent background, switching from day to night with a fade, and making the model and the room look lit by the same light.
- [Using AI-generated backgrounds commercially](https://anibg.com/guides/ai-backgrounds-commercial-use.md): Whether you may use an AI background in a game you sell is two questions: what the image's licence allows, and what stores, jams and copyright law say about AI-made material. Sources read on 29 November 2026.
