This technique follows on from my exploration into this topic which I wrote most recently about last year. You will need to check out the first bit of my article on “creating 2D Illustration based normal maps” down to the section making the new normal map with light directions and then come back here.
I recently stumbled upon a video by Blender Smoothie 3D where he discussed the same technique but used a camera to take photos of the 4 light directions needed. He then used a node setup in Blender to create a normal map which could be lit dynamically within the software from them. In my article I mentioned that I had used a software called Sprite Lamp to do that part, however that software has not been updated in years and is not free to use, whereas Blender is. Additionally Blender Smoothie 3D has let people download the node setup for this technique (linked in the video description on YouTube). I recommend you give his video a watch if you are interested in how he made this work as he gives a detailed overview of the whole process.
Very clever stuff, huge thanks to him, please check out his YouTube Channel.
I will add a few things I did to make the node setup work with my hand made light directions in the next section.
I opened his node setup in Blender.
I used the import image as a plane option in Blender (you may have to enable this in the properties, add-on settings. It comes with Blender but isn’t automatically enabled) on my diffuse PNG image to get the dimensions for the image right without much effort.
I copied the node setup from Blender Smoothie’s image and pasted what I needed to the new image shader nodes. Here is the modified setup:
As you can see I loaded my light direction images into the correct slots for top, right, bottom, left respectively. After that because my light direction images are not coloured (they use a value scale between black to white) I added a mix RGB node and set it to use overlay from the drop down. I slotted it in between the photostonormalmap group and the base colour noodle to the principled BSDF node. I added another image texture node and loaded the diffuse colour image, then set the overlay factor to 1. This colours your image in if you did it my way.
If your image uses transparency like mine does you can add some more nodes to take care of that. If it does not this step is optional.
You will need a mix shader node and a transparent BSDF node. Connect the alpha output noodle from the diffuse image texture (the one you just made for the overlay effect) to the Fac input of the Mix Shader, then attach the BSDF output to the bottom shader input of the Mix Shader node. Connect the transparent BSDF BSDF noodle output to the top shader input of the Mix Shader. Then connect the Mix Shader output to the Material Output Surface input. Additionally I changed transmission setting in the principled BSDF node to 1 and changed some settings in Blender which I’ve shown in these screenshots (but I think this only applies if you are using Eevee render):
You can use Eevee or Cycles for this BTW.
I found that 3D objects in Blender cast shadows onto the 2D image with this node setup, so that is cool.
You can use lights in Blender to add light effects. Coloured point lights are nice to play with as well as the sun lamp. Set your world background to the colour and value you want to use or you can use HDRI’s to set an atmosphere.
The normal map can also be baked out if you need it (see the screenshot below). You could use that to generate a bump map with Awesome Bump or use in a game engine or photo editing software that supports normal maps.
Here are some renders I made:
I think this will come in handy one day, I plan to mix my 3D work with 2D elements in Blender. I suppose instead of having to model everything in 3D you could paint and draw it then use this 3D effect.
I will note though that the normal maps created with Sprite Lamp and Sprite DLight with this method of using light direction images were better quality than the baked normal map from this node setup.
Thanks for reading.