-
Notifications
You must be signed in to change notification settings - Fork 490
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle UTF encoded scene description files #136
Comments
I think the problem maybe is the default encoding text files from your OS. Here, under Windows, the --upgrade parameter generated a right file format and is rendered Ok. ..\pbrt4bounty\bin>pbrt --upgrade pbrt3.pbrt >my_pbrt4.pbrt
..\pbrt4bounty\bin>pbrt my_pbrt4.pbrt
pbrt version 4 (built May 29 2021 at 21:28:28)
Copyright (c)1998-2021 Matt Pharr, Wenzel Jakob, and Greg Humphreys.
The source code to pbrt (but *not* the book contents) is covered by the Apache 2.0 License.
See the file LICENSE.txt for the conditions of the license.
Rendering: [+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++] (50.9s) What do you think @mmp ?? |
Thanks for checking this out. Looks like PBRT-v4 cannot deal with UTF-16LE encoding formats (and maybe that's ok!). Windows' Powershell creates UTF-16LE files by default while cmd shell uses the legacy encoding windows-1252 / UTF-8 by default. This means, that if I use the Powershell, I face the issue above. If I use "cmd", then everything is fine. Cheers! |
Nice detective work @pbrt4bounty! I've just pushed a small fix that at least issues a sensible error message if a UTF-16-encoded file is detected. I've dug into this a bit and my thinking is that now that it's 2021, pbrt should stop assuming ASCII and should at least support UTF-8-encoded scene description files. That will take a bit of re-plumbing; |
Beyond the convenience of having them as a vector of strings, this is where UTF16 -> UTF8 conversion of args happens on Windows. This led to some adjustments to ParseArg()... With this (and a number of preceeding commits), #136 should now be fixed.
Upon further education about Unicode, turns out that In any case, as far as I can tell, pbrt now properly handles(*) UTF8, both in *.pbrt files as well as in command line arguments. So things like (*) The two remaining exceptions are that 1) UTF8 filenames for PNGs don't work, but there is a lodepng PR that would make it possible to address that. There is also an issue in the ext/filesystem dependency that can cause trouble on Windows under some circumstances, also hopefully fixed soon. |
Beyond the convenience of having them as a vector of strings, this is where UTF16 -> UTF8 conversion of args happens on Windows. This led to some adjustments to ParseArg()... With this (and a number of preceeding commits), mmp#136 should now be fixed.
Automatically adjust to changing monitor scale
Hi,
I have an odd (systematic nevertheless) problem after converting pbrt-v3 to pbrt-v4 files.
First of all, I have used the following command for conversion:
$ pbrt --upgrade old.pbrt > new.pbrt
Then, if I try to use "new.pbrt" as the input argument to "pbrt",
$ pbrt new.pbrt
, I obtain the following errors:End of files before "WorldBegin"
Apparently, the pointer to the input file is not working as it should for some unknown reason, returning "end-of-file" when there is error-free data to read inside the input file.
However, if I copy the data manually from "new.pbrt" to another new empty file (for example "new_v2.pbrt"), pbrt works just fine using
$ pbrt new_v2.pbrt
-> My guess is that there is some issue while creating and converting a pbrt-v3 file to a pbrt-v4 file.
Test case scenario:
Create a "pbrt-v3" input file (named "Scene_pbrt3.pbrt" in the attachment) with the default scene described in https://www.pbrt.org/fileformat-v3 under Example of a pbrt file
Convert the "pbrt-v3" file to a "pbrt-v4" file (named "Scene_pbrt4.pbrt" in the attachment) using
$ pbrt --upgrade Scene_pbrt3.pbrt > Scene_pbrt4.pbrt
Create a new empty file called "Scene_pbrt4_2.pbrt" (attached) and copy manually the content from "Scene_pbrt4.pbrt" to "Scene_pbrt4_2.pbrt".
-> From the test case scenario above,
$ pbrt Scene_pbrt4.pbrt
fails and$ pbrt Scene_pbrt4_2.pbrt
works fine.I'm running PBRT-v4 with GPU support on Windows 10, RTX 2080 Super Mobile, Cuda Toolkit 11.2.0, Optix SDF 7.3.0.
TestCaseScenario.zip
The text was updated successfully, but these errors were encountered: