Fixes for geometry parsing, material handling, and centralized asset usage in ISET3D#5
Open
AyushJam wants to merge 19 commits intoISET:masterfrom
Open
Fixes for geometry parsing, material handling, and centralized asset usage in ISET3D#5AyushJam wants to merge 19 commits intoISET:masterfrom
AyushJam wants to merge 19 commits intoISET:masterfrom
Conversation
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi Brian and ISET Team,
Since the past few months, I've been using ISET3D and ISETCam for a camera simulation project. During this time, with help from you, I identified and fixed some problems in the recipe writing and rendering pipeline in
iset3d-tiny. I have described those problems, proposed fixes, and the setup below.Problems Addressed
PBRT files written out from an ISET recipe, when read back in with
piReadcreate a broken asset tree. I identified that this arises from three main reasons:parseGeometryText.m. As a result, when writing out withpiWrite, these transforms are missed. This fails rendering.parseBlockMaterial.mdue to double spaces in those strings.Why
isetautodatabase and scene recipes fromisethdrsensorto develop a simulation framework for camera motion and light control.My Setup
isetauto, I follow theiset3dconvention to save the scene PBRT iniset3d-tiny/data/scenes/. This dir contains the three necessary PBRTs (scene_geometry.pbrt, scene_materials.pbrt, scene.pbrt). Additionally, I save three symlinks (geometry, skymap, textures) pointing to the asset database (in my case,acorn/Resources).piWritewrite the recipe out into3d-tiny/localwhile copying the symlinks along with modified PBRTs.Changes
I've grouped the fixes into three, within each group they're in a reducing order of importance.
Geometry
parseGeometryText.m: The geometric transforms at the highest level are missed during line-by-line reading and never make it to the asset tree. I found a convenient solution by saving those transforms in the attributes of the tree rootrootAsset. Please note that if you compare the written out PBRT with the one read in, the former will have one extraAttributeBegin/Endblock for every object (one extra level). This is harmless for rendering, just from recipe handling.Material Handling
parseBlockMaterial.m: This fixes mix material handling by removing white-space-only tokens created by thestrsplitaround double spaces. Such double spaces occur in the PBRT line after "string materials". Once parsed right, mix materials are saved and rendered correctly.piParseObjectName.m:piReadreads each PBRT line one by one. If the line is a PBRT comment like#Meshname:"road_001_Camera_B" #Dimension:[ ]with no dimensions (as is often the case), a parameter in this fileresbecomes empty and the indexingres(1)throws an error. These comments don't affect rendering but break asset tree building. I've fixed it writing a robust object parser.piTextureCreate.m: By default it makestexture.invert.value = 'false'. This adds a"bool invert" [false]to every line in the materials pbrt. Rendering works fine even if I set it to empty[].Centralized Assets
escapeShellArg.mandisSymlink.m: To check if directory is a symbolic link to another location (asset database).piMaterialText.mandpiTextureFileFormat.m: Typicallyiset3drequires assets to be present in the recipe's output directory. When using symlinks, that is not the case, so I have turned the file existence checks in these modules off, assuming that the asset will certainly exist in the central resource. This is not a clean fix -- ideally, we might have the recipe class have an attribute to store the resource location and use it to check files. I didn't implement it since it changes the core recipe structure.piWrite.m: As described before, we copy the symlinks from the source to destination (local/). This directory will be used for rendering. I comment out blocks that copy whole assets from source directly.piRecipeDefault.m: It throws an error if the recipe is pre-downloaded. There is a different case for which this must have been written. Maybe this should be a warning instead.piTextureText.m: It saves the absolute path of assets in the PBRT written out. This path uses the output directory and conflicts with the actual resources. So I use relative paths compatible with symlinks.Further Improvements for Robustness
I hope these fixes improve recipe handling reproducibility.
Happy to discuss further and iterate with maintainers.
Thanks,
Ayush