How to do pixel font dropshadows with TextMesh Pro?

I want a 1px dropshadow under my text with TMP. I’m wondering if there’s some built-in “correct” way to approach this. I can’t use SDF fonts because (at least in my experience) they don’t work correctly with pixel fonts. I imagine the best approach is to create a custom atlas image, but extracting and modifying the generated atlas is a pain, and the quads it generates aren’t big enough for the shadow to fit (at least not by default). Another approach would be a custom shader, but that won’t work correctly either because of the aforementioned quads-too-small issue.

This is not currently possible but functionality that we are planning on adding to the TMP shaders where it will be possible to choose between relative mode and pixel mode for those values.

1 Like

Is there any easy/recommended way to replace a TMP atlas with a custom one? (ex. one where I’ve manually added the shadows in Photoshop). Ideally I’d like to generate the TMP atlas so that the quads have enough room for the shadows too.

For the curious, I was able to come up with a solution. I created a font atlas with 2px padding, exported the atlas (click the settings gear in the top right corner of the font data) and put a shadow on it in photoshop. Then I assigned that texture to the debug part of of the material, and set the material’s padding to 2.

Later, I also came up with an alternative solution involving creating a custom font shader that I can use to put a dropshadow on any font, which has a small impact on performance, but requires less work per-font.

How did you import the atlas back? I did the same but the shadows just simply take the color of the text and does not retain its original color when I edited it which is black. So it turns out looking like this:

7378550--900116--upload_2021-8-1_11-46-9.png