RenderToolbox / RenderToolbox3

Matlab toolbox for managing graphics rendering for psychophysics
Other
5 stars 2 forks source link

Changes that let us run RTB3 with a PBRT docker container. #46

Closed tlian7 closed 7 years ago

tlian7 commented 8 years ago

@benjamin-heasly I think this is one of two ways we can potentially incorporate the PBRT docker container that Brian and I use into RTB3. Just to remind you since it's been a while, but this docker container allows users to render with PBRT without having to build it locally at all.

The first way is more straightforward, and I've included it in this pull request. Essentially there is a new function called SetupPBRTDocker which one can call in the scene script. It generates the command needed to run the docker container and then replaces the PBRT executable with this new command, so that nothing needs to be changed in the RunPBRT.m file or anywhere else.

The main drawback to this method is that in order to switch back to local PBRT one would have to rerun the configuration script to change the PBRT executable back to the local path.

The second way which I've also implemented (but did not generate a pull request for) is to make changes in the configuration file. This is more inline with what you suggested to me last year but is more messy and complicated.

The main problem with this method is that in order to generate the docker command, we need to know the working folder of the scene. To make things even more complicated, the docker command has slightly convoluted syntax that is hard to work around. For reference, it looks something like this: docker run -t -i --rm -v [scene workingFolder]:[scene workingFolder] vistalab/pbrt pbrt --outfile [outfile] [input PBRT file]

We could potentially keep things in the configuration file, but we would have to break things up. We would have to first change the PBRT executable to be vistalab/pbrt pbrt and pull the docker container in the configuration file. Then in the user's scene file, they would have to specify the front piece of the docker command: docker run -t -i --rm -v [scene workingFolder]:[scene workingFolder] (we could potentially write a simple function that does this for them). Then in RunPBRT it would include this docker command before the PBRT executable.

The main advantage of doing it this way would be the choice of whether to use docker or not is kept in the configuration file. The downside is that it introduces several new things including this extra piece to the render command that has to be specified in the scene file if the user ran the configuration file with docker PBRT. To switch back to local PBRT, the user would still have to rerun the configuration file since the PBRT executable has to be changed.

Let me know which way you think would be better for RTB. Thanks so much.

benjamin-heasly commented 7 years ago

Hi Trisha,

Thanks a lot for this. I'm sorry I left it hanging all summer.

I'm finishing documentation for RenderToolbox4 which supports Docker explicitly.

It works much like your second suggestion. Each renderer configuration has a field specifically for a Docker image name. If Docker and the image are found, the rendering code will generate a Docker command that includes the folders to mount in the container.

So I would like to close this PR and consider it "conceptually merged". OK with you?

tlian7 commented 7 years ago

Sounds good, looking forward to hearing more about RenderToolbox4 later today!