AOVs (Arbitrary Output Variables)

Discussions related to GPU Acceleration in LuxRender

Moderators: Dade, jromang, tomb, coordinators

AOVs (Arbitrary Output Variables)

Postby Dade » Wed Sep 18, 2013 11:42 am

Introduction

AOVs (Arbitrary Output Variables) support provides a way to render different channels (i.e. the rendering output is not just a single image but many with different kind of information). The different output channels can later be used to achieve many kind of compositing effects and tricks. BIASPATHCPU and PATHCPU are the only render engines currently supporting AOVs but PATHOCL and (partially) BIDIRCPU, BIDIRVMCPU will follow. The complete list of variables supported is:

- RGB (requires HDR image format)
- RGBA (requires HDR image format)
- RGB_TONEMAPPED
- RGBA_TONEMAPPED
- ALPHA
- DEPTH (requires HDR image format)
- POSITION (requires HDR image format)
- GEOMETRY_NORMAL (requires HDR image format)
- SHADING_NORMAL (requires HDR image format)
- MATERIAL_ID
- DIRECT_DIFFUSE (requires HDR image format)
- DIRECT_GLOSSY (requires HDR image format)
- EMISSION (requires HDR image format)
- INDIRECT_DIFFUSE (requires HDR image format)
- INDIRECT_GLOSSY (requires HDR image format)
- INDIRECT_SPECULAR (requires HDR image format)
- MATERIAL_ID_MASK
- DIRECT_SHADOW_MASK
- INDIRECT_SHADOW_MASK
- RADIANCE_GROUP (requires HDR image format)
- UV (requires HDR image format)
- RAYCOUNT (requires HDR image format)

The content of the channel should be easy to understand from the name. The syntax to enable AOVs is:

Code: Select all
film.outputs.1.type = RGB
film.outputs.1.filename = luxball_RGB.exr
film.outputs.2.type = RGB_TONEMAPPED
film.outputs.2.filename = luxball_RGB_TONEMAPPED.png
film.outputs.3.type = RGB_TONEMAPPED
film.outputs.3.filename = luxball_RGB_TONEMAPPED.exr
film.outputs.4.type = ALPHA
film.outputs.4.filename = luxball_ALPHA.png
film.outputs.5.type = ALPHA
film.outputs.5.filename = luxball_ALPHA.exr
film.outputs.6.type = DEPTH
film.outputs.6.filename = luxball_DEPTH.exr
film.outputs.7.type = POSITION
film.outputs.7.filename = luxball_POSITION.exr
film.outputs.8.type = GEOMETRY_NORMAL
film.outputs.8.filename = luxball_GEOMETRY_NORMAL.exr
film.outputs.9.type = SHADING_NORMAL
film.outputs.9.filename = luxball_SHADING_NORMAL.exr
film.outputs.10.type = MATERIAL_ID
film.outputs.10.filename = luxball_MATERIAL_ID.png
film.outputs.11.type = DIRECT_DIFFUSE
film.outputs.11.filename = luxball_DIRECT_DIFFUSE.exr
film.outputs.12.type = DIRECT_GLOSSY
film.outputs.12.filename = luxball_DIRECT_GLOSSY.exr
film.outputs.13.type = EMISSION
film.outputs.13.filename = luxball_EMISSION.exr
film.outputs.14.type = INDIRECT_DIFFUSE
film.outputs.14.filename = luxball_INDIRECT_DIFFUSE.exr
film.outputs.15.type = INDIRECT_GLOSSY
film.outputs.15.filename = luxball_INDIRECT_GLOSSY.exr
film.outputs.16.type = INDIRECT_SPECULAR
film.outputs.16.filename = luxball_INDIRECT_SPECULAR.exr
film.outputs.17.type = MATERIAL_ID_MASK
film.outputs.17.id = 255
film.outputs.17.filename = luxball_MATERIAL_ID_MASK_255.png
film.outputs.18.type = MATERIAL_ID_MASK
film.outputs.18.id = 255
film.outputs.18.filename = luxball_MATERIAL_ID_MASK_255.exr
film.outputs.19.type = MATERIAL_ID_MASK
film.outputs.19.id = 128
film.outputs.19.filename = luxball_MATERIAL_ID_MASK_128.png
film.outputs.20.type = DIRECT_SHADOW_MASK
film.outputs.20.filename = luxball_DIRECT_SHADOW_MASK.png
film.outputs.21.type = DIRECT_SHADOW_MASK
film.outputs.21.filename = luxball_DIRECT_SHADOW_MASK.exr
film.outputs.22.type = INDIRECT_SHADOW_MASK
film.outputs.22.filename = luxball_INDIRECT_SHADOW_MASK.png
film.outputs.23.type = INDIRECT_SHADOW_MASK
film.outputs.23.filename = luxball_INDIRECT_SHADOW_MASK.exr


Few examples.

RGB_TONEMAPPED:
luxball_RGB_TONEMAPPED.png


POSITION:
luxball_POSITION.png


INDIRECT_DIFFUSE:
luxball_INDIRECT_DIFFUSE.png


MATERIAL_ID/MATERIAL_ID_MASK

MATERIAL_ID/MATERIAL_ID_MASK channels are quite powerful and opens the door to a lot of post-processing actions. By default material will have an ID that mimics harlequin colors:

kitchen_MATERIAL_ID.png
kitchen_MATERIAL_ID.png (10.01 KiB) Viewed 6222 times


But you can explicitly set the material ID with, for instance:

Code: Select all
scene.materials.shell.type = mirror
scene.materials.shell.kr = 0.75 0.75 0.75
scene.materials.shell.id = 255


You can easily spot the modified material (255 = 0x0000ff = red):

luxball_MATERIAL_ID.png
luxball_MATERIAL_ID.png (10.52 KiB) Viewed 6368 times


The LuxBall "shell" is visible in red. Different material can have the same ID so you can easily group them.

MATERIAL_ID_MASK allows to obtain the mask of a specific material ID:

luxball_MATERIAL_ID_MASK_255.png
luxball_MATERIAL_ID_MASK_255.png (9.79 KiB) Viewed 6222 times


RADIANCE_GROUP (aka Light Groups)

Lux-like light groups are now supported too. You can assign a light source to a group using ".id" property for sun/sky/infinitelight and ".emission.id" for materials, for instance:

Code: Select all
scene.materials.whitelight.type = matte
scene.materials.whitelight.emission = 120.0 120.0 120.0
scene.materials.whitelight.emission.id = 0

scene.infinitelight.file = scenes/simple-mat/arch.exr
scene.infinitelight.gain = 4.0 4.0 4.0
scene.infinitelight.id = 1


The default ID is 0 and IDs are supposed to be a sequence starting from 0 (otherwise memory is wasted for unused light groups). The output can be controlled with the following properties:

Code: Select all
# Film outputs
film.outputs.1.type = RGB
film.outputs.1.filename = simple_RGB.exr
film.outputs.2.type = RADIANCE_GROUP
film.outputs.2.id = 0
film.outputs.2.filename = simple_LIGHT_GROUP_0.exr
film.outputs.3.type = RADIANCE_GROUP
film.outputs.3.id = 1
film.outputs.4.filename = simple_LIGHT_GROUP_1.exr


The result is simple_RGB.exr (all lights):

simple_RGB.png


simple_LIGHT_GROUP_0.exr (a light group with the 2 area lights):

simple_LIGHT_GROUP_0.png


simple_LIGHT_GROUP_1.exr (a light group with the infinitelight):

simple_LIGHT_GROUP_1.png
User avatar
Dade
Developer
 
Posts: 8363
Joined: Sat Apr 19, 2008 6:04 pm
Location: Italy

Re: AOVs (Arbitrary Output Variables)

Postby zsolnai » Wed Sep 18, 2013 12:28 pm

So many things in so little time. Unreal. Thank you Dade!
zsolnai
Developer
 
Posts: 519
Joined: Sun May 22, 2011 6:17 pm

Re: AOVs (Arbitrary Output Variables)

Postby tomb » Wed Sep 18, 2013 12:54 pm

Awesome!
User avatar
tomb
Developer
 
Posts: 2677
Joined: Thu Oct 11, 2007 4:23 pm
Location: Oslo, Norway

Re: AOVs (Arbitrary Output Variables)

Postby B.Y.O.B. » Wed Sep 18, 2013 2:28 pm

Will the MATERIAL_ID channel get anti-aliasing?
User avatar
B.Y.O.B.
Developer
 
Posts: 5139
Joined: Wed Nov 10, 2010 4:10 pm
Location: Germany

Re: AOVs (Arbitrary Output Variables)

Postby Dade » Wed Sep 18, 2013 2:53 pm

B.Y.O.B. wrote:Will the MATERIAL_ID channel get anti-aliasing?


You can not anti-alias an ID (i.e. a number) otherwise it becomes a different ID. You are probably looking for another kind of information: the pixel coverage of a specific MATERIAL_ID (i.e. similar to ALPHA channel but related to a specific MATERIAL_ID and not to the background). It is a different kind of output variable that I can add.
User avatar
Dade
Developer
 
Posts: 8363
Joined: Sat Apr 19, 2008 6:04 pm
Location: Italy

Re: AOVs (Arbitrary Output Variables)

Postby B.Y.O.B. » Wed Sep 18, 2013 4:04 pm

I don't know the technical terms and differences, but I'm looking for a mask I can use for postpro, and such a mask needs to be antialiased :)
It's really great to see all these channels available in Lux now btw., thanks for your efforts Dade!
Will they be available for "classic" bidir, too, or only for SLG rendering modes?
User avatar
B.Y.O.B.
Developer
 
Posts: 5139
Joined: Wed Nov 10, 2010 4:10 pm
Location: Germany

Re: AOVs (Arbitrary Output Variables)

Postby SATtva » Wed Sep 18, 2013 10:27 pm

Amazing work Dade!

B.Y.O.B. wrote:I don't know the technical terms and differences, but I'm looking for a mask I can use for postpro, and such a mask needs to be antialiased

As a partial workaround, you can render, say, in 2x resolution and then downscale an image.
Linux builds packager
聞くのは一時の恥、聞かぬのは一生の恥
User avatar
SATtva
Developer
 
Posts: 7163
Joined: Tue Apr 07, 2009 12:19 pm
Location: from Siberia with love

Re: AOVs (Arbitrary Output Variables)

Postby Rhys » Wed Sep 18, 2013 11:34 pm

In my experience material ID typically by default would spit out a unique RGB for every material and comes out blocky/aliased. If you want to overwrite a specific RGB you can.
After all it is a "material ID" ie it assigns a colour to represent the materials/objects uniqueness, not a mask nor unlit RGB override layer.

This is an objectID /materialID in vray
ObjectID.png


For masks I imagine you could assign objects/materials to a mask group or pass number and those objects would come out looking like a standard alpha channel, and with all filtering/motion blur etc.
Rhys
 
Posts: 776
Joined: Fri Mar 06, 2009 5:40 pm
Location: Australia

Re: AOVs (Arbitrary Output Variables)

Postby Dade » Thu Sep 19, 2013 4:40 am

Updated initial post with: MATERIAL_ID_MASK channel and now material will have a default ID that mimics harlequin colors.
User avatar
Dade
Developer
 
Posts: 8363
Joined: Sat Apr 19, 2008 6:04 pm
Location: Italy

Re: AOVs (Arbitrary Output Variables)

Postby SATtva » Thu Sep 19, 2013 4:43 am

Dade, is it possible to have shadow channel as well?
Linux builds packager
聞くのは一時の恥、聞かぬのは一生の恥
User avatar
SATtva
Developer
 
Posts: 7163
Joined: Tue Apr 07, 2009 12:19 pm
Location: from Siberia with love

Next

Return to GPU Acceleration

Who is online

Users browsing this forum: No registered users and 1 guest