The art testSo I'd like to do a little write up on the art test I did last summer/fall.
I knew I wanted the game to have a 2d look with orthographic cameras. I stumbled upon a program called
SpriteLamp, which enables the generation of normal maps from 2d images. There are other more streamlined programs out there that does the same thing, but none creates the look, or gives you the control that this does. Mainly because it's all done by hand, which is a problem when it comes to scope, so we'll see if this is the one I'll keep using or not down the line.
The program requires you to input 4-5 images of the sprite lit from different directions. Left, Right, Top, Bottom and Front.
You also have to create the diffuse and specular map for proper rendering in the game engine, similar to a classic 3d workflow.
Here's my player character lit in-game.
Now this might be alright for characters but I knew I'll have quite a lot of environments to create as well, and they contain ALOT of pixels and complexity in terms of geometry and I'm not good enough of an artist to create that by hand. It would simply take too much effort.
So I came up with the idea that if I could create the scene in 3D and simply render out the light maps, I would get a lot of that information for free. Then it would simply be a case of hand-painting the diffuse on top of that information. It's obviously cheating, and probably will have me tarred and feathered in the pixel art community, but hey... it works.
Environment lit from the front.I also knew I'd want reflections from rainy streets since hey... cyberpunk. So I rendered out a reflection pass as well.
The reflections also receive the light information. The character reflections are just mirrored versions of their sprite sheets for now.
So that all worked out pretty much perfectly, there was only one problem, which was shadows.
The SpriteLamp shaders do have the ability to handle some self shadowing from the depth maps that it creates, but it wasn't nearly enough. Especially when it comes to character throwing a shadow onto another object which just isn't possible at all. I tried to render out the depth map from my 3d program, but that didn't work either.
The real issue is that you can't really have shadows dance across geometry because that depth doesn't exist.
Then I remembered that I had the scene in 3d already, and maybe I could utilise that in my game somehow to generate the shadows.
So imported the 3d mesh, and made a shader that only gives me the shadow information and rendered that on top of the rest of the scene through a secondary camera.
I also have a copy of my characters walking around on that 3d geometry, so they can cast their shadows onto the 3d mesh.
And it's still looks like it's in 2d, because it is!
Here's a perspective view.
The second benefit of having a 3d mesh match the background is that I can have VFX responding to the geometry, without having to bake it into some kind of background animation. And not only that, I can also have those effects get affected by light as well.
So that's pretty much it. There are still some issues with this technique that I haven't had time to solve yet, like the 3d version of my character gets smaller the further away from the camera he gets, which isn't the case in the 2d view, because it's orthographic, so I have to scale them accordingly the further into the scene they get.
I also haven't completely solved the geometry self shadowing itself, but I think that's mostly a case of picking and choosing what geometry actually cast shadows, right now none of them do, but we'll see.
This was good enough of a test to give me the confidence that this will work, though.