Encode pdfs into textures so that you can bring books with you in VRChat. Designed for VRChat avatars though should work for worlds or Unity projects in general.
You can find an example VRChat asset using this at https://finntherabbot.gumroad.com/l/readable-bible
- Certain types of fonts (no idea which ones though)
- Horizontal scaling
- Curve fill with self-intersection
- Line cap & join style (currently defaults to hard cap for a single straight line and round otherwise)
- Transparency
- Certain color spaces
- Install script dependencies
- Get
msdf-atlas-gen.exefrom https://github.com/Chlumsky/msdf-atlas-gen/releases and place it in this folder - Run script
- Get unity package from https://github.com/lambdalemon/pdf2vrcshader/releases
- Import textures
- Generate mesh
- Create pdf material and apply to mesh
We recommed Anaconda for python package management.
conda create -n pdf2vrc python=3.10
conda activate pdf2vrc
conda install pip
pip install -r requirements.txt
python pdf2vrc.py yourpdf.pdf
For more options
python pdf2vrc.py --help
If successful, two textures, one .png and one .exr will be generated and placed in the out directory.
If your pdf contains non-black text / vector graphics, an additional .png color texture will be generated.
If your pdf contains raster images, an additional .png image atlas texture will be generated.
The script will also print out any necessary info not included in the textures.
Use the following settings when importing textures
NOTE: Format should be RGBA Half instead when using Half Precision mode.
Add a PdfPageMeshCreator component to an empty game object. After choosing appropriate parameters, hit "Create Mesh". This creates a Mesh Renderer if there is one sheet of paper, or a Skinned Mesh Renderer otherwise, with one bone for each sheet of paper. Remove the PdfPageMeshCreator component before uploading to VRChat.
Explanations of some of the parameters:
numTrianglesshould be greater or equal to the script output, and equal to the shader property (i.e. if you have multiple pdfs of the same height and width you can reuse the mesh as long asnumTrianglesis big enough)startPageandendPagedoes NOT refer to the start / end page number of the pdf. These only refer to the page numbers that are simultaneously visible. An additional page number offset can be applied using shader properties.startOnBacksideis only relevant whendoubleSidedis chosen.
e.g. forstartPage = 0, endPage = 3,
w/ostartOnBackside, the generated skinned mesh has 2 bones:
front 0 back 1
front 2 back 3
w/startOnBackside, the generated skinned mesh has 3 bones:
back 0
front 1 back 2
front 3
The shader only supports unlit / minimal diffuse (one directional light only).
If all contents of your pdf are black, use the unlit option. (Note that this does not include all black and white pdfs since they might contain white text / images)
Otherwise, you probably want to match the shading of the background material. If you want to use a background material other than unlit / minimal diffuse, you might want to modify the shader yourself.


