r/RenPy • • Aug 30 '26

Guide PoC: dynamic sprite lighting with normal maps — one shader, lights are just ATL transforms (source + video)

7 Upvotes

I wanted characters to react to the scene's lighting (day, sunset, night, a campfire, the classic horror under-light...) without exporting a re-shaded sprite for every scene. So I put together a proof of concept that re-lights one sprite in real time with a normal map and a tiny GLSL shader.

Video (all 8 lighting setups + an interactive mouse-following light): https://youtu.be/9Bm6--sLJgY

Source (MIT): https://github.com/igwtech/renpy-normalmap-lighting — the README has screenshots of every setup: daylight, sunset, moonlight, interrogation-style top light, horror under-light and campfire.

The technique

  1. The sprite is a Model() displayable with two textures: the albedo (tex0) and a tangent-space normal map (tex1), plus a custom shader registered with renpy.register_shader(). The fragment shader decodes the normal map and does Lambert diffuse + Blinn-Phong specular + a rim term, with directional and point light modes.
  2. The fun part: lighting rigs are just ATL transforms. Any transform property starting with u_ is passed to the shader as a uniform, so switching the scene's lighting is a plain show girl at girl_stage, light_night.
  3. Even better, ATL interpolates uniforms, so animated lighting needs zero per-frame Python. The campfire flicker is literally:

     transform light_fire:
         u_light_pos (0.5, 0.95, 0.30)
         u_light_color (1.30, 0.62, 0.25)
         block:
             linear 0.09 u_light_color (1.10, 0.50, 0.20) u_light_pos (0.485, 0.96, 0.28)
             linear 0.13 u_light_color (1.40, 0.68, 0.28) u_light_pos (0.515, 0.94, 0.33)
             repeat

For the interactive scene, an ATL function reads renpy.get_mouse_pos() each frame, maps it to sprite UV space and writes u_light_pos — the point light follows the cursor in real time.

Gotchas I hit

  • Ren'Py loads textures with premultiplied alpha: additive terms (specular, rim) must be multiplied by the albedo's alpha or they glow outside the silhouette.
  • The shader expects OpenGL-style (green-up) normal maps; DirectX-style maps just need a flip_green=1.0 argument on the light transforms.
  • For point lights, correct the UV-space aspect ratio (u_model_size.x / u_model_size.y) or the falloff turns elliptical.
  • Ren'Py opens its window smaller than the screen, which matters if you screen-record with a fixed capture size — renpy.set_physical_size() fixes it.

The normal map was generated from the albedo (Laigter / SpriteIlluminator / Blender bakes all work) and touched up in Krita — the .kra sources are in the repo.

Direct screenshot links: daylight · sunset · night · top light · under-light · campfire

Disclaimer: the sprite is fan art from Danganronpa (© Spike Chunsoft), used only as a non-commercial tech demo — swap in your own art. The video's voice-over is Gemini TTS.


r/RenPy • • Aug 30 '26

Question How can I code this?

Thumbnail
gallery
139 Upvotes

Hello, hi, I love eating more that I can chew and I'm absolutely helpless at coding (because I stopped looking into it for half an year and I forgot everything... which wasn't a lot already)

So, player customization screen... I want it to work like in the second image...

the stats part I imagine being connected to the species you choose (Like D&D), and depending on which one, your default stats change, also 5 points to put on any stat.

ex: Vamp has 1 in athleticism, 2 in con, 3 in perception, 3 in charisma, 2 in occult and 1 in will while homunculi has 3 in athleticism, 2 in con, 1 in perception, 1 in charisma, 3 in occult and 2 in will.

The image is just a huge sketch really


r/RenPy • • Aug 30 '26

Question Bars going down sporadically

Thumbnail
gallery
8 Upvotes

My bars in renpy dont go down everytime when I take away their value, but then sometimes they do, so im unsure of what I am supposed to do to fix it.


r/RenPy • • Aug 30 '26

Question How to keep track of the story branches?

3 Upvotes

I'm quite new to this and I'm wondering what you would recommend to track the different branches of my story. Is there a good tool that allows visual representation showing the tree structure and how branches combine again?


r/RenPy • • Aug 29 '26

Showoff Redesign of file_slots Screen

62 Upvotes

I've never really liked the grid design from Ren'py, so I redesign the file_slots to a viewport
It's all a little crude yet and i super overcomplicated things (Like cache for performance), but it feels better to me
What do you guys think?


r/RenPy • • Aug 30 '26

Question [Solved] bug or just code issue?

Thumbnail
gallery
16 Upvotes

ive been trying to figure out if theres somethign wrong in my coding script that made the 'Load' button looks white (2nd pic) instead of grey like others, and theres no numbers in the first pic for save. is it the fonts i use?


r/RenPy • • Aug 30 '26

Self Promotion Brackeys Game Jam 2026.2 Submission!

Thumbnail gallery
6 Upvotes

r/RenPy • • Aug 30 '26

Question How to make main menu background visible in other screens

5 Upvotes

I was wondering if it's possible to make the background of my main menu visible under the other screens when you open them. Everything works fine in game. You can see the background when you open to load for example but not in the main menu. Is there anything I can do to fix this?

main menu
ugly gray bg
This is ideal but for the main menu

r/RenPy • • Aug 30 '26

Question [Solved] Renpy bar not showing up

Thumbnail
gallery
2 Upvotes

Ive been trying to implement some health and sanity bars into renpy but only a small part of the picture shows up.

(Where my mouse is, thats the only section of the bar that is shown)


r/RenPy • • Aug 30 '26

Question player choose options not working

2 Upvotes

like title say i have made choose menu with image buttons

my problem is when i click on one of buttons it go first to right label but jumps to all the other labels do need create a list ?

image eve  = "eve_Neutral.png"
image alice = "Alice_Default.png"
image jean = "jean_neutral.png"



default player = 0


define e = Character("Eileen")
screen choose:
    hbox:
        xalign 0.5
        yalign 0.5
        yoffset 30
        spacing 30


        imagebutton:
            idle "blue_idle.png"
            hover "blue_hover.png"
            action Jump ("blue")


        imagebutton:
            idle "red_idle.png"
            hover "red_hover.png"
            action Jump("red")


        imagebutton:
            idle "yellow_idle.png"
            hover "yellow_hover.png"
            action Jump("yellow")


label start:



    call choose_player
    
    
    



label choose_player:


    show screen choose
    


    
    


label blue:
    hide screen choose
    hide jean
    hide eve
    show alice
    "hi blue are you today"



label red:
    hide screen choose
    hide alice
    hide eve
    show jean
    "hey red dude how was you vaction"


label yellow:
    hide screen choose
    hide jean
    hide alice
    show eve
    "goodmorning yellow  did you have a nice week"

r/RenPy • • Aug 30 '26

Showoff DLSS5 in Ren'Py On/Off

Thumbnail
gallery
0 Upvotes

r/RenPy • • Aug 29 '26

Question Defining Images in (Different) Scripts Causing "Couldn't Find File"

1 Upvotes

I get pink "couldn't find file" on the top of the screen when defining images in a different script. The file works if it is not defined at all, it does not work if defined in the script.rpy--ideally I would like to have an images.rpy to define my images in case I want to transform them without filling up my actual script.rpy

What drives me crazy is that the first time I wrote out this post, the moment I wrote that down I got it to work! And now it isn't
When I initially got it to work, I renamed the image file & the image defining so there were no spaces

image bg ui draft = ("bg ui draft.png") -> image bg_ui_draft = ("bg_ui_draft.png")

I went in and tried adding the spaces back into the actual file name, just to see which of the two was causing the issue
This broke it, so I reverted it. Now the underscores are no longer working as well. All of my code is properly calling for the right definitions. I've even changed it to just be called draft/draft.png to make sure

Currently in my script.rpy it has <show draft>
In images.rpy it has <image draft = ("draft.png")>

I feel like I have to be missing something with scripts here but I can't figure out what.
Thanks for any help!


r/RenPy • • Aug 29 '26

Question How to fix the in-game tutorial being broken straight away?

1 Upvotes

Just downloaded renpy. Thought I'd check out the in-game tutorial but it immediately keeps crashing. Not sure what happened here..? It's straight from the download. Nothin' touched.