• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
openglinator

Font with outline not rendered correctly

8 posts in this topic

Hello,

 

I use a .fnt font created with 1.13 and 1.14 beta versions of BMFont and rendered in jMonkeyEngine.

With both versions I get a visual error when I use outlines and I don't know if this problem is on the Font side or on the jEngine side.

Here you can see the erroneous spacings (see yellow subtitle text and also the h=105.0 text in the upper white text):

https://docs.google.com/file/d/0ByWKJMpxOBKFMkl4blNVcVgtZlk/edit?pli=1

 

The font that I used is the one you can find here:

https://docs.google.com/file/d/0ByWKJMpxOBKFLWc2RWxsOG5iSTg/edit?pli=1

 

So I tried using the old "bitmapfonts.exe" from this site: http://www.angelcode.com/dev/bmfonts/

I ran the programm on my old Direct-X-9-Machine and it crashed even before starting. The log.txt holds this information:

acgfx_graphics.|  273|Adapter description: ATI Radeon HD 4800 Series           
acgfx_graphics.|  274|Driver: ati2dvag.dll
acgfx_graphics.|  275|Version: 6.14.10.7200
acgfx_graphics.|  287|Checking graphics capabilities...
acgfx_graphics.|  290|Blending with source alpha              : Yes
acgfx_graphics.|  291|Blending with inverse source alpha      : Yes
acgfx_graphics.|  292|Textures with alpha channel             : Yes
acgfx_graphics.|  295|Max texture width                       : 8192
acgfx_graphics.|  296|Max texture height                      : 8192
acgfx_graphics.|  303|Dynamic textures                        : Yes
acgfx_graphics.|  306|Vertex shader version                   : 300
acgfx_graphics.|  307|Pixel shader version                    : 300
acgfx_graphics.|  310|Number of simultaneous RTs              : 4
acgfx_graphics.|  341|Available render target format: A16B16G16R16
acgfx_graphics.|  341|Available render target format: A2R10G10B10
acgfx_graphics.|  341|Available render target format: A2B10G10R10
acgfx_graphics.|  341|Available render target format: A8R8G8B8
acgfx_graphics.|  341|Available render target format: X8R8G8B8
acgfx_graphics.|  341|Available render target format: X8B8G8R8
acgfx_graphics.|  341|Available render target format: G16R16
acgfx_graphics.|  341|Available render target format: R32F
acgfx_graphics.|  341|Available render target format: G32R32F
acgfx_graphics.|  341|Available render target format: A32B32G32R32F
acgfx_graphics.|  341|Available render target format: R16F
acgfx_graphics.|  341|Available render target format: G16R16F
acgfx_graphics.|  341|Available render target format: A16B16G16R16F
acgfx_graphics.|  341|Available render target format: L16
acgfx_font.cpp |  933|Unrecognized format for 'data/comic24.fnt'
application.cpp|   42|Failed to initialize font 'data/comic24.fnt' (-1)
acframe_applica|  160|Application specific init failed (-1)

So I removed the comic24.fnt font that comes with the test-programm and then it crashed every time after the line with "format: L16".

 

Can anyone please help?

My next try would be to edit the .fnt text file and add a +6 to each glyph's width (3 pixels of outline) in the hope that this will fix the problem.

If anyone could confirm that the problem is not on my game engine's side but in the created .fnt files, this would help alot - maybe even other users of the angelcode bitmap font generator.

0

Share this post


Link to post
Share on other sites

Hi Ogli,

 

The spacing between characters shouldn't change when adding outline to the characters. Though if your engine is not prepared to render text with outline you'll get the overlap of characters that you're having. To properly render text with outline the engine has to use 2 passes. In the first pass the engine should render just the outline, and in the second pass the engine should render only the glyph. This will make sure the outline stays behind the characters and don't overlap them.

 

If you can't change the engine to render the font in two passes, then you can manipulate the .fnt file to add a little to the xadvance for each glyph to separate the characters a bit more. (do not change the width).

 

 

It's difficult to say from this image only but it does indeed look like the jMonkeyEngine rendering the characters with more overlap that it should. I suspect it is updating the cursor position for each character drawn incorrectly. Most likely it is adding the xoffset to the cursor position but it shouldn't. Only the xadvance variable should be used to update the cursor position (+ possible extra spacing due to kerning pairs).

 

 

 

Thanks for letting me know about the problem with 'bitmapfonts.exe'. It's been ages since I updated that sample. I'll need to revisit it to update it to support the current file format. Perhaps I'll even find the time to implement a proper 2 pass rendering of fonts with outline.

0

Share this post


Link to post
Share on other sites

Understood what you wrote and made a workaround for my game:

 

I created two .fnt fonts - one with outline (font1) and one without outline (font2).

Then, I created two text objects, first text with font1 and second text with font2.

The color of the first text set to black, attach it to the gui graphics of the game.

The color of the second text set to yellow, attach it to the gui graphics of the game.

 

So, I simulated the "two passes" with overwrites of two different fonts.

 

Here is an image (see the yellow subtitles):

https://drive.google.com/file/d/0ByWKJMpxOBKFS2lEeDdOYndDWXM/edit?pli=1

0

Share this post


Link to post
Share on other sites

It looks good :)

 

It also proves that there is no error in the logic for the updating the cursor position in the jMonkeyEngine (since both with and without the outline the characters are aligned the same way).

 

 

Perhaps you could let the author of jMonkeyEngine know about the need for the 2 pass rendering of text with outline, so you can avoid the need for the work around. :)

0

Share this post


Link to post
Share on other sites

Okay, I will write a forum post there tomorrow, which will link to this forum post here.

 

Honestly, I don't know if the original author for .fnt integration is still active in the community. I would fix this myself, if I had the time to work my way through his code.

 

There are still some visual artifacts when resizing the font, because for whitespace characters his renderer creates a zero-sized quad which then has an outline. Looks very odd when I scale the font up and down, but looks okay for 100% scaling. It might even be, that this particular error is on the .fnt side this time.

 

I have, however, created my own AngelCodeBMFont class which represents a copy of a .fnt file and can be (de)serialized. This class will be able to merge a current font with another font. For example, my current font doesn't support Arabic, but Chinese+Japanese - so I must mix it with another font. You may remember, that I suggested this once. :)

0

Share this post


Link to post
Share on other sites

Yes, I do remember this suggestion, and it is on my to-do list so it won't be forgotten. Unfortunately I do not spend a lot of time with BMFont at the moment, as most of the time goes to AngelScript instead. It is unlikely I'll spend time to implement any complex new feature for BMFont soon.

 

However, BMFont is now open source (since April, this year), so you could implement this support in the tool yourself if you wish. If you, I'd very much like to see how you do it and perhaps merge the changes into the official version. :)

0

Share this post


Link to post
Share on other sites

Well, first: This is great news! Basic technologies should be open and I do also write open source software. My current game will be open for example.

 

I'm now almost done with my Java implementation of the .fnt merge tool, but I don't know if this can be ported to C++ quickly and easily.

 

I don't know anything about AngelScript. I know Lua and a little bit of Groovy and Python. Is there a Java-port of AngelScript?

0

Share this post


Link to post
Share on other sites

I don't know of any ports of AngelScript to Java. I'm targetting especifically C++ developers who wish to embed a scripting engine in their application. 

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0