DavidBrainard / RenderToolbox3

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

Collada to PBRT convert multiple polylists #14

Closed benjamin-heasly closed 11 years ago

benjamin-heasly commented 11 years ago

ConvertGeometry() in Collada To PBRT only converts a single polylist for each mesh. But meshes might contain multiple polylists.

For example, in the [[SpectralIllusion]] example scene, the 25 facets on each cube face come as 25 separate polylists in the Collada file. This allows each facet to have its own color, even though there is only one big cube mesh object.

The Mitsuba converter already converts multiple polylists for each mesh.

benjamin-heasly commented 11 years ago

This raises the issue of how to refer to each polylist.

Mitsuba refers to each polylist object using the name of the parent geometry, plus a numeric suffix. So, say a geometry has the id myShape-mesh. Say the geometry's mesh contains 2 polylists. Mitsuba would create scene objects with names myShape-mesh_0 and myShape-mesh_1.

This works fine for Mitsuba, internally. We could adopt the same behavior for ColaldaToPBRT/ConvertGeometry().

Users would need to know this naming convention so that they could refer to individual polylists in their mappings files. The convention might look like magic:

As a convenience, RenderToolbox3 could automatically convert unnumbered geometry ids like myShape-mesh into myShape-mesh_0. This is the current behavior to accommodate Mitsuba in ApplyMitsubaObjects().

Users would still be free to use precise ids, like myShape-mesh_0 and myShape-mesh_5, if they knew what they wanted.

benjamin-heasly commented 11 years ago

The issue of referring to numbered polylists only matters if users need to access a particular polylist in the mappings file.

Each polylist can have its own material as specified in Blender, without users having to worry.

Users can bless a whole geometry as an area light, in the mappings file, without having to refer to numbered polylists.

So this is only an "issue" if users need to e.g. bless an individual polylist as an area light. Even then, that would be separate from this issue about converting multiple polylists for PBRT.

benjamin-heasly commented 11 years ago

78a9780f24fce24e67a1569131c462a5c81e6dea converts multiple polylists from each geometry mesh. Each polylist may have its own material. Each polylist gets a numeric suffix.