Lighting

Open-source port of PoP that runs natively on Windows, Linux, etc.
Post Reply
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

Lighting

Post by Norbert »

I was thinking it would be cool if lighting would be more modern (example; mirror). I very briefly looked into it for SDL, but it's too complicated. If I'm not mistaken, it would require rendering the entire scene to a texture (*), then pixel manipulation (*,*) to add a black layer of 50% opacity, excluding 200px circles around flames. If each scene only had 1 flame, I could've probably pulled it off by using a large, partially transparent, image. Of course, the 'real' way to do it would be a 2.5D side-scrolling remake in a modern game engine. Then adding the light sources would be relatively easy. Actually, that would be Prince of Persia Classic then, I guess.
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Various

Post by David »

Norbert wrote:I was thinking it would be cool if lighting would be more modern (example; mirror).
Here is my attempt on a separate branch: https://github.com/NagyD/SDLPoP/commit/ ... 2e72e9cfd8
I did not use per-pixel manipulation, only an image of a circle, and clever use of blend modes.

BTW, the Genesis version has something similar, but it's only a background: https://www.popot.org/level_editors/ima ... p-0.7b.png

Also, I have seen a few 2D games that do lighting, like SuperTux, or ZZT in dark rooms.
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

Re: Various

Post by Norbert »

David wrote:
Norbert wrote:I was thinking it would be cool if lighting would be more modern (example; mirror).
Here is my attempt [...]
Very cool! :D

[Edit: Suggestion, maybe if a room has no torches at all, make everything even darker. Or maybe the number of torches could determine how dark the room is? Either way, I really like this. This should totally make it into the main branch (as an option)...]
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Lighting

Post by David »

Moved posts to a new topic.
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Lighting

Post by David »

David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Various

Post by David »

Norbert wrote:This should totally make it into the main branch (as an option)...
I merged this into the master branch: https://github.com/NagyD/SDLPoP/commit/ ... 76356aa79c
Falcury
Calif
Calif
Posts: 565
Joined: June 25th, 2009, 10:01 pm

Re: Lighting

Post by Falcury »

Suggestion: maybe we could use a noise function (e.g., 2D Perlin noise) to generate a couple of animation frames with varying amounts of darkening, in order to simulate a flickering effect. The radius of the effect would then probably have to be a bit bigger, and the intensity would have to smoothly decrease with distance to the torch.
salvadorc17
Calif
Calif
Posts: 553
Joined: August 27th, 2011, 2:04 am

Re: Various

Post by salvadorc17 »

David wrote: April 9th, 2017, 5:27 pm
Also, I have seen a few 2D games that do lighting, like SuperTux, or ZZT in dark rooms.
Right, seems Genesis version is the one that tried it mostly, but for old games is not common, i have seen something similar in Nosferatu.
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

Re: Lighting

Post by Norbert »

Norbert wrote: April 9th, 2017, 5:31 pm[Edit: Suggestion, maybe if a room has no torches at all, make everything even darker. Or maybe the number of torches could determine how dark the room is? Either way, I really like this. This should totally make it into the main branch (as an option)...]
+ Maybe the flame color could impact the color of the circles?

Also, I suggest you replace data/light.png with one of the attached images.
Both are better than what's used right now.
The attached screenshot of SDLPoP in action is with one of those alternatives, and ambient_level set to 64.

I think it would be neat if the ambient_level was impacted by the number of torches in the room.
Really, this whole lighting thing is already great, but can become even better.
Don't be afraid to use lower ambient_level values.
I suggest a room default of 32, with each torch adding 32.
i.e. 0 torches = 32, 1 torch = 64, 2 torches = 96, etc.
Attachments
lighting.png
light.png
light.png (5.96 KiB) Viewed 1933 times
light.png
light.png (1.15 KiB) Viewed 1933 times
Nikonov_94
Efendi
Efendi
Posts: 5
Joined: March 27th, 2019, 5:45 pm

Re: Lighting

Post by Nikonov_94 »

If I can suggest a little thing, do you think you can add one more halo of light just around the flame? Because the intersection between the two circles of light created by the torches is brighter than the area right next to the flame, and it looks a bit strange.
Post Reply