Here’s the PR for the runtime part which has already been merged:
Thank you!
In the Defold 1.6.4 beta we’ve added support for multiple textures for the sprites as well.
It allows you to set e.g. a diffuse atlas and a normal map atlas to your sprites.
Use naming conventions to keep the image names easy to use in your atlas.
E.g. for the first frame of an animation, you have a diffuse and normal image:
hero_diffuse_1.png
hero_normal_1.png
hero_diffuse_2.png
hero_normal_3.png
Then it’s easy to rename these frames in the atlas using the “Rename patterns”.
Use “rename_patterns: _diffuse_=” and “rename_patterns: _normal_=” to make the names the same in the atlases.
It is important for the image names to be the same, as lookup is being done between atlases using the key “myanim/imagename” into the other atlases.
I hope this helps, and let me know if you have any questions!
(More documentation is coming)
By the way, does someone here have such a set of images that can be used as an example?
E.g. a few frames of a character or object, with diffuse and normal maps?
Or do you happen to know a good place to find such content?
Sure I can create something tonight or possibly tomorrow.
Heres my recent character “Bopz” walking animation. I applied the naming example you gave so hopefully they are ready to use. If you need flipped green channel or anything let me know.
sample:
TestBopz.zip (1.4 MB)
yoooo let’s gooo
Thank you for sharing this! It does however look like the diffuse and normals aren’t matching:
bopz_walk_normal_001:
bopz_walk_diffuse_001:
Look at how the feet are not aligned.
Are specular maps also a thing here? I know nothing, I just did a very quick search:-)
The textures are generic, they are what you decide them to be. You just need to have a shader that interprets them the way you want.
You’re right, I was off by one frame. Updated names and checked frames. Should match up correctly now. Let me know if you have any issues.
ps: some of the feet may seem a little different in shape, that is because a platform was masking the feet at some frames and not in the normal frames should be fine for an example and its something I can mask and fix later if needed to be exact. cheers
TestBopz_updated.zip (1.4 MB)
Thanks. They line up properly now. I put this into a sample project and uploaded here:
https://defold.com/sample-normal-maps-2d/
I guess my main concern with the Bopz character is that there’s all those specular highlights baked into the diffuse texture. I’m not an expert on these things but I supposed you’d want a specular map as well.
Sample project source: GitHub - defold/sample-normal-maps-2d
No problem. I went ahead and limited the baked lighting down to a very basic diffuse no harsh light reflections and shadows so that the lighting in this example can have more effect.
I will add the updated diffuse animation to the project and create a pull request on github.
Thanks. I think it is better for the purpose of this example. Next would be to build an example which also includes specular highlights. But what we have now is a good first example of what can be done.