For the project, I converted the Living Room scene from Benedikt Bitterli. This scene is quite involved, the resulting scene has 181 meshes, 24 materials, 16 texture maps. Also, it has 17 light sources to fake global illumination to some extent. I used area lights, which require many samples. In the end, the scene with 100 samples took 45 minutes to render. Here is the final output:
Here, with the ambient light cranked up even more:
Mainly, I followed the PBRT scene description of The White Room on Benedikt Bitterli's rendering resources page. I also consulted the McGuire Computer Graphics Archive to get the scene rendered in Blender and Unity3D. Those two tools helped me tons to determine the camera positions and light positions.
I first looked at the documentation of the PBRT scene files, which is extensive enough so that I can make sense of the scene file.
The Camera
The scene format in PBRT allows for 4x4 camera transformation matrices, which I have not supported so far. Scratchapixel has a page in which they describe the camera matrix in detail. From what I see and a search in StackOverflow, I thought this decomposition is nontrivial at first. But, while writing this blog, I still feel like I am a couple of insights away from addressing how to decompose this matrix so that I can plug into our scene description flawlessly.
In the end, I rendered the scene in Unity3D and Blender, to get an overview:
Then, I put together a simple script that outputs camera parameters in a given view. I placed the camera to a suitable position, got the camera parameters, and fed that to our scene description file. One thing to take care of is that the coordinate systems of Unity3D and Blender are different, so one should compensate before evaluating the coordinates.
Lights
This is the most involved part of all. To fake global lighting, I placed many area lights at the windows. I also put point lights to the outside of the room at various locations so that the room looks as if it is illuminated through windows. The original scene description had 4 area lights, whose positions are denoted by the red cubes in the image below:
One of those area lights is from the inside. I also added a directional light as if it is coming from outside. The rest are point lights. I tweaked their radiances so that the shadows look balanced. The lamp still has shadows, which gives a clue about the room being illuminated from inside. I also added two spotlights to simulate the lamp.
Transformations, Meshes, and Materials
The scene had a Composite matrix transformation, which I already implemented for the Veach-Ajar scene. For a wall, There are vertex data and the respective triangulation. The rest of the geometry is bundled in PLY files. The most troublesome part was that some of the meshes had flipped normals (the object normals are looking inside the object). Here's how it looks:
The objects that are marked in red are looked as if they are shadowed, although they were illuminated. It turns out that nearly half of the 180 objects had this issue. I used MeshLab to correct the normals, by inverting them:
However, later I found out that this has a caveat: PLY files whose normals are inverted needs to be overwritten, and MeshLab does not record the UV coordinates in the process. So, I sacrificed texture mapping in some objects in the process. Some of the objects, such as the picture frames and the books lost their UVs. There could be two more advanced solutions to this problem: One is to use UV transfer, and the other is to add another attribute to meshes so that during their parsing, the vertex and face order is rearranged so that the normals would point outward.
For materials, I stuck to the PBRT description whenever possible. PBRT supports opacity and different material types such as "uber," so I converted them to some other material that looks just right. Texture maps can be changed easily, so I changed the pictures in the scene to decorate the room.
I also tried to add Tonemapping, but with various settings with a global operator, I could not manage to get a good result. Here is one of the intermediate results, which is tonemapped by Bracket:
Here, with the ambient light cranked up even more:
Mainly, I followed the PBRT scene description of The White Room on Benedikt Bitterli's rendering resources page. I also consulted the McGuire Computer Graphics Archive to get the scene rendered in Blender and Unity3D. Those two tools helped me tons to determine the camera positions and light positions.
I first looked at the documentation of the PBRT scene files, which is extensive enough so that I can make sense of the scene file.
The Camera
The scene format in PBRT allows for 4x4 camera transformation matrices, which I have not supported so far. Scratchapixel has a page in which they describe the camera matrix in detail. From what I see and a search in StackOverflow, I thought this decomposition is nontrivial at first. But, while writing this blog, I still feel like I am a couple of insights away from addressing how to decompose this matrix so that I can plug into our scene description flawlessly.
In the end, I rendered the scene in Unity3D and Blender, to get an overview:
Then, I put together a simple script that outputs camera parameters in a given view. I placed the camera to a suitable position, got the camera parameters, and fed that to our scene description file. One thing to take care of is that the coordinate systems of Unity3D and Blender are different, so one should compensate before evaluating the coordinates.
Lights
This is the most involved part of all. To fake global lighting, I placed many area lights at the windows. I also put point lights to the outside of the room at various locations so that the room looks as if it is illuminated through windows. The original scene description had 4 area lights, whose positions are denoted by the red cubes in the image below:
One of those area lights is from the inside. I also added a directional light as if it is coming from outside. The rest are point lights. I tweaked their radiances so that the shadows look balanced. The lamp still has shadows, which gives a clue about the room being illuminated from inside. I also added two spotlights to simulate the lamp.
Transformations, Meshes, and Materials
The scene had a Composite matrix transformation, which I already implemented for the Veach-Ajar scene. For a wall, There are vertex data and the respective triangulation. The rest of the geometry is bundled in PLY files. The most troublesome part was that some of the meshes had flipped normals (the object normals are looking inside the object). Here's how it looks:
The objects that are marked in red are looked as if they are shadowed, although they were illuminated. It turns out that nearly half of the 180 objects had this issue. I used MeshLab to correct the normals, by inverting them:
However, later I found out that this has a caveat: PLY files whose normals are inverted needs to be overwritten, and MeshLab does not record the UV coordinates in the process. So, I sacrificed texture mapping in some objects in the process. Some of the objects, such as the picture frames and the books lost their UVs. There could be two more advanced solutions to this problem: One is to use UV transfer, and the other is to add another attribute to meshes so that during their parsing, the vertex and face order is rearranged so that the normals would point outward.
For materials, I stuck to the PBRT description whenever possible. PBRT supports opacity and different material types such as "uber," so I converted them to some other material that looks just right. Texture maps can be changed easily, so I changed the pictures in the scene to decorate the room.
I also tried to add Tonemapping, but with various settings with a global operator, I could not manage to get a good result. Here is one of the intermediate results, which is tonemapped by Bracket:
Comments
Post a Comment