Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411613 Posts in 69390 Topics- by 58447 Members - Latest Member: sinsofsven

May 09, 2024, 08:22:34 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperArt (Moderator: JWK5)2D terrain lighting
Pages: [1] 2
Print
Author Topic: 2D terrain lighting  (Read 8509 times)
eigenbom
Level 10
*****


@eigenbom


View Profile WWW
« on: June 12, 2012, 10:28:24 PM »

I'm working on a game at the moment, moonman, which has a tile-based world. In order to hide parts of the world from the user I'm calculating a global illumination-like term to blend with the world. Given the base layer and lighting layer, does anyone have any good suggestions about how to combine them? If necessary I can break the base layer up into sky, background and foreground layers, but I'm really just looking for an interesting idea..

Here's what happens when I just multiply the lighting directly:


The problem with this is the pillow-shading like effect on the terrain, which is fairly ugly. This can be alleviated by reducing the number of light levels:



even further..



Actually the last one is not too bad, but the contours are a bit too distracting. So I tried adding some noise to break them up.. but its also fairly ugly..



And finally, this is just a silly experiment, but I thought it looked cool.. Tongue


 
So my question/challenge is: Do you have any suggestions for improving this?

My primary goals are:
- Caves should be dark, areas adjacent to sky should be light
- Minerals/etc that are in the ground should by hidden if they are further than N blocks from the edge
- The vibrancy in the earlier screenshots should be kept as much as possible (the dark regions are sapping this away.. )
- It should be aesthetically minimal Smiley

Logged

eigenbom
Level 10
*****


@eigenbom


View Profile WWW
« Reply #1 on: June 12, 2012, 10:32:03 PM »

Another img with better colours and posterised lighting levels:
Logged

Schrompf
Level 9
****

C++ professional, game dev sparetime


View Profile WWW
« Reply #2 on: June 13, 2012, 01:14:00 AM »

For "aesthetically minimal", I'd say: just keep the last version, but reduce the brightness step count to just one or two steps. And then maybe go back to the "silly" version with smooth borders depicted at picture five.

Just a quick idea, I haven't put a night's thought into this obviously.

[edit] And, if you don't mind me writing something aside the topic: the original "vibrant" color scheme is not really pleasing to my eyes. I think this pink / dirty yellow combination isn't exactly vibrant. Make the sand more yellow, brighter, maybe put some brightness noise on everything. But that's just my personal taste.
Logged

Snake World, multiplayer worm eats stuff and grows DevLog
Miko Galvez
Level 7
**


Designer & Engineer


View Profile WWW
« Reply #3 on: June 13, 2012, 01:40:03 AM »

The 4th one (with noise) is the best one considering that it is actually soil/dirt. The 5th one (wavy) is cartoony and pleasing to the eyes but removes the pixel art feel of the environment. If you were gonna have that kind of texture, then why not have the actual outlines be as smooth as them?
Logged

peous
Level 2
**


Indie opportunist


View Profile
« Reply #4 on: June 13, 2012, 02:17:58 AM »

Nice ideas !
Maybe the lighting algorithm could be different depending on the tiles ?

Like Medevenx said, the dirt looks nice with noise, but the 5th could be nice for some kind of gem or goo, 1st one could be nice for foggy things, and 2nd for solid bricks (concrete...)

Is this possible on your code ?
Logged

eigenbom
Level 10
*****


@eigenbom


View Profile WWW
« Reply #5 on: June 13, 2012, 03:31:41 PM »

Thx for the feedbacks.

@schrompf - do you mean the image in the second post? The silly one is out-of-bounds as it requires a lot of processing, not that I would go with it anyway, the game has no curves. Wink

Thx for criticisms on the other screenshots vibrancy. Yeh I'm definitely getting over the dirt-brown colour, but that's a very interesting idea to put brightness noise on it. I'm also reserving full yellow for the sand material at this stage.

@medevenx+@peous Yeh I can make the dirt texture more noisy, but it's very interesting to consider that the lighting propagation through the block could also become noisy. Although I think that may be getting more complicated than I want, and mixing a noisy lighted block against a non noisy lighted block may be too strange..



Logged

Belimoth
Level 10
*****


high-heeled cyberbully


View Profile
« Reply #6 on: June 13, 2012, 05:16:52 PM »

Does the character emit light?
Logged

eigenbom
Level 10
*****


@eigenbom


View Profile WWW
« Reply #7 on: June 13, 2012, 05:47:16 PM »

There will be
- Global illumination (what this thread is about)
- Direct illumination (light masks around torches etc..)
- Glow effects (e.g., a faint green glow around mm when he's in the dark, glowing glowworms, etc..)

Logged

RyanB
Level 0
***


FIRE + SKULLS = AWESOME


View Profile WWW
« Reply #8 on: June 16, 2012, 12:19:02 PM »

Light doesn't fall off evenly.  It has an inverse-square falloff, so it is much more intense near the source of illumination.  Adjusting the resolution or noise won't change the overall levels of your gradients.

Placing a motivation for the lighting (torches, candles, bioluminescent moss, etc.) would help.

Shadows usually aren't pitch black.  They are affected by the bounce and ambient light.

The sky colour is a blue/purple and there is no impact of this skylight near the cave openings.

The colours seem random overall.

You are looking for tech solutions (global illumination, etc) to basic art problems.

Check out James Gurney for some tips on lighting and colour palettes.

Logged

Pixelulsar
Level 3
***



View Profile WWW
« Reply #9 on: June 16, 2012, 01:41:16 PM »

I actually really liked the one where you added noise even though you said it was ugly, it looked really good.  I liked the way it broke up the transition lines but kept the blocky look.  However my opinion on this isn't the best because I super overuse noise in almost everything. 

I might also suggest to make it go to pure black in the middle, which would really help with hiding underground caves and ores.
Logged

eigenbom
Level 10
*****


@eigenbom


View Profile WWW
« Reply #10 on: June 16, 2012, 04:29:23 PM »

@ryanb i know my colours are all shonky, but it's a double-edged sword, the lighting and colour have to be figured out in parallel.

of course its a technical problem, i'm not modelling direct light with an inverse-square falloff but rather some sort of weird multiply bounced global illumination. when i say GI i don't mean some technical definition of GI, but rather a rough analogue that makes sense in this weird 2D world where the viewer can see through solid objects into the side of a cave. for the direct lighting sources, torches etc., i plan on having masks with a more realistic falloff, but this is all some approximate GI lighting, used to fill the dark spaces more.

@pixulsar Glad you liked it, i guess my main issue with the noisy one is that it might be really messy with more complex block textures, and i wanted a more .. calming .. aesthetic. It doesn't look too bad on the flat dirt, but on a rock texture it might look really gross.

Thx for the comments everyone, I might just go with the simpler looking one for now (posterised), while I work on the colours of the blocks, blending in the light from the sky, coding up a hdr/aperture model (so the brightness of things get are relatively to the average energy in the scene), the direct lighting from torches etc., some blur from super bright regions, and god knows what else .. even a minimal aesthetic requires a lot of work to make it look alright Shocked
Logged

Ashaman73
Level 0
***



View Profile WWW
« Reply #11 on: June 19, 2012, 01:08:34 AM »

I think the noise variants looks best, but to be honest, the whole GI effect looks somewhat wrong. Looking at you base image, the yellow blocks are solid earth(?), the grey ones are cavern and the rest is sky/background, right ?

For me disturbing is, that light travels along solid(yellow) blocks. Have you tried to limit it to only grey and adjancent yellow blocks ? Or is it be more of a fog-of-war, shadowing unknown areas ?
Logged

eigenbom
Level 10
*****


@eigenbom


View Profile WWW
« Reply #12 on: June 27, 2012, 07:54:56 PM »

Good points ashaman, I will play around with the idea of shading only background blocks, and having a binary visible/notvisible for foreground blocks. stay tuned Smiley
Logged

DustyDrake
Level 10
*****



View Profile
« Reply #13 on: July 01, 2012, 10:20:59 PM »

Good points ashaman, I will play around with the idea of shading only background blocks, and having a binary visible/notvisible for foreground blocks. stay tuned Smiley
I just thought of something odd.
What about making the background get darker a little sooner?
something like this:

I made each foreground shadow one shade darker
Logged

eigenbom
Level 10
*****


@eigenbom


View Profile WWW
« Reply #14 on: July 02, 2012, 12:32:29 AM »

hmm yeh thats an interesting effect.. Smiley
Logged

eigenbom
Level 10
*****


@eigenbom


View Profile WWW
« Reply #15 on: July 08, 2012, 07:56:21 PM »

Here's another test, with some tweakage, and using DustyDrakes idea of making the foreground pop a bit by upping a lighting level..

Logged

FibonacciSpaghetti
Level 0
**



View Profile
« Reply #16 on: July 11, 2012, 06:47:52 AM »

Hey, sorry to derail the thread here, but is there some accepted way of doing this kind of lighting (the basic falloff from visible to obscured tiles)?
Logged
jazeker
Guest
« Reply #17 on: July 11, 2012, 01:59:20 PM »

I think you should really continue with the last effect, it works very good!
Logged
Ashaman73
Level 0
***



View Profile WWW
« Reply #18 on: July 11, 2012, 09:38:41 PM »

Here's another test, with some tweakage, and using DustyDrakes idea of making the foreground pop a bit by upping a lighting level..


This looks really promising. Maybe you should add some kind of shadow from the sun (=your smiley), i.e. halfing value when not direct lighted from sun or one of your other light sources.
Logged

eigenbom
Level 10
*****


@eigenbom


View Profile WWW
« Reply #19 on: July 12, 2012, 05:32:42 PM »

Hey, sorry to derail the thread here, but is there some accepted way of doing this kind of lighting (the basic falloff from visible to obscured tiles)?

You mean the actual falloff function? I don't think so, although the inverse square law will look alright.

@jazeker which one? quote the image..

@ashaman Cheers, yeh having a sun source is a good idea, but I'm really trying to find the most simple/minimal solution for lighting.

Here's some more images, crossposted from my devlog

Logged

Pages: [1] 2
Print
Jump to:  

Theme orange-lt created by panic