Hacker News new | past | comments | ask | show | jobs | submit login
Texgen.js – Lightweight Procedural Texture Generator (github.com/mrdoob)
98 points by mef on Jan 26, 2015 | hide | past | favorite | 21 comments



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?


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.


Actually, it seems like a good question to me. The MIT license (and the other major ones, afaik) specifically applies to the software (and docs), not what artifacts the software might produce. It's not clear to me whether those would be included under the same terms. I would assume they're free to use, but I'm not sure that's (always) true and IANAL.

Something to think about: if I write a program that outputs a work under copyright (without actually containing the copywritten work), can I still use a permissive license?


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.


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 ;)


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.


The concept you are talking about is the threshold of originality and it is indeed depending on country and a moving target:

http://en.wikipedia.org/wiki/Threshold_of_originality

As an example: if I use a seed to create a grainy texture, it probably isn't original. If I use the same image as a grain filter for a photograph, the result may be original (in a legal sense). Both operations are trivial and just a click of a button (or two), so I think the discussion about the ease is moot in that context.


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?


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?


The source for each sample is all in index.html: https://github.com/mrdoob/texgen.js/blob/master/index.html


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) for (many) more interesting things!

Example: http://mrdoob.github.io/three.js/examples/webgl_terrain_dyna...


Hehe! Thanks for that. But, to be fair, that last example was done by http://alteredqualia.com/.


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... [22 KiB, no external dependencies].

Screenshot: http://students.mimuw.edu.pl/~dj189395/nhp/czynic/programy/w...

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


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!


https://github.com/mrdoob/texgen.js/blob/564c6efb5b5647ad44d...

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.


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!


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


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.


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.


Stating the obvious, but I'm pretty sure that there are no longer any purely interpreting JS engines around, it's all JIT or AOT compiled, so optimizing for a compilation scenario definitely makes sense.


Testing beats imagination.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: