Surface Normals and Shading

Edit: I spent another 10 or so minutes after posting this today, and managed to get a wall reveal/penetration thing working! The image has been updated accordingly.

Hey Folks! Getting a bit closer now with the new rendering code. As you can see in today's screenshot, the line of sight mesh is now rendering appropriate texture colors for the exposed floor, as well as a simple lighting component based on the floor's normal maps.

Moving the cursor around moves the light, and the effect is a bit like Teleglitch right now, if you've played that. Big, chunky pixels, and fields of shadow projecting outward from the center, making it look like we're staring down deep, black canyons to a lit floor.

It still needs some work to really shine (pun intended).

For one thing, it's only one light. If other lights were elsewhere on the map, spilling out into corridors and blending with the light we have here, we'd have a much more interesting composition. Right now, it's a bit like we have a single lantern in a dark cave (and, I suppose, this is what it'd look like walking through a derelict ship with pristine, uncluttered floors).

Another thing we're missing is visible walls. The light stops immediately upon hitting a wall, which is physically correct. But it'd probably be better if the walls were just a little bit visible, to reveal what they are. It'd make it possible to distinguish a door from a wall, for example, and to see other objects that should block light/cast shadow. One possibility here is to just give light blockers a special material that has some ambient lighting, or rim (edge) lighting. Another approach might be to expand the line of sight just slightly into walls.

I could also add more parameters to each light. Currently, the single light in the scene is pure white, and a certain distance above the floor. Being able to vary color or height could aid composition and mood.

We're still up there, though, in framerate. No visible hit yet. The real test will be when we start adding more lights to the scene. In theory, it shouldn't matter how many are in the scene, just how many are visible in the line of sight area. So having a ton across the ship is okay as long as we don't have too many in the same part of a room. But what "too many" is in this case has to be determined.

On a higher level, this feels good. I'm learning more and more about how things are rendered in Unity. And by replacing certain pieces with my own, I'm gaining a lot of control over what the player can see. Things I was afraid of trying before seem a lot more straightforward now, and that might open some interesting doors!

Comments

ra1's picture
ra1

Have you considered giving shadows a soft edge? Perhaps automatically extend a very short, invisible "soft edge occlusion line" from each corner/edge - and if the ray hits that line, lighting would be more muted from that point on.

dcfedor's picture
dcfedor

It'd be nice if I could. Apart from pinpoint, hard lights, soft edges would look more real. But soft edges are usually fairly expensive.

Still, there might be some ways to sneak that in there. Maybe via vertex color and extra skirt meshes, or blurring the shadows, etc.

Dan Fedor - Founder, Blue Bottle Games