Painting heights is normal!

Welcome to the first big design change in Raise and Shine: Painting heights is normal!

I’ve decided to replace the selection and height editing tools by a painting brush based solution. Painting is a lot more intuitive and easy to explain and use than the old system. Lots of texture editing tools, both 2D and 3D, are based on painting. I admit I should have gone for this solution before, but better late than never! It’s not even that late yet =]

Another benefit of just painting the height map instead of pushing the values little bits over time is that we have a lot less floating point calculation errors. I had made a separate data structure that replicated the height map values in floating point, so that the result gets smooth values. This demanded converting images, processing height values in CPU, converting again to image then uploading data back to the texture in GPU for displaying it. As you can imagine, this is quite cumbersome and the app performed poorly while editing big textures.

Using Godot’s GLES3 video driver made this a little less necessary, because textures with float values could be used directly, but GLES2 still needed all this processing or the images would have very inaccurate results. I even started using C and GDNative to make this process faster and lags were less noticeable for bigger textures, but still happened.

Now everything happens directly in GPU. The height map lives in a render texture, using a Viewport node. When painting, the current brush is drawn on top of it without clearing the previous contents, it’s quite a flexible canvas! We are also able to attach shaders before drawing brushes, for example to make bevels and other interesting effects.

As well as the height map, the normal map is a render texture living in another Viewport. It generates the normal values by drawing the height map, which is already in GPU memory, using a shader program.

It’s always nice making things simpler, both in the design and implementation level. As always, I have mixed feelings while deleting a whole lot of code. On one hand, it’s kind of a lot of effort thrown away. On the other hand, it’s awesome to have such a simpler project architecture with less moving parts =]

There are still some bugs to catch and functionality to implement, so I’m not releasing a new build today, but I promise it will be available soon!


Get Raise and Shine

Buy Now$5.00 USD or more

Leave a comment

Log in with to leave a comment.