The last bark sculpt is done! For this last sculpt I’m using it as kind of a kitbash texture where I can use the vertex groups and an image mask to add or take away those black areas that the aspen bark has. It’s funny after doing this one to look back on that first sculpt I did and to see how undetailed it was, when at the time I thought it was looking nice. I suppose that’s what happens when you’re learning new things. :) To show where it’s mixing, the circles on the image below go a little bit above where the mixing of textures is happening.
I also had an idea for the way the texture is UV mapped that almost completely takes away any signs of tiling, just by switching where the seams start. You can see how that looks in the two images below. The line on the side shows where the texture ends and repeats again. The idea was that at the point the texture would have started tiling going up the tree, the cut for the UV seam switches to being on the other side of the tree. So it basically rotates the texture so you see the part of the texture that would have been on the other side of the tree. I had only thought of doing this after I had done the sculpts and painting, so there is a barely visible seam, but it’s fairly high up the tree and can only be seen really close up to it. I circled the seam in the image below. Although, for the next tree type, I’ll hopefully be able to create the texture with that in mind and take away that seam.
There was one thing I found out that I thought I could share because it might be helpful to someone. I found out Blender works really well for creating Texture Atlases and being able to cut up textures automatically without having to go in an image editor every time something changes, cut it, then recombine it in the texture atlas. With the way I have it set up, it also automatically creates a 2, or however many pixels, padding or bleed edge around each texture so there aren’t any visible seams in the final model. It’s a bit of a strange workflow, but the results are really nice and makes having to change anything in one of the textures pretty simple.
The way it works is that I set up some rectangular planes that you can see in the image below, with one centimeter equaling one pixel in the final image. This way you know exactly where each pixel of the texture is going to be in the final image and makes things a bit easier when doing the padding around each texture that I talk about below. Each separate plane will equal one texture or a part of a texture in the final texture atlas.
Next you line up each of the model’s UVs with the texture you want assigned to that model. So with my bark textures that are 2048 x 8192, I want to split each one into two in order to recombine them and make a square texture of 4096x4096. To do that I set the UVs for the plane at the top left in the image below, to be the bottom half of my 2048 x 8192 texture, and the one right next to it on the right side to be the top half of that texture. Then I just apply the texture onto the model using an emissive shader. To get the final texture, I just set up a camera set to Orthographic mode with the edges of the camera lined up with the edges of the large plane that represents the edges of the texture atlas. Then I just do a normal render of the models at whatever resolution I made the models to be, in this case 4096x4096, and turned off anti-aliasing so that the two pixel border around the edges talked about below won’t get blurred.
To get the two pixel padding, you just inset a new line of vertices 2 cm from the outer edge, or however much of a pixel padding you want to have, on all sides, but leave the UVs on top of each other. Hopefully you can see what I mean in the images below.
What this will do is stretch the texture when it’s applied on the model, but it will only stretch it on that outer edge, leaving a padding of 2 pixels that is almost the same color as the pixel right before the UVs start to stretch the texture and taking away any seams on the final model. The close up result can be seen below.
The really great thing about all of this is that it automatically cuts and pads any of the textures. So if you need to adjust something in one of the textures, all you have to do is make the adjustment, update the texture in the object’s material, then just do a quick render of all the texture atlas models together.
Hopefully all of that makes sense. I also figured out a way to use just one material for all of the objects and have the textures be applied to them using some object masking techniques, but this post is already rather long, so I thought I would share it in the next update. Normally you would have to use a different material for each texture in the atlas since each plane needs a different texture, but I found another way that makes things a little simpler.
Next update I’ll be working on the leaves for the tree and I’ll have the sun and moon in the game!
Next update is done. I have the second bark type sculpted and painted. I'll show some other kinds of peeled bark when the other aspen trees are done. I also have the trunk in the game with the method of mixing the barks all figured out. I'm using a combination of the vertex groups and an image texture to do the masking. I think there are a couple things I’ll change in the sculpts, but at least everything is in there and working. I'll update the download files later when I have a few more things done.
One thing I wanted to share that I thought could help somebody else, and I thought was pretty cool at least, is I figured out a way to be able to create two masking images in just one image channel. So with an image that has an alpha channel, I would be able to get a total of 8 masks instead of the normal 4. The way it's done is by first filling the channel with a solid color that will be 50% grey when it's used as a mask. This will split the image into two images. Just as a note, I guess probably something to do with color space, but in Krita, I had to use a luminance value of 25 instead of 50 to get a result of 50% when the channel is used as a mask in Unreal. Then you just use a value that's above 50% grey for one mask, and below 50% grey for the other mask. You can see it below, but when in the editor, just subtract .5 which will make the grey and anything under it a value of 0 and anything above it 0 to .5. After this, clamp the values to cutoff what's below 0, then multiply by 2, and voila the texture will be a value between 0 and 1. To use the other mask, you just invert the texture first, then follow the same steps. It wouldn't work for everything because you basically have half the amount of histogram color values, but for using it as a mix between two different textures like I'm doing, I haven't been able to tell any difference. It would also work well for blending things with vertex colors, since you could go beyond the 4 vertex color slots.
I've also been working on implementing all of the sun and moon calculations in Kleiner Bear's complex day/night cycle seen here: https://www.youtube.com/playlist?list=PLRj2My38wl9bcycvj_NssOy2f-cFNzPKH When I'm done with that I'll add a way to make it so the user can rotate the game's compass to be able to change where the sun rises, change how long the day is, and make a way to change what latitude the environment is at, making for some interesting and varied sun rotations, like at the polar circle. It will also be nice that the lighting will be changing throughout the year instead of just same lighting every day. I’m also planning on trying to implement a way for seasonal changes to occur with the vegetation depending on which season it is. I already have some ideas for doing that, but I'll have to see how it goes.
I just wanted to give a small update on how the aspen tree is going. The first bark texture is sculpted and painted. It will be a bit higher resolution once it's in the game.
With the aspen tree, since the bark is so distinctly different in different areas of the tree, I’m planning on doing three different sculpts for each type of bark, then combine them in a texture atlas and use vertex colors as masks when they are on the tree. That way I should be able to get a large amount of variation in each tree while still only using three sets of textures, but I’ll have to see how it goes… It will also help take away some of the tiling. The only other way I could think of to do them would be to do a different sculpt and painting for each tree, which would end up being quite a few more textures in the end. If anyone else has ideas for what they've done in this kind of situation, feel free to expound. :) I may not use it for this tree, but it would be good to know for the future if there is a better way.
The next update is done! Here is the video showing how it looks as well as some of the options I added for the music.
It took quite a bit longer than I expected to make the first ground texture that will be used for the pathways, but at least now I’ll have a system for creating the other ones that should make it go faster. The great thing was that I was able to create a seamless texture from scratch in Blender, so it should also make for a good base in creating the next textures. Here are how the models look in Blender:
I think for the next updates, the plan is to try to fully make one small area and get all the different systems like rain and wind working for that area. Then, as I’m making the other areas, I’ll have most everything worked out already. The next thing I’ll be working on is modeling one of the trees. I thought I would do the aspen or cherry blossom area first, so it will be one of those. I haven’t decided which area to work on first yet. I’ll probably try to do smaller chunks as well so there isn’t such a large amount of time between updates.