Generic Mappings - RenderToolbox/RenderToolbox4 GitHub Wiki

RenderToolbox defines a few "Generic" scene elements that can be specified in mappings with destination Generic.

These mappings will apply to PBRT as well as Mitsuba.

Generic Scene Elements

Here are all of the Generic scene elements that you can specify in the mappings file, with destination Generic.

Each element is presented as a JSON object which you could copy into your mappings file. The property values given will be the defaults. You could omit any properties to accept the defaults, or change their values to whatever you want.

You should also change the name field from Foo or Bar to the name of an element in your own 3D scene.

Materials

Available Generic materials are matte, anisoward, and metal.

matte

The matte material is for diffuse, Lambertian reflectors.

{
  "name": "Foo",
  "broadType": "materials",
  "specificType": "matte",
  "destination": "Generic",
  "operation": "update",
  "properties": {
    "name": "diffuseReflectance",
    "valueType": "spectrum",
    "value": "300:0 800:0"
  }
}

anisoward

The anisoward material is for the anisotropic Ward reflectance model.

{
  "name": "Foo",
  "broadType": "materials",
  "specificType": "anisoward",
  "destination": "Generic",
  "operation": "update",
  "properties": [
    {
      "name": "diffuseReflectance",
      "valueType": "spectrum",
      "value": "300:0 800:0"
    },
    {
      "name": "specularReflectance",
      "valueType": "spectrum",
      "value": "300:0.5 800:0.5"
    },
    {
      "name": "alphaU",
      "valueType": "float",
      "value": 0.15
    },
    {
      "name": "alphaV",
      "valueType": "float",
      "value": 0.15
    }
  ]
}

metal

The metal material is for rough metallic reflectors, based on measured parameters "eta" and "k".

{
  "name": "Foo",
  "broadType": "materials",
  "specificType": "metal",
  "destination": "Generic",
  "operation": "update",
  "properties": [
    {
      "name": "eta",
      "valueType": "spectrum",
      "value": "300:0 800:0"
    },
    {
      "name": "k",
      "valueType": "spectrum",
      "value": "300:0 800:0"
    },
    {
      "name": "roughness",
      "valueType": "float",
      "value": 0.05
    }
  ]
}

Lights

Available Generic lights are point, spot, and directional.

point

The point light is for point-like emitters.

{
  "name": "Foo",
  "broadType": "lights",
  "specificType": "point",
  "destination": "Generic",
  "operation": "update",
  "properties": {
    "name": "intensity",
    "valueType": "spectrum",
    "value": "300:0 800:0"
  }
}

spot

The spot light is for cone-shaped emitters.

{
  "name": "Foo",
  "broadType": "lights",
  "specificType": "spot",
  "destination": "Generic",
  "operation": "update",
  "properties": {
    "name": "intensity",
    "valueType": "spectrum",
    "value": "300:0 800:0"
  }
}

directional

The directional light is for parallel-ray emitters, like very distant light sources.

{
  "name": "Foo",
  "broadType": "lights",
  "specificType": "directional",
  "destination": "Generic",
  "operation": "update",
  "properties": {
    "name": "intensity",
    "valueType": "spectrum",
    "value": "300:0 800:0"
  }
}

blessAsAreaLight

Mesh elements may be "blesses" as area lights. This will cause the mesh to emit light with a given spectrum.

Note that the broadType is meshes, not lights.

Also note the special operation, blessAsAreaLight.

{
  "name": "Foo",
  "broadType": "meshes",
  "destination": "Generic",
  "operation": "blessAsAreaLight",
  "properties": {
    "name": "intensity",
    "valueType": "spectrum",
    "value": "300:1 800:1"
  }
}

Textures

Available Generic textures are bitmap and checkerboard.

You should create a texture as a separate scene element, then apply it to a material. See below.

bitmap

The bitmap texture is for wrapping an image file around a shape.

Note the broadType spectrumTextures, which makes sense for RGB images. broadType floatTextures is also allowed, which makes sense for monochrome or single-channel images.

You should provide a path to an image file in the filename property.

{
  "name": "Bar",
  "broadType": "spectrumTextures",
  "specificType": "bitmap",
  "destination": "Generic",
  "operation": "create",
  "properties": [
    {
      "name": "filename",
      "valueType": "string",
      "value": ""
    },
    {
      "name": "gamma",
      "valueType": "float",
      "value": "1"
    },
    {
      "name": "maxAnisotropy",
      "valueType": "float",
      "value": 20
    },
    {
      "name": "offsetU",
      "valueType": "float",
      "value": 0
    },
    {
      "name": "offsetV",
      "valueType": "float",
      "value": 0
    },
    {
      "name": "scaleU",
      "valueType": "float",
      "value": 1
    },
    {
      "name": "scaleV",
      "valueType": "float",
      "value": 1
    },
    {
      "name": "wrapMode",
      "valueType": "float",
      "value": "repeat"
    },
    {
      "name": "filterMode",
      "valueType": "float",
      "value": "ewa"
    }
  ]
}

checkerboard

The checkerboard texture is for wrapping a pattern of square checkers around a shape.

{
  "name": "Bar",
  "broadType": "spectrumTextures",
  "specificType": "checkerboard",
  "destination": "Generic",
  "operation": "create",
  "properties": [
    {
      "name": "oddColor",
      "valueType": "spectrum",
      "value": "300:0 800:0"
    },
    {
      "name": "evenColor",
      "valueType": "spectrum",
      "value": "300:0 800:0"
    },
    {
      "name": "offsetU",
      "valueType": "float",
      "value": 0
    },
    {
      "name": "offsetV",
      "valueType": "float",
      "value": 0
    },
    {
      "name": "checksPerU",
      "valueType": "float",
      "value": 0
    },
    {
      "name": "checksPerV",
      "valueType": "float",
      "value": 0
    }
  ]
}

Applying Textures

You can apply a texture to an existing material, to give it spatially-varying reflectance.

You can also use the special operation blessAsBumpMap to give a material spatially-varying hight adjustments.

Reflectance

You can use a texture property type instead of spectrum for many types of materials and material properties. This causes spatially-varying reflectances.

This specific example uses matte material and applies a texture named Bar to the diffuseReflectance. You can use other material types and properties.

{
  "name": "Foo",
  "broadType": "materials",
  "specificType": "matte",
  "destination": "Generic",
  "operation": "update",
  "properties": [
    {
      "name": "diffuseReflectance",
      "valueType": "texture",
      "value": "Bar"
    }
  ]
}

blessAsBumpMap

You can use the special operation blessAsBumpMap to apply a texture to a material, to cause spatially-varying height adjustments.

{
  "name": "Foo",
  "broadType": "materials",
  "specificType": "matte",
  "destination": "Generic",
  "operation": "blessAsBumpMap",
  "properties": [
    {
      "name": "texture",
      "valueType": "string",
      "value": "Bar"
    },
    {
      "name": "scale",
      "valueType": "float",
      "value": 0.1
    }
  ]
}

Things That Can Be Generic

In order for RenderToolbox to define a generic scene element:

  • PBRT and Mitsuba must agree on a particular behavior.
  • We have to know that they agree.
  • We have to know how to specify the behavior for both renderers.

So far, this makes for a short list of generic scene elements.

For example, consider a rough metal material. Both renderers define surface reflectance functions that model metals, and they parametrize the functions in similar ways. So it would seem that both renderers should agree on metal-related behaviors. However, the renderers use different surface microfacet models, so it's unclear how to specify the same "roughness" to both renderers. We may yet figure this out.