Skip to content

Create Your Own Settings

Shahriar Shahrabi edited this page Aug 12, 2020 · 5 revisions

Custom Settings

The settings are used to determine the level of details and the length of the painting process. You drag and drop them in the Evolution Manager Component of the Manager Game Object in the scene. If you haven't already, have a look at the Quick Start Page.

The settings are ScriptableObjects. Which means you have to create a new instance of them in your project. You can of course edit the Setting instances I have already made, and this might be best for simple changes such as changing the brushes used.

Create New Setting

To create a new setting, either copy (Ctrl+D) an existing setting in the Assets/Settings folder or in your window tab, click on Assets->ScriptableObjects->SearchSetings.

screenshot

I suggest that you copy an existing Setting closest to what you want, because you have already everything setup there and only need to change some parameters.

Settings Parameters

The setting defines how the algorithm should build its Stages. An stage is an attempt which the algorithm does in painting the picture. In a Stage, the algorithm is given a limited amount of brush strokes and a set of parameter which determines what it should focus on. It then tries to find the best way to place the given brush strokes, so that the result resembles the image the most. Once it can not find any better way, the stage ends, and the next stage repeats the same process. The only difference is that each stage paints on top of the painting of the previous stage. If you would like to know more about how the algorithm works, have a look at my Medium Post on the project.

The parameters of the Run Settings are well documented, if you hover your mouse over any of them, you will get a tool tip that explains its functionality. For example here is the Settings for the 20 minutes run. screenshot

The first part of the settings, the Global Settings is applied to all stages created in the painting attempt. To get an explanation to what each setting does, just hover your mouse over it. For example if you would like to provide your own brushes, you can drag and drop the brush you have created in the Brush Texture section. For more information on how to create your own brushes, head over to Create Your Own Brush Page.

The second section is the Stage Series. A stage series is a collection of Stages that have the exact same settings. For more detailed paintings, you might wish to have 300 attempts at painting finer details, no way you want to create 300 Stages by hand. Hence I made this system where instead of directly defining a Stage, you define a Stage Series which is a prototype of Stage Settings and determines how many stages like this you want to have. Here again, each parameter is documented on the tool tip.

There is a hierarchy to the stages. The Stages are going to be layout in the reverse order of your Stage Series list. That means the Element 0 of your Stage Series are going to be the last attempts at the painting, since the algorithm starts replaying the stages from the last element down to zero, hence this is the section where the algorithm should focus on painting the finer details. The last Elements of your Stage Series are the first Stages which the algorithm starts with. So in this stage you should configure it to focus on the general silhouettes, colors and gradients.

If you wish your Stage Series to focus on everything at the same time, which is good for blocking out the general gradient and color scheme of the scene, set the Apply_Mask bool to false and set the Positon_Domain_Threshold to -1. You would want to do something like this for the last elements Elements in your Stage Series, which are the beginning of the painting process.

If you want the algorithm to focus on details, then set the Apply_Mask as true and set the Position_Domain_threshold to a value higher than zero and lower than 1. The Position_Domain_threshold works together with a mask, which you have either hand painted or is generated by the Gaussian Sobel operation (edge detection). To use your own mask, make an image as large as the image you wish to paint, and on the areas you want the algorithm to focus on, apply white color, everywhere else apply black. Here is an example of how that would look for the image on the right. Then in the Settings, assign this mask to the Costume_mask parameter. screenshot

Any value lower than the Position_Domain_threshold in your mask will be discarded and the algorithm won't focus on. For example if you set 0.5 as a value here, any grey tone lower than 0.5 will be discard. In the Evolution Manager component on the Manager Gameobject in the Main scene, you can always view where the algorithm is focusing on by double clicking on the Current_search_domain_visualisation RenderTarget. Pixels that are white in this image, are where the algorithm is focusing on. Here is an example for the given the painting.

screenshot

If you want to automatically generate this mask, then you need to change the Gaussian_kernel_size and Sobel_step_size to values that best suit the level of details you want. You should change these values together. Higher step size here creates masks that are more spread and focus more on general features in the image, where as lower values means finer mask with more focus on every edge. You want to have a more spread masks at the beginning of the painting process and at the last stage very fine masks in combination with small brush strokes which let the algorithm paint the small details. If you would like to visualize how the mask would look like with the values you have given it, head to the Assets/Scenes/debugs/test_gausian_and_sobel. There you can provide the gaussian_sobel_debug component which is on the Main Camera GameObject with the image you wish to create a mask for, give it the parameters you wish to visualize, then press play and the mask will be shown on your Game Window. For example here is an image with a fine mask generated with step and size value of 1 and one with step and size value 64.

screenshot

As guilde line, you can have a look at any of the presets I have provided in the Assets/Settings. There you can see how the first stages in the painting (last in the stage series list) focus on general details, and as the process continues the continue focusing on finer details.

Clone this wiki locally