Summer Work (Day 19)

Texturing Frustrations

    I don't have much tangible progress to show for the past few days, but I wanted to post an update about what I have learned and the many missteps I have taken. 

    Most of the frustration came down to the system of texturing the planets and trying to convert the linear color curves and atlases to textures. The first thing I wanted to fix was the fact that no matter what value you would enter for the color curve or atlas it would not apply to the material. This was because, unlike the vector parameter for height, I could not find a curve or atlas parameter that was accessible through C++. Eventually though, I found that you can use an atlas as a texture. So this means that I could use a texture parameter to pass through the atlas from the planet to the material without having to manually edit, or create a new material for each atlas. 
    The unintended consequence of this was that the planet now looked like this:



    Admittedly, this might actually be useful in the future for creating a mask separating land from sea; but it wasn't what I wanted. I eventually realized that this happened because of the way the atlas was created. Whereas before I was plugging in the height directly into the 1D curve, now I was plugging that value into a 2D texture. The atlas had a resolution of 256x256 but only one of those rows was populated by the color curve. When I reduced the resolution of the atlas to 32x32 and populated all of them with the curve (because there was no way I was going to manually add 256 curves) the planet went back to how it should look. 
    Now, in hindsight, I should have stopped here. I should have continued using the atlas as a texture because it gave me all I needed, but I didn't. Because I have a stupid ape brain I decided that since the tutorial created an actual texture, so should I.
    This sent me down a long rabbit hole trying to find a way to either convert an atlas to a texture (which as previously mentioned I didn't need to because atlas inherits from UTexture) or write pixels directly to a texture (like Unity would do). The only little thing that I found was TextureRenderTargets. A cool feature in Unreal, but not for what I wanted to use them for. Other than that all I found were super complicated ways of getting pixel values but never setting.
    After all this time of ignoring atlases, when I finally looked back at them being a possibility I noticed all the ways in that they could be superior. They support linear colors unlike any of the other options, they can be used as textures, the curves they contain can be edited and referenced within C++ (this will help when I do biomes), and they have a lot of editing options just to name a few. 
    With that, going forward I will commit to using atlases as my planet texture. My hope is to be finished with this tutorial within one and a half to two weeks.

Comments

Popular posts from this blog

Polishing the Foundation

Progress Update #13

A New Chapter