ISET / iset3d-v3

LEGACY: Replaced by iset3d (v4) -- Read a PBRT file. Edit the parameters. Render an ISET scene or optical image.
MIT License
36 stars 8 forks source link

Warnings, etc., in t_piSimpleTransforms #10

Closed DavidBrainard closed 5 years ago

DavidBrainard commented 6 years ago

We were able to install and run this tutorial! Yay! If you use ToolboxToolbox you can just type tbUse('iset3d') and all dependencies will be magically sucked down to your computer and put on your path.

A) However, we got this warning:

Warning: Cannot find "filter" in PBRT file.

In piRead (line 195) In t_piSimpleTransforms (line 19) Warning: "Renderer" does not exist in the new PBRTv3 format. We leave the field blank . In piRead (line 227) In t_piSimpleTransforms (line 19)

Should we be worried?

B) The tutorial writes data onto the isetbio tree. Should we check it in? Probably not. Probably things should be changed to write to tempdir or a "local" ignored directory within the tree.

tlian7 commented 6 years ago

EDIT: I replied twice on accident since the first comment didn't show up in my browser for some reason. It worked out though, since I had previously misread your second question anyway. I've deleted the old comment.

Hi @DavidBrainard!

Glad the script works for you!

A) The warning is not an issue - in fact it might be time to get rid of it. The reason it's there is because PBRTv2 has a "Renderer" parameters in the render recipe, but PBRTv3 no longer uses it. To keep ISET3d compatible with v2, the Renderer parameter is still within the recipe structure but will remain blank if you are using v3 recipes.

B) Oh, that's odd. When I run it the local folder is written into the ISET3d tree (is that what you meant, or was it actually written into ISETBio?) Anyway, I usually manually git ignore the local folder in my repo, but maybe there's a way to do that automatically when the folder is first created?

DavidBrainard commented 6 years ago

It is writing into data/V3/coloredCube, in iset3D, modifying the file coloredCube.json.

And t_piExample_SceneAssembly writes into data/V3/checkerboard, before it crashes.

Should data also be git ignored? Or should this output stuff go into the local tree instead?

tlian7 commented 6 years ago

So @Zhenyi-Liu can probably speak more to this, but I believe those extra JSON and material files are written to faciliate the interaction between the large simulated driving scenes and the cloud system. We’ve discussed previously that we would like to write these files somewhere else (probably to the local directory,) so I think in the future those extra files won’t be an issue once the changes are made.

Zhenyi-Liu commented 6 years ago

This is a typical output of geometry.pbrt exported from c4d(I can share the plugin later):

AttributeBegin

   #ObjectName Cube:Vector(10, 10, 10)
   ConcatTransform [1.0 0.0 0.0 0  0.0 1.0 0.0 0  0.0 0.0 1.0 0  23.2946776584 0.0 191.803232641 1]
   AttributeBegin
    NamedMaterial "cube_material"
         Shape "trianglemesh"  "integer indices" [0 1 2 2 3 0 4 5 6 6 7 4 8 9 10 10 11 8 12 13 14 14 15 12 16 17 18 18 19 16 20 21 22 22 23 20 ] 
         "point P" [-10.0 0.188180036279 -10.0 -10.0 20.1881800363 -10.0 10.0 20.1881800363 -10.0 10.0 0.188180036279 -10.0 10.0 0.188180036279 -10.0 10.0 20.1881800363 -10.0 10.0 20.1881800363 10.0 10.0 0.188180036279 10.0 10.0 0.188180036279 10.0 10.0 20.1881800363 10.0 -10.0 20.1881800363 10.0 -10.0 0.188180036279 10.0 -10.0 0.188180036279 10.0 -10.0 20.1881800363 10.0 -10.0 20.1881800363 -10.0 -10.0 0.188180036279 -10.0 -10.0 20.1881800363 -10.0 -10.0 20.1881800363 10.0 10.0 20.1881800363 10.0 10.0 20.1881800363 -10.0 -10.0 0.188180036279 10.0 -10.0 0.188180036279 -10.0 10.0 0.188180036279 -10.0 10.0 0.188180036279 10.0 ] 
         "float uv" [0.0 -1.0 0.0 0.0 1.0 0.0 1.0 -1.0 0.0 -1.0 0.0 0.0 1.0 0.0 1.0 -1.0 0.0 -1.0 0.0 0.0 1.0 0.0 1.0 -1.0 0.0 -1.0 0.0 0.0 1.0 0.0 1.0 -1.0 0.0 -1.0 0.0 0.0 1.0 0.0 1.0 -1.0 0.0 -1.0 0.0 0.0 1.0 0.0 1.0 -1.0 ] 
         "normal N" [0.0 0.0 -1.0 0.0 0.0 -1.0 0.0 0.0 -1.0 0.0 0.0 -1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 -1.0 0.0 0.0 -1.0 0.0 0.0 -1.0 0.0 0.0 -1.0 0.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 -1.0 0.0 0.0 -1.0 0.0 0.0 -1.0 0.0 0.0 -1.0 0.0 ]
    AttributeEnd
AttributeEnd

Vector(10, 10, 10)(radius) is the size of the object, and we can kown it's a cube in this case; cancatTransform [...] contains the translation, rotation and scale information of the object.

Shape "trianglemesh"  "integer indices"[...]
"point P" [....]
"float uv" [...]
"normal N" [...]

This part is what we consider as the geometry information, and we save it as a sperate file, after that we write out a new geometry file in a way as below:

# define the material and geometry for the object
ObjectBegin "cube"
NamedMaterial "cube_material"
Include "scene/PBRT/pbrt-geometry/cube.pbrt"
ObjectEnd
# Apply the transformation to an objectInstacne
AttributeBegin
Translate 23.2946776584 0.0 191.803232641 
Rotate 0.000000 1.000000 0.000000 0.000000
Rotate 0.000000 0.000000 1.000000 0.000000
Rotate 0.000000 0.000000 0.000000 1.000000
ObjectInstance "cube"
AttributeEnd

Thus, at the end, we will have a much much smaller geometry file, it will be less painful to look into the file when we have hundreds of 3d objects in the scene. In ISET3d, piRead calls piGeometryRead, and piGeometryRead generates a scene folder and a textures folder, an extra json file saves the current recipe which is helpful for me when I don't want to wait for a very large 3d object to load again and again.