Style Bake

Style Bake

Download

A tool I developed for quickly creating interesting textures for 3d objects. By manipulating decals through a range of parameters much like a particle system users can control aspects like size, rotation and layering to achieve a unique look. Parameters can also be directly controlled by textures leading to a very experimental workflow where for example you could use a paint layer to control areas of high density, a noise map to control size while a baked occlusion map drives the color of each decal.

  • 31/10/24 : Release 0.2.0
  • 05/10/24 : Minor Fix 0.1.1
  • 12/09/24 : Prototype Development

  • Release 0.2.0

    31/10/24

    Most of this month was just on solidifing the core of the program, and greatly simplifying a lot of systems that had gotten out of control in the rush to finish the initial prototype. Things like properly handling conversion between different color spaces, and getting better debugging visuals setup which haven't had much of an impact of the usability of the project but should make it easier to make progress in the future. Even still I managed to get a couple newer things in...

    Textures

    The way texures work has changed significantly from the prototype, now instead of just being a preset list of occlusion, curvature etc you can add the types of maps you want and set their resolution and settings independently. This greatly simplified a bunch of the interface, like being able to move background color and sample information into their respective layers. It also opened up the ability to easily add paintable textures and noise maps without adding a bunch of complication. Some of the map types are less useful then others currently, for example theres not really any point in having a secondary ambient occlusion map but eventually I expect there to be some unique ao generation settings like a max occlusion distance that might necessitate having a second ao map.

    Another texture related feature is the new texture viewport which allows for panning and zooming, I should have gotten this in much sooner as it ended up helping quite a lot with debugging as now I can inspect individual pixels to see their values.

    Poisson Generation

    The other thing that took a significant amount of development time last month was improving the decal position generation, now decals can vary in density and be mapped in the same way as size or color. I had not been happy with how this had worked in the previous version as the rendered texture would often be empty for a few seconds until the generation had finished. Now that the user would be making minor tweaks to density regularly, I thought it was important for this to be much smoother. I achieved this by using a simpler algorithm to first show a rough preview on the first frame before filling in the gaps on subsequent frames.

    Other New Stuff

  • Improved color picker
  • Gradient color spaces
  • Non square textures
  • Better path editing
  • Overall I didn't get quite as many features in as I would have liked in this version. In particular I was hoping to improve the lightmap generation alot but that will have to wait for the next version. However a lot more of the foundations are now in place for many of the interesting things I want to do. I have decided that it's still not worth releasing the source code publicly at this stage due to the number of remaining issues, but a download is available if your interested in trying it out.


    Prototype Development

    12/09/24

    Inspiration

    In the past I’ve built many small tools for game projects, mostly for editing levels or managing art assets but I wanted to make something not just for a specific game but a tool that would be useful to a more general audience but I wasn’t sure what that would be. An idea came when I was working on a prototype and tasked with creating buildings in a paper cut out style inspired by chaotic graffiti. So I setup a system that used blender geometry nodes and a small python script that then went into a substance designer setup to generate a texture and mesh. As I developed these tools further for the project I found they were quite exible in achieving a range of different styles, however due to how I had set it up it was difficult to experiment and make changes quickly. Also if the project had been expanded the setup would have been difficult for anyone else to use But I could see potential and thought it might be something that other people could find useful so I decided to expand it into it’s own dedicated tool.

    Initially I had wanted to do this as a unity plugin however I had ran into issues in the past when trying to access unitys baked ao for my own textures and I thought it might limit the usefulness by being tied to one engine. The other main reason was that I wanted to focus on design rather than getting caught up in unity specific details.

    One of the main problems with this type of texturing is that each object needs it’s own texture, this isn’t so bad for characters but generally environments try to fit multiple objects on the same texture using trim or atlases. Early on I experimented with doing the scattering in engine using texture bombing, I was able to achieve a similar looking result and because it was purely done throuhg the shader each object didn’t need a separate texture, another benefit was that the resolution was only limited by the size of the decal meaning you could have very dense patterns that were still perfectly crisp when you get close to them. Unfortunately this approached introduced many limitations including, the shader getting exponentially more expensive with larger decal sizes, supporting non square textures would have been a lot of extra work and the approach would have been difficult to turn into something general purpose since different features often required completely different shader setups. I would probably look further into this though if attempting to do a large game with similar texturing techniques.

    Development

    The first few weeks were spent getting a rough version of the software together as quickly as possible. I started by getting a mesh that you could pan around and view from different angles and then got decals working by drawing objects to a render texture that was then used for the material on the mesh. At first I was just picking random positions for the decals but I remembered that I could use blue noise to make the scattering much more appealing. I followed a good video by Sebastian Lague to get that working. I knew baked light would influence the properties of the decals but I wasn’t sure how to approach that so I just baked some textures in substance painter for my example scene so that I could start experimenting without having to get baked lighting working. The next thing to do was get some way of editing the properties, up until this point I had just been testing things in engine. I had encountered issues with other ui systems in the past and wanted to try something new so I decided on using ImGui as the ui library for the project. It took a couple days to get used to but eventually I got a basic layout with some sliders that I could use to tweak the decal settings, and with that I had a basic version of the program obviously missing a lot of features but it allowed me to play around experiment with the settings.

    The next major step was getting some way of calculating the ambient occlussion maps in the software without having to bring in external textures I looked into a lot of different approaches for this and found and relatively easy method that allowed the textured to be rendered in a shader, however this then meant that it had to be read back from the shader to use the baked values in the decal placement code. Reading back from the gpu can be quite slow so I had to reduce the baked texture size alot so that it could work quickly. However this ended up not being much of an issues since it looked good with low resolution textures anyway and I found that the noisier baked textures can even look better sometimes than perfectly smooth ones for this type of texturing. Now that I could bake the lightmap in engine I added the ability to change the mesh and images, aswell as more options for controlling how decals were rendered.

    The last 3 or so weeks were just spent polishing and refining the features. Although theres a bunch of things I want to add I thought it was important to get the core set of features to a polished state before moving on. Things like automatically updating images if they’re changed outside of the program, updating the preview image while your editing the path rather than just after you have committed, lots of little things to make the program feel better to use. One thing that took much longer than expected was handling 3d models, the library I was initially using to import 3d models would occassionaly fail however there was no way to find out why it had failed which I felt made the program quite annoying to use as some models would work and others you would have to mess around with export settings to get them to load correctly. I searched for a while to find another library that could give me exact information on why something had failed however I was unable to find something that meet my requirements. So I took some old code I had made to import obj files and cleaned it up so that gave precise errors if the mesh wasn’t triangulated etc. This does mean that only obj files are supported but I think it was worth the tradeoff. I didn’t quite get everything as polished as I would have liked but overall I’m happy with tools so far and I think it’s pretty close to being actually usable.

    Settings Evolution

    Each part of the software went through several iterations to get to something that was easy to use while still providing full control over the visual appearance.

  • The first working version of the software, just put every parameter in so I could start working out which were going to be most useful. This also including leaving in all the debug menus and displays.
  • Simplified the count and and min radius properties from the first version into a single density value.
  • Removed the bounce contribution and max bounces as it didn’t have much of an effect on the final baked occlusion this might become more important in the future but for now it just adding more confusion.
  • Got rid of a lot of the debug information such as how many samples had been rendered as I found that it was information that the user didn’t really need to care about.
  • Changed the color properties to a single gradient which allowed for much more control over how the lightmap values mapped to color.
  • This was also the stage at which I made the lighting bake once at the start when a mesh is first loaded rather than every time after the density is changed which meant that you could freely change the density property without having to wait a few seconds for it to finish rendering. From the limited testing I did, people seemed to generally avoid editing the density I think mostly because it didn’t feel good to use.
  • Moved to a system where properties can be either be mapped to a value or not inspired by unitys default particle system. This simplifed the size property as now it can be displayed as a single value.
  • Occlusion distance has been removed as it represented the maximum distance that light rays could travel similar to ao radius in a post processing setting. But now that each property is remapping the light texture anyway the range of values is not as important and so it is automatically set to be a reasonable value based on the size of the mesh.
  • Turned density into a slider to better show the range of values.
  • Removed the numbers from the color picker, so that they only show up when your editing it which reduces the visual clutter.
  • Seperated the image controls into its own region aswell as giving it a black background to help it stand out more.
  • Screenshots

    Image 1
    Image 1
    1 1 1 1 1 1
    Slides