Print3D custom font colors

This topic contains 3 replies, has 3 voices, and was last updated by  kevin 1 year, 11 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #51532

    Gary
    Member

    Hi,

    I’ve used this blogpost:
    https://www.imgtec.com/blog/powervr-developers/customizing-the-print3d-function-in-the-pvrtools-package

    to make some custom fonts to work with Print3D. The fonts load and display just fine, but every single one I’ve tried will only show up as black, no matter what color I pass into the Print3D function.

    The default and custom fonts that shipped with the SDK can change their colors correctly. However, they do have several characters that won’t display. I’ve attached a screenshot that shows the arial_36.pvr font included in the SDK doing print3d for all the letters and numbers. It’s the one with green text. I also attached another screenshot from the Print3D example, when I just added in all the regular english letters and numbers into the text file that it is displaying.

    The other screenshot (with black text when it’s been told to render green) I’ve attached is using the exact same code to render everything, the only difference being the font texture file that print3d loads. It was a font I made using the blogpost linked above. I’ve tried dozens of different textures and slight changes to export options in PVRTexTool, but all the fonts I make only ever show up in black. I am using the latest PVRTexTool 4.1.6.

    Anybody know what I might be doing wrong? Could it be that all the true type font files I’ve been using are somehow bad? I can attach them, and the generated pvr files if it would help.

    Thanks

    Attachments:
    You must be logged in to view attached files.
    #51575

    Joe Davis
    Member

    Hi Gary,

    Have you compared the headers in the two PVR files to determine the differences? Can you attach your PVR files so we can take a look at them?
    If you would prefer to share the files with us confidentially, you can attach them to a support ticket: https://pvrsupport.imgtec.com

    Joe

    #51601

    Gary
    Member

    Hi Joe,

    I’ve compared headers, but as far as I can tell, everything seems right. I don’t know exactly what I should be looking for though. I’ve attached a zip of a few PVR font textures that I’ve made, along with the .ttf files.

    Right now, I’m thinking that the problem is that when I export/save the PVR, the resulting texture has the font in a black color. The only textures that I can get to actually change color show up as white when I load them into PVRTexTool, like the arial_36.pvr that ships with the SDK. But every font PVR I export always shows up as black when I open it with PVRTexTool.

    I noticed that the frag shader that gets used multiplies the rgb I’m trying to set by the r value from the texture, which is zero when black, so that’s why I’m seeing only black. As a test, I changed that frag shader to just use the color I set, without the multiplying by the texture’s r value, and the font is now showing up exactly how I want it. I suppose that could be a solution to my problem, but I’d rather not modify that shader if I can get PVRTexTool to export a PVR that has the font in white.

    Thanks for the help! And thanks for the SDK, it’s pretty sweet!

    Attachments:
    You must be logged in to view attached files.
    #51702

    kevin
    Member

    Hi Gary,
    The reason why you could only get the black font was in your *.pvr file is because the default compress setting is A8. You need change it to another format which contain RGB channel (e.g. PVRTC 4bpp RGBA), then you can get the pvr font file you want 😀
    For example:
    step 1:
    [File]->[Create Font texture]
    import a *.ttf file
    [OK]
    step 2:
    [Edit]->[Encode]
    choose:
    PVRTC 4bpp RGBA
    [Encode]
    step 3:
    [File]->[Save]
    Done!!
    The attachment is the result for your Pacifico.ttf with above steps.

    Thanks,
    Kevin

    Attachments:
    You must be logged in to view attached files.
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic.