►
Description
Art is a search process. When we create something, we mentally navigate a space of possibilities, searching for an artistic solution to evoking a desired sensation. In this talk I will walk you through an example of translating artistic search into code, a computational drawing algorithm.
More at https://rustfest.global/session/7-rust-for-artists-art-for-rustaceans/
B
Hi
and
welcome
to
rust
for
artists
art
for
stations
before
we
start
a
quick
warning.
This
talk
suffers
from
multiple
personality
disorder.
It
kind
of
tries
to
be
multiple
things
at
once,
like
talk
very
meta
about
similarities
between
art
and
programming
and
science,
while
at
the
same
time
show
your
computational
drawing
algorithm
and
yeah
also
share
some
practical,
ras
tips.
B
My
name
is
anastasia
opara
and
I'm
a
procedural
artist
at
embark.
Studios,
a
stockholm
based
game
development
company.
You
might
be
wondering
what
is
procedural
artist.
Procedural
art's
distinguishing
feature
is
that
it
is
executed
by
a
computer
following
a
set
of
human
designed
procedures
described
in
code.
That's
why
it's
procedural
and
as
a
procedural
artist
at
embark,
I
spend
most
of
my
time
meditating
over
procedural
workflows
for
assisted
creativity
in
games
from
both
developer
and
player
perspectives.
B
B
So
the
first
one
is
texture
synthesis,
which
is
actually
a
project
where
I
first
got
introduced
to
rust.
It's
an
example-based
algorithm
for
image
generation,
meaning
you
can
give
it
an
example
image
and
it
will
generate
more
similar-looking
images.
You
can
also
do
things
like
guided
generations,
style,
transfer,
fill
and
missing
content,
even
do
simple
geometry
generation.
B
The
second
project
is
called
kitty
wake,
which
is
a
game-like
environment
where
we
explored
a
feeling
of
co-creation
with
an
example-based
placement
algorithm,
which
is
embodied
into
this
little
creature,
whom
we
named
kittus
together.
You
create
a
small
scene
by
going
back
and
forth
between
you
and
kittis
sort
of
like
a
dialogue
and
kittus
tries
to
mimic
the
way
you
create
by
analyzing
how
you
place
things
and
using
it
as
an
example.
B
One
of
the
key
similarities
between
these
projects
is
that
both
of
them
heavily
rely
on
performing
some
kind
of
search
in
both
of
them.
Given
an
example
like
object
arrangement
in
kitty,
wake
or
pixel
image
and
texture
synthesis,
we
search
for
a
new
configuration
that
looks
perceptually
similar
to
the
example,
while
not
being
a
copy.
You
could
think
of
the
search
process
in
a
simplified
way.
That
is,
we
try
a
bunch
of
configurations.
B
Thousands
in
fact
we
evaluate
every
one
of
them
and
present
you
the
most
promising
one.
It's
just
from
the
user
perspective.
It
can
happen
so
fast
that
it
might
not
seem
like
a
search,
for
example,
in
texture
synthesis
you
can
see
pixels
appearing,
which
is
a
result
of
searching
through
possible
pixel
neighborhoods
from
the
example
and,
in
example,
base
placement.
You
can
see
objects
magically
moving
around
until
they
settle
in
positions
that
satisfy
the
example.
B
B
B
B
As
artists
we
might
emphasize
the
way
the
wool
curls
are
a
repetition
of
a
pattern
that
trees
make.
When
this
way
abandoning
precision
in
favor
of
the
whole
world
could
be
emphasizing
that
motion
or
we
might
adopt
a
very
different
perspective
and
explore
the
sheep
not
the
way,
we
see
it
but
invite
to
experience
the
concept
of
a
sheep
through
its
hoof
marks
as
it
walks
on
the
canvas.
B
Even
when
dealing
with
data,
we
are
faced
with
a
choice
of
a
model
or
a
representation
that
will
explain
it
in
the
end.
These
are
all
representations,
they
don't
change
the
way
the
ship
is,
but
they
change
the
way
we
think
about
it,
and
quite
often
there
is
no
one
representation
that
just
works
for
a
goal
at
hand,
and
it
becomes
an
iterative
search
for
conceptual
pieces
needed
to
design
a
new
representation.
B
Art
is
not
just
about
recreation
of
reality,
even
if
you
do
choose
to
make
it
your
focus,
it's
an
invitation
to
co-experience
something
from
your
perspective,
something
it
used
to
be
bodiless,
but
you
invented
a
representation
for
it,
and
from
that
perspective,
I
genuinely
think
anyone
can
be
an
artist
today.
There
are
plenty
of
art
media
to
choose
from,
and
code
is
a
particularly
fascinating
one
as
it
invites
to
convey
not
just
the
final
destination
of
the
art
process,
but
the
author's
workflow,
the
search
itself.
B
It
invites
us
artists
to
reverse
engineer
our
own
thought
process
and
deconstruct
it
into
an
algorithmical
form,
pushing
back
the
outcome
of
the
process
into
the
background
and
putting
the
experience
of
the
search
to
be
the
main
art
piece,
and
that
is
what
computational
drawing
aims
to
capture
computational.
Drawing
is
my
hobby
project,
which
is
designed
to
imitate
traditional
drawing
from
reference
by
searching
for
a
deconstruction
of
the
target
into
discrete
brush
strokes,
inviting
to
co-experience
the
becoming
of
the
work
from
its
very
rough
stages.
B
B
B
It
was
a
summer
of
2017
and
I
just
finished
my
university
and
had
no
idea
about
search
algorithms
and
seeing
that
genetic
stuff
really
triggered
me
the
process,
as
brute
force
as
it
was
reminded
me
of
my
own
experience
during
live
drawing
classes
having
to
translate
what
I
see
into
a
set
of
discrete
motions
with
a
pencil
or
a
charcoal
that
personal
experience
combined
with
discovering
an
algorithmic
representation
I
could
use.
I
I
just
had
to
try
it
out.
B
B
B
So
now
imagine
we
drew
this
brush
stroke
on
a
canvas
and
just
like
we
thought
of
scale
rotation
and
value
as
parameters
of
our
brush.
We
can
think
of
the
brush
as
a
parameter
of
the
canvas.
Just
by
knowing
what
kind
of
configuration
our
brush
is.
We
can
deduce
how
our
canvas
looks
like
and
representing
our
brush
configuration
as
one
dimension
is
just
the
mental
shortcut,
in
fact
that
one
dimension
encapsulates
five
scale,
rotation,
value
and
position
in
x
and
y.
B
B
Cool
a
dot
in
brush
space
represents
a
canvas
wow,
but
it
gets
more
conceptually
interesting.
As
we
add
more
brushes,
it
also
becomes
messier
to
visualize.
So,
let's
imagine
that
this
2d
space
is
in
fact,
a
space
defined
by
100,
brushes
and
a
dot
in
the
space
represents
a
particular
canvas
appearance
defined
by
how
our
100
brushes
are
configured
to
move
in
this
space.
B
All
we
have
to
do
is
change
our
canvas,
and
if
we
just
take
a
stroll
and
aimlessly
wander
around
in
this
space,
we
might
discover
that
with
just
a
hundred
brushstrokes,
we
can
actually
depict
a
lot
of
interesting
stuff,
but
also
a
lot
of
random
stuff.
In
fact,
the
proportion
of
interesting
stuff
to
random
is
insanely
low.
It
is
very
unlikely
that
we
will
just
stumble
upon
a
good
painting,
so
the
question
becomes:
how
do
we
search
for
something
interesting?
B
That
looks
more
like
a
target,
and
if
we
continue
this
guided
search
long
enough,
we
will
eventually
reach
a
canvas
configuration
whose
brushstroke
arrangement
looks
similar
to
the
target
and
in
general,
that
is
pretty
much
it,
and
there
are
many
ways
how
one
might
implement
this
search.
It
can
be
a
genetic
algorithm,
gradient
descent,
simulated,
annealing,
greedy.
B
You
pick
your
favorite,
I'm
going
to
show
you
how
I
approached
it
by
applying
some
of
the
lessons
from
my
art,
education
and
incorporating
that
into
the
search,
I
was
greatly
inspired
how
during
fine
art
classes,
especially
when
we
were
doing
oil
steel
lives,
we
were
taught
to
never
try
to
solve
all
the
detailed
frequencies
at
once
most
of
the
times.
You
will
just
get
yourself
in
a
corner.
B
Therefore
I
broke
it
down
into
multiple
stages
and
each
stage
only
solves
a
particular
level
of
details,
starting
with
very
big
brush
strokes,
forcing
to
generalize
the
shape
and
only
then
applying
more
details,
and
each
of
those
stages
is
a
completely
separate
search.
So
when
a
first
stage
is
done,
the
second
stage
has
to
just
draw
on
top
of
what
has
been
drawn
before
here.
B
You
can
see
the
search
process
happening
for
different
stages
and
when
you
see
a
sudden
jump,
that's
when
new
brushes
are
added
and
the
algorithm
is
using
them
to
better
approximate
the
target
and
during
every
stage
the
algorithm
needs
to
place
100
brushes,
and
it
has
to
do
so
in
10,
000
search
steps,
10
000
steps
might
seem
like
a
lot,
but
if
you
need
to
place
100
brushes,
that
is
8
000
parameters
and
remember
the
algorithm
cannot
remove
them.
It
is
forced
to
place
strokes.
B
Even
if
it's
not
perfect,
and
one
of
the
reasons
to
limit
the
step
number
is
to
encourage
happy
accidents,
mistakes
and
imperfections.
If
something
goes
really
bad,
it
can
always
be
fixed
in
later
stages,
giving
a
perception
of
continuous
problem
solving
in
the
brush
layout
itself,
as
brush
strokes
become
smaller.
I
use
a
sampling
mask
to
guide
the
brush
placement
towards
places
of
higher
frequencies.
B
I
don't
remember
where
I
heard
it
first,
but
there
is
an
expression:
don't
over
pat
the
painting,
meaning
don't
overwork
it
and
kill
all
the
playfulness
and
that's
sort
of
what
I'm
trying
to
avoid
by
having
the
sampling
mask.
You
can
notice.
The
sampling
mask
is
generated
based
on
edges
and
edges,
play
a
very
important
role
in
drawing
if
you've
ever
had
academic
drawing
classes.
You
probably
recognize
this.
These
are
usually
used
as
a
homework
to
copy
and
learn
from
on
how
to
deconstruct
a
3d
shape
into
simplified
contours
as
humans.
B
We
are
extremely
sensitive
to
sharp
transitions
between
darker
and
lighter
elements,
and
just
a
small
deviation
can
make
something
look
wrong.
Therefore,
one
of
the
new
additions
to
the
rust
version
was
using
contours
to
guide
the
search.
This
is
done
by
comparing
edges
of
target
versus
drawn
and
computing
their
earth
movement.
Distance
here
is
a
comparison
of
using
versus
not
using
edges
to
guide
the
search
notice,
how
much
better
defined
the
face
is
and
how
it
looks
perceptually
closer
to
the
original.
B
It
is
subtle,
but
I
think
it
gives
it
an
extra
push
towards
believability
that
there
is
an
artist's
thought
process
behind
each
brush
placement,
since
we
need
to
perform
edge,
detect
every
iteration
it
needs
to
be
fast.
Here
are
just
some
comparisons
of
how
long
it
takes
for
different
edge
detection
implementations
available
in
different
rust
grades.
B
B
Can
he
still
gives
a
crisper
result
in
most
cases,
but
that
also
comes
with
a
four
times
slower
generation
cost
and
in
case
someone's
interested
on
how
the
parallel
subwool
is
done
here.
Is
the
code
feel
free
to
pause
once
this
goes
online,
but
I'm
gonna
be
moving
on
so
another
way,
I'm
using
edges
is
to
drive
the
brush
strokes
orientation.
B
B
The
reason
why
I
made
it
to
be
always
probabilistic
is
that
I
don't
want
to
exclude
any
happy
accidents.
Perhaps
if
a
brushstroke
is
placed
completely
perpendicular,
it
might
actually
be
a
very
good
solution.
In
the
end,
the
pixel
and
edge
difference
is
what
matters
computational.
Drawing
is
still
very
much
work
in
progress
and
I
hope
to
open
source
it
once
it's
done.
One
thing
I
still
haven't
gotten
to
is
figuring
out
a
good
strategy
for
searching
for
a
color
solution.
B
That's
still
in
my
to-do
list
right
now,
I'm
just
directly
sampling
from
the
target
image.
At
the
moment
the
algorithm
is
running
on
cpu.
The
code
is
paralyzed
big
thanks
to
thomas
for
helping
me
out
with
that,
but
still
a
drawing
on,
cpu
is
quite
slow
and
just
so
happens.
Recently
embark
has
announced
a
rast
on
gpu
project.
In
case
you
haven't
heard,
and
I'm
really
looking
forward
to
its
development.
So
please
go
contribute,
so
I
can
do
paintings
on
gpu
okay,
so
we
are
reaching
the
end
of
the
presentation
now.
B
And,
lastly,
we
have
covered
the
algorithm
details
as
well
as
how
we
can
use
our
artistic
intent
to
guide
the
search
by
translating
it
into
code
and,
if
you're
an
artist
and
you
are
considering
getting
into
rust,
I
really
recommend
that
you
stop
considering
and
just
do
it.
First
of
all,
the
ecosystem
is
great,
the
package
management
is
heavenly
and
if
you
just
want
to
get
started,
asap
learning
about
ownership
is
all
you
really
need,
which
is
literally
like
reading.
First
for
chapters
of
the
rust
book,
it's
very
rare.
B
I
find
myself
in
a
need
of
advanced
features
when
doing
this
kind
of
one-off
art
tools.
I
also
can't
recommend
enough
getting
rust
analyzer.
It
will
show
you
types,
clippy
warnings,
tips,
it's
absolutely
amazing,
and
when
I
personally
prototype,
I
often
write
very
messy
code
and
it's
a
breath
of
fresh
air
to
have
the
language
guarding
me
against
making
stupid
mistakes
and
clippy
shouting
at
me
for
making
a
variable
and
never
using
it
and
just
having
that
confidence
that
if
my
code
compiles,
it
works.