Eval2D: Procedural Content Editor

I’m always trying to cut time off my feedback loop, especially when the work involves tweaking parameters without a clear idea of their impact. This has been especially true for procedural content, where much of my time is spent discovering how to compose functions to produce interesting effects.

For a cheap solution, I’ve used NUnit to define tests that output images, then tweaked parameters and re-run the tests. In some cases, I generate multiple images for ranges of parameters. This process works fairly well, especially with test running integrated into VS 2012 or through an addon like Resharper.

I finally decided it might be worth investing some time into a dedicated solution that allows me to write my code and get instant feedback. Building a small utility also makes for a fun distraction justified with the notion that I’ll be working more effectively with it.

So here’s Eval2D, a procedural texture tool where your C# script is evaluated as you type for instant visual feedback:

It’s a preview pane, a code editor, and a results/errors pane. Autocomplete works in simple cases. Evaluation of highlighted code sections is supported (as seen in many SQL editors). The layout changes when the window widens:

Components

  • AvalonEdit: This is the same editor used for SharpDevelop, and gives me most of what I need in a code editor.
  • Roslyn CTP: Works well for executing the scripts, but I had a bit of trouble querying compilations for type information to support autocomplete.
  • MahApps.Metro: Window styling.
  • Noise library: This my own code, which has a fluent interface around noise/math functions that makes for easy function composition. It’s very flexible, but could be much faster with GPU support.

Planned Features

It works well enough for now, but I’d really like to have fully working autocompletion, popup sliders for numeric literals (as might be seen in shader/material editors or LightTable), and a color picker for hex-formatted uints. Access to a time variable within the script would help in visualizing the effect of changing parameters. For my own use, I’m not interested at all in any kind of modular GUI system like most 3D modeling apps have. I intend to keep a minimalist design and add features only as needed.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>