README.txt 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. Conversion notes:
  2. Frames were exported from Cinema4D using the pbrt exporter. (It's important
  3. to change the logging level in the export dialog to "Error", since
  4. otherwise many messages are generated and it seems that c4d has some sort
  5. of O(n^2) thing going on there, since exports slow to a crawl.
  6. Geometry fiels were then converted to use PLY meshes using "pbrt
  7. --toply". There are many repeated meshes (both shared across multiple
  8. frames but also identical meshes within a single frame. These were boiled
  9. down to unique messages using the following go program, which prints a
  10. script for "sed" to stdout.
  11. package main
  12. import (
  13. "crypto/sha256"
  14. "encoding/hex"
  15. "fmt"
  16. "io/ioutil"
  17. "os"
  18. )
  19. func main() {
  20. for _, fn := range os.Args[1:] {
  21. contents, err := ioutil.ReadFile(fn)
  22. if err != nil {
  23. fmt.Fprintf(os.Stderr, "%s: %v", fn, err)
  24. continue
  25. }
  26. sum := sha256.Sum256(contents)
  27. str := hex.EncodeToString(sum[:]) + ".ply"
  28. fmt.Printf("s/%s/%s/g\n", fn, str)
  29. err = os.Rename(fn, str)
  30. if err != nil {
  31. fmt.Fprintf(os.Stderr, "%s: %v", fn, err)
  32. }
  33. }
  34. }
  35. The pbrt geometry file that --toply emitted was then updated to use the
  36. hashed file names generated by the go program:
  37. % sed -f out.sed < ply-geometry.pbrt > g.pbrt
  38. Note that the sed script has thousands of lines and sed seems to be quite
  39. slow--it takes many minutes to run the sed script, even though the geometry
  40. file is only around 4.5MB.
  41. To add all of the light sources, use the lights.sed script:
  42. % sed -f lights.sed < g.pbrt > g-lights.pbrt
  43. Finally, rename g-lights.pbrt to something sensible and update the Include
  44. in the main pbrt file for the frame to use it. More generally, replace
  45. everything after the Film directive in the generated pbrt file up to the
  46. geometry Include with the text from one of the other frame files.
  47. Whew