How does one Render a lookup texture?

Cheers friends,

I’m wanting to implement a hair shader using the specular calculations from the Meschner model, and will require lookup textures for some of the portions. I don’t know how to go about generating them. Is there software easily available that will write out a texture for the values of a function over an input range? I’m sure matlab can do this but I don’t have access to that, and it seems a bit overkill for my purposes.

Suggestions?

Can you give an example of what you’re talking about?

I used to do look-up textures with MaxScript (it’s amazingly slow to manipulate pixels in MaxScript, I know…), but I’m mostly using Python and PIL (Python imaging library) nowadays for quick-and-dirty things.

SamiV.

Sam: thanks I’ll take a look that direction.

Rob: take a look at the paper on the Nvidia Nalu demo. There are a few functions related to the reflectance and transmission of light from hair that are interactions of two angular variables (phi and theta) which become expensive to calculate per pixel per frame, so the nvidia team dumped them to LUT’s.
I want to do essentially the same thing.

I was also working on a realtime Perlin noise algorithm and could use pregenerated maps for portions of that to reduce instruction count.

You should also look into imagemagick it’s very fast at manipulating pixels. And has wrappers for … python, ruby, etc. It’s pretty much my goto for image manipulation.

Cheers

If you set up a rendermonkey project you can run your functions in a pixel shader that is drawn onto a full screen quad in a render target of whatever size you want your LUT to be, then use the rendermonkey texture saver to write your render target out to disk. Using one of the deferred rendering examples will give you a good head start on getting a render-to-texture setup going.

Could do some image processing with c# by using the lockbit method. Very useful for future projects/solutions too :slight_smile: