
Texgen.js – Lightweight Procedural Texture Generator - mef
https://github.com/mrdoob/texgen.js
======
BoppreH
Those are very beautiful. I played around, but could not create anything
interesting. Adding the source for each sample, not only the first, could be a
great addition. I have absolutely no idea how to achieve the effect of #7 or
#8, for example.

And I never understood the copyright status of this stuff. If I use texgen to
create a texture, is it mine or mrdoob's?

~~~
endergen
If you read the License file you'll see its the standard MIT license. It's
very permissive and allows you to use the cide, modify it and many things
without asking for special permission. Read up on the MIT license for a better
understanding.

~~~
BoppreH
Correct. But my doubts are over the _output_ of the software.

On one hand, the output depends on your artistic instructions, so you are
entitled to it. On the other hand, the tool greatly restricts the solution
space, so the tool itself (and consequently its author) has artistic merit
over the result.

~~~
mrdoob2
I think a simple way to explain the MIT license is that you can do whatever
you want with it as long as you don't say that you created the library
yourself.

Textures that you create are as yours are images you create in Photoshop.
Probably even more yours than that ;)

~~~
BoppreH
Oh, hello mrdoob.

My doubt is about _authorship_. If I make a texture with texgen, can I claim
to be the author? Probably yes, but where do we draw the line? If I create a
Minecraft world by selecting a single seed, and take a slice of the world as a
2D image, can I claim authorship? What if I didn't even change the seed, just
pressed "create"?

I think it depends on the country, but thinking about authorship over
procedural generators is weird.

~~~
mrdoob2
I think this is a different issue...

I couldn't claim authorship of a machine generated work. I would feel better
about claiming authorship of something I've spent a while working on and
finding combinations until I get something I like.

Do you claim authorship of Photoshop's cloud filter?

~~~
mrec
It's a slightly worrying grey area. If a generator only has 2 possible
combinations of all its various settings, claiming authorship of the output is
clearly absurd. If it has 16 trillion possible combinations, maybe less so.

Where do you draw the line? If people can copyright a bunch of settings, does
that prevent people from using the generator with randomized parameters in
case they accidentally hit a lawsuit?

------
M4v3R
It's worth mentioning that Mr.doob (author of this code) is also an author of
three.js graphics library and many astonishing demos. Check out his Github and
home page ([http://mrdoob.com](http://mrdoob.com)) for (many) more interesting
things!

Example:
[http://mrdoob.github.io/three.js/examples/webgl_terrain_dyna...](http://mrdoob.github.io/three.js/examples/webgl_terrain_dynamic.html)

~~~
mrdoob2
Hehe! Thanks for that. But, to be fair, that last example was done by
[http://alteredqualia.com/](http://alteredqualia.com/).

------
nathell
Around 2002, I made something similar using WinAPI, in Pascal (FPC). Sadly,
the sources are gone, but the executable survives:
[http://students.mimuw.edu.pl/~dj189395/nhp/czynic/programy/w...](http://students.mimuw.edu.pl/~dj189395/nhp/czynic/programy/wintexgen/wintexgen-0.02alpha.exe)
[22 KiB, no external dependencies].

Screenshot:
[http://students.mimuw.edu.pl/~dj189395/nhp/czynic/programy/w...](http://students.mimuw.edu.pl/~dj189395/nhp/czynic/programy/wintexgen/wintexgen1.png)

Use at your peril, preferably in a VM, Wine, or similarly sandboxed
environment.

------
javajosh
Wow, what a strange and wonderful little program. I think it's neat how
@mrdoob put together a little standard library of functions that can be
chained together in a totally understandable abstraction "pass". It's a good
project, too, for people who, like me, want to have a good template for doing
general pixel-wise manipulation with canvas.

Thanks!

------
akerl_
[https://github.com/mrdoob/texgen.js/blob/564c6efb5b5647ad44d...](https://github.com/mrdoob/texgen.js/blob/564c6efb5b5647ad44d98205c93bf59dc513a85c/src/texgen.js#L29-L38)

I'll admit to being a bit concerned about programming practices like this. I'm
mostly inept at Javascript, but surely the language has better mechanisms for
accomplishing the goal here.

~~~
mrdoob2
I did it like this because I wanted to create the drawing loop as efficient as
possible, without switches or conditionals. That method gets executed per
pixel so the less logic the better.

If someone knows a better way I'm all ears!

~~~
bgtnhz
I fail to see the logic behind optimizing around conditionals when you are
running in an interpreted language.

~~~
mrdoob2
I instrumented the code and using conditionals resulted in 2x the generation
time per loop. These loops are executed only once so the VM doesn't have a
chance to optimise them.

~~~
gavanwoolery
I've done similar in the past and can concur that it does have large
performance benefits, at least in Chrome where I tested it.

