6

I would like to write some software that composes images out of procedural textures. For ultimate flexibility I would like to access/create those textures via an API.

In the past I have used POV-Ray for basic textures, I have used free version of Genetica and tweaked its pre-sets, and I have also used the Resynthesis GIMP plugin to generate textures from photographs, or to process textures from other sources. These tools are all great, but lock me in to a process of creating a texture image library, when I'd rather be creating texture "recipes" using parameters. Now I have learnt what I want to do with those tools, I want to take a step back and write code that generates the kinds of textures I need, and maintain a library of parameters for that code.

Requirements:

  • API/library for C, C++ or Ruby (feel free to add others for general interest, especially if open-source, but I will not be able to accept for my purposes).

  • Supports PNG format, including alpha channel, or can be linked with a library that does.

  • Control at level of texture primitives, various types of noise, colour maps, bump maps etc.

  • Combination of texture primitives in a layer- or node- based manner.

  • Pre-sets or examples for simple naturalistic textures - rock, wood, water, mud, grass.

  • Resulting textures do not need to be photo-realistic, but close enough for use in a simple game environment.

  • Nice to have: Can be used to create undistorted tileable textures.

  • Absolute best: Could rival Genetica (or similar paid app) in variety and quality, but an open-source library, not a paid application.

  • Not important: Speed. I will be generating textures as part of a non-real-time workflow, and am not considering frames-per-second or CPU cost. If it takes 30 seconds to generate a screen full of the texture, that is probably OK. Quality and flexibility are far more important than speed.

Update: I have been asked about workflow. I view using a texture API as part of a two-step process:

  1. Generate/explore textures either by manually building them, or by trying variations. I'd happily take a pre-existing GUI with a management interface, controls like sliders etc here. Equally I am fine to make my own less sophisticated explorer directly from an API. Textures that I like, I will store with an id and some metadata.

  2. To use the texture library, I intend to write software for automatically generating and rendering image content (not a raytracer or game engine, but working at a similar level of generating pixel values). This might be maps for games, uv mapped textures for objects for rendering elsewhere, or just abstract art. This software will pick suitable textures from the library and need to render them, ideally with unique random seed values (or noise offset vectors) before mapping to correct place in a scene or object. The problem with a pre-rendered texture library here is that the exact same pixels would get re-used again and again.

2
+100

Since I don't exactly understand your workflow, my suggestion can be completely wrong, but based on the requirements you've set, Blender (although being an open-source 3D software) pretty much pulls it off with some exceptions.

It's written in C/C++ but instead of Ruby it has a Python API.

On the other hand it has a powerful node-based texturing/material system with lots of procedural textures and operators, png and alpha support, etc. It doesn't have built-in naturalistic textures (it's easy to add those though).

  • Does the API have enough flexibility to describe and render out a texture (I presume in some template scene I'd need to create) without loading the GUI, so I could use it as a library, and not an application? If yes, could you link documentation to the API, or even better if you could point to an example/tutorial of generating and rendering a scene (any scene, does not have to be for texture library per-se) via the API in this way? That would allow me to verify the answer quickly – Neil Slater Jan 30 '15 at 14:19
  • Unfortunately I mainly use Blender, I don't develop scripts, but since it has a complete built-in game engine, I suppose it's possible. Here's a link to the API doc.: [link]blender.org/api/blender_python_api_2_73a_release Feel free to ask here, I'm sure that someone is going to be able to give more specific answers: [link]blenderartists.org/forum/forumdisplay.php?47-Coding – galingong Jan 30 '15 at 14:37
  • I skimmed through the API, and I think this answer on Blender Stack Exchange shows how to fire up the app directly from a script: blender.stackexchange.com/questions/1365/… and linked from there wiki.blender.org/index.php/User%3aIdeasman42/BlenderAsPyModule shows that running Blender as a library form a calling script (probably the ideal scenario for me) is feasible, but not officially supported – Neil Slater Jan 30 '15 at 16:19
  • I do not think this is my ideal answer (due to needing Python, and experimental nature of API when used as a library and not a script engine for the GUI). However, I think it is closest possible, and might be useful to others looking for similar thing. So granting you the bounty, but not marking accepted. – Neil Slater Feb 4 '15 at 10:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.