Thursday, April 30, 2009

Wrap Up

The project is now officially done, meaning that this blog will (most likely) receive no further updates. Rather than make a bunch of posts about what I did since my last update, I'm simply going to refer readers to the website with the project write-up:

Artists' Paint Mixing Simulation

The results section is probably the most interesting for the casual observer.

Saturday, April 25, 2009

Changing Primaries

I've added the ability to change the primaries that are displayed on the mixing palette. This doesn't change the results of colour mixing, but is more a usability feature to allow a user to customize the "quickly available" colours for use in mixing, ie, the colours they consider to be their primaries.

The image shows the mixing area with a different set of primaries than those used in other screen shots.

(For comparison, here are the colours used as primaries in the other screen shots:)

A Mixing Example

As an example of the simulated paint mixing, consider the image below which shows two paints: phthalo blue (green shade) in the upper left and phthalo green (blue shade) in the lower right.


The base colour of the two paints is very similar with the one in the lower right being ever so slightly lighter in appearance to the one in the upper right.







However, watch what happens when we mix in some titanium white:

The phthalo blue turns a lighter blue colour while the phthalo green becomes a lighter greenish-blue.

Full Palette

I've finished converting the paint data from [Okumura] (see the post on references) into a usable form. It covers measurements of 27 acrylic paints. I allow for a maximum of 8 to be displayed in the palette mixing area for use as primaries, with the full set accessible from an additional colour palette, pictured below.

Brushing

I've made some updates to accomodate different brush sizes and shapes, which wasn't hard as I'd planned ahead for it, mostly just some standard UI work to allow for brush editing. I think that the large brush sizes really show off the paint-like feel of things much better than the small brush sizes.

Brush shapes can also be modified (the screen shot only shows a circular brush) using predefined shapes or allowing customized ones. The brush editor isn't shown since it's not terribly interesting to look at.

Wednesday, April 22, 2009

New Palette

I've updated the palette and colour mixing area. It is also now using OpenGL for rendering, but more importantly, the sliders have been removed in favour of a colour mixing area that works similar to the canvas. The primaries are now shown along the top.

Still need some more work in this area, most notably the ability to save mixed colours and some additional brush options, which are next up on the list of things to do.

Rendering Erratta

I've been incorporating some tweaks to rendering. In addition to switching to OpenGL for rendering, I've added some embossing effects to give the paint the appearance of depth (though it's sort of a "fake" lighting effect and isn't really based on colour per se), and I've also added a bit more of paint fluid simulation (though simplified) with advection - that is, wet paint being moved around slightly when painting over top of it.

The advection can be hard to see, but looking at parts of the purple line(s) that have been painted over you can see that the purple paint has been smeared a little - probably most visible in this example looking at the white paint in the lower left and the yellow in the upper left.

I've also turned off the specular highlights on the canvas background (though it's still applied to the paint).

Sunday, April 19, 2009

Paint Smudges

Today, I've been working on improving some of the actual paint rendering (so that it's not just dots) and started working on implementig paint transfer between the brush and canvas (based on [Baxter] as mentioned in my post on references). This also included improving how the paints mix when they're on the canvas. As can be seen, it's starting to look a bit more like paint.

(While it's not obvious from the picture, the blue-ish colour in the bottom centre resulted from the paint on the brush changing colour as I was "scribbling" back and forth on the canvas.)

Next up, I'm going to tackle more of the paint simulation (advection between canvas cells) after which I'll probably handle options for paint drying followed by revisiting the palette/mixing area.

Specularity

More progress!

I added a canvas texture to the drawing area. It's actually a portion of a scanned piece of paper from a sketch pad, but the chief idea was to provide a non-uniform (and non-black) background to the canvas. The scanned paper was interpreted as a height map, used to calculate a surface normal at each pixel. Some specular lighting calculates are applied to give things a bit of a shiney look.


(Also pictured are a different set of primaries than the ones in previous screen shots.)



I think the highlights are too pronounced, though, so I'm going to work on it some more at a later time.

Wednesday, April 15, 2009

Lighting

I've included the ability to change illuminants for the paints. In fact, all the screenshots have been taken after proper illuminants were added, and it made a big difference in the visual results. So far, I've only got data for two different illuminants so far, but I'll be looking for some more to include. The default illuminant is the D65 illuminant, and was used for the screenshots for today's other posts. Below shows an image of the canvas and palette rendered using the D50 illuminant. The biggest difference is the colour of the white paint. If you compare it to the previous screenshots, you'll notice that white has a more peach-like colour under the D50 illuminant.

The Canvas

Once the palette was more-or-less worked out, I started on the basic canvas functionality. The idea is that the paints can be painted onto the canvas and can be layered. Paints applied in layers over each other affect the net colour on the canvas.

This shows some sample paints drawn on the canvas. You can see the effect of layering where the white and red paints overlap.

Right now, the paint doesn't actually look like paint, though (just coloured squares). The next thing I'm going to be tackling is simulating the behaviour of the paints beyond just the colour mixing.

I'm also going to put in a base canvas that isn't just black.

The Palette

Getting into the actual work I've been doing the past week, the first thing I decided to tackle was to get some basic colour mixing going. For that I set up the basic palette UI and also generated some spectral reflectance graphs for error checking purposes.


This shows an image of the mixing palette. Not very fancy at the moment - time permitting I'm planning on making an improved version eventually.

The area on the left with the 5 coloured circles is the paint primaries. For testing, I've arbitrarily chosen red, green, yellow plus white and black.

The coloured square and slider along the bottom shows the current mixing area with the current active paint mix. Presently, only two paints can be mixed at a time (the screenshot shows a mix of the white and blue primaries), but multiple paints can be indirectly mixed by saving a mix of two paints and then mixing the saved paint with a third.

The numbers to the right of the slider show the paint concentrations in the current mix as P1/P2 where P1 is the percentage of the first selected paint and P2 is the percentage of the second.

The area on the right shows the list of saved paint mixes.

References

I'm going to just quickly list the three main references I've got for the project. I've found three theses which are related to the simulation of paints and use the Kubelka-Munk model for paint mixing.

My main reference is turning out to be:
"Physically-Based Modeling Techniques for Interactive Digital Painting", William Baxter, 2004.

There is a paper based on this that I've also been using:
"IMPaSTo: A Realistic, Interactive Model for Paint", William Baxter, Jeremy Wendt, Ming C. Lin, NPAR 2004. (http://gamma.cs.unc.edu/impasto/)

The other two theses are:
"Developing a Spectral and Colorimetric Database of Artist Paint Materials", Yoshio Okumura, 2005.

and

"Pigmented Colorants: Dependence on Media and Time", Jeffrey Budsberg, 2007.
(http://www.graphics.cornell.edu/%7Ejbud/publications/ms.html)

Friday, April 10, 2009

Background

This will discuss a little bit of the background material for the project.

As the focus of the project is on simulating paint mixing, a big part of the background involves, obviously, paint mixing models. A model that seems to be commonly used (and the one that I expect I shall be using in this project) is the Kubelka-Munk model. I've found a few theses and other papers (I will try to remember to post some references later) that use this model for simulating paint mixing and we also talked about it briefly in class.

A big requirement for the Kubelka-Munk model (or any other, I exepct) is that one has to measure paint reflectance data in order to calculate the parameters used by the model. I am hoping to avoid having to do the measurements myself (as they're bound to be tedious), but finding available reflectance data on paints is like looking for a needle in a haystack - this is my first real frustration/stumbling block in this project.

Despite this, I do think I have a lead on some paint reflectance data. It's also worth noting that I don't need real data to get started on the Kubelka-Munk implementation. I expect it should be possible to generate some made-up data or substitute data from a different source (such as the Munsell paint samples, which are available) in order to get the simulation up and running and then plug-in the actual paint data when I obtain it - the principles should be the same either way. So this is what I plan to until I've managed to finalize my data source for paint reflectance data.

My next step is to create some display/mixing tests to show Kubelka-Munk in action.

Introduction

As part of my project of the colour course I'm taking this term (CS 781 at the University of Waterloo), I've decided to blog a bit about my project. The purpose of the blog is to document what I'm doing, how I'm progressing and the various trials and tribulations along the way. This introduction is to describe what the project is and what I hope to achieve.

Purpose

The purpose for this project is to create a paint mixing simulation, focusing on artists' paints such as oils or acrylics. A palette of typical paint primary colours will be presented and a user will be able to mix them in varying concentrations and do some simple painting operations.

Goal

For this project, I will be creating a (necessarily very) simple painting program that, instead of using a typical RGB colour picker, allows a user to mix colours using a selection of primary colours in a fashion similar to how an artist might mix paint. There will be some simulation of the appearance of paint on a canvas and the interaction of multiple paint layers (possibly limited to two or three) and options to view the canvas under different lights.

That is the project in a nutshell. The next post will go into a bit of the background.