DavidBrainard / RenderToolbox3

Matlab toolbox for managing graphics rendering for psychophysics
MIT License
11 stars 4 forks source link

Generic bump map syntax #12

Closed benjamin-heasly closed 11 years ago

benjamin-heasly commented 11 years ago

PBRT and Mitsuba have similar bump map functionality, but they implement it in different ways. For example, PBRT textures have a scale parameter, and PBRT materials have a bump map parameter. Mitsuba textures must be wrapped in scale textures, and bump maps must compose a texture and a target material.

RenderToolbox3 should have a generic mappings syntax for working with bump maps, to smooth this out.

benjamin-heasly commented 11 years ago

Here's an overview of bump maps in PBRT.

All materials have a "bumpmap" property that takes a float-texture value.

A "scale" texture composes two textures and returns their product. It would be useful to compose a bumpmap texture with a constant float, to make a free scale parameter.

As of 17 April 2013, RenderToolbox3 has generic mappings syntax for 'bitmap" and "checkerboard" textures.

So adding a bump map in PBRT would look something like this:

benjamin-heasly commented 11 years ago

Here is an overview of bump maps in Mitsuba.

The "bump" bsdf is a material modifier that composes a texture and another bsdf.

The "scale" texture composes a texture and a scale value and returns the scaled texture. It would be useful to wrap a bump map texture inside a "scale" texture, to make a free scale parameter.

As of 17 April 2013, RenderToolbox3 has generic mappings syntax for 'bitmap" and "checkerboard" textures.

So adding a bump map in Mitsuba would look something like this:

benjamin-heasly commented 11 years ago

The basic elements of bump maps are the same for PBRT and Mitsuba:

But the top-level scene elements are different:

This presents a problem. Say I have a scene where an existing object refers to an existing material. I want to add a bump map to the existing material.

For this to work in Mitsuba, I would have to do some re-wiring to make sure that the new "bump" bsdf had the same id as the original bsdf, so that the existing reference would not break. This would mean making up a new id for the original bsdf. What would happen now, if I wanted to refer to the original bsdf?

benjamin-heasly commented 11 years ago

I think the resolution is that users don't really care about ids and wiring, as long as they can specify what they need. Re-wiring can happen after the user is done specifying things.

Here are things the user will need to specify in a mappings file:

benjamin-heasly commented 11 years ago

d391e80bb059754b9247cbf6a3347a245ad3eac7 contains Generic mappings bump map syntax, as described above. MakeMaterialSphereBumps demonstrates the new syntax.