Text Decals for Signs etc.: Difference between revisions

From The DarkMod Wiki
Jump to navigationJump to search
Line 40: Line 40:
** Use textures/common/entityGui instead if it doesn't matter if the decal is solid.
** Use textures/common/entityGui instead if it doesn't matter if the decal is solid.
** Create the custom texture listed below at [[#Custom Texture]]
** Create the custom texture listed below at [[#Custom Texture]]
* In Surface Inspector, use these in order: natural, fit, flip horizontal, rotate left.
* In Surface Inspector, use these in order: natural, fit, flip horizontal, rotate left 180 degrees.
* You should now see a single occurrence of the words Entity GUI on the patch and the words should be upright and not mirrored. If not, adjust, rotate, until they do.
* You should now see a single occurrence of the words Entity GUI on the patch and the words should be upright and not mirrored. If not, adjust, rotate, until they do.
* Note that the text size will be affected by the size of the patch
* Note that the text size will be affected by the size of the patch
Line 46: Line 46:
* Give it the spawnarg gui with the path and name of your gui (see [[#The Gui]] below as its value.
* Give it the spawnarg gui with the path and name of your gui (see [[#The Gui]] below as its value.
* Give it the spawnarg gui_parm1 with your own text as its value.
* Give it the spawnarg gui_parm1 with your own text as its value.


===The Gui===
===The Gui===

Revision as of 15:29, 21 February 2011

Introduction

This article describes how to add non-graphic simple text to signs, signposts, walls etc. using gui decals. In this image you can see some examples. This method only provides the application of the text itself (ie, does not include the signs, signposts etc.)

Text decals.jpg



The assets used are provided from Dark Mod update 1.03 onward. But that is just a convenience; you can create your own easily (see #Customising and Making your own below.)

For other types of in-game text see Text


Ready-made Prefabs

This is by far the easiest method. You simply insert a prefab and change the default text and size to what you want:

  • This is described for the Dark Radiant editor.
  • For general use all you need do is to find or make your blank wall, sign, etc.
  • RMB in grid view and select insert prefab
  • Select eg, prefabs/readables/sign_text_decals/sign_text_carleton.pfb
  • The font choices are shown in Fonts Screenshots. Note that not all Dark Mod fonts are set up for this but see #Customising and Making your own below for how to do this.
  • You now have a working text decal.
  • To set your text change the spawnarg value gui_parm1 in Entity Inspector to whatever you want.
  • To change the size of the text;
  • just resize the patch. To do this, first press the TAB key. Remember to press it again to get back.
  • An alternative is to rescale the texture in Surface Inspector
  • It is important to note that by default the full surface may hold several lines of text so if your text is eg, just a street sign then it may only use the top line so you will need to drag resize the patch to cover a larger area than the visible sign. The decal patch is non-solid and invisible except for the text itself so can overlap any visible surface with no problem.
  • The defaults are all black text with 66% transparency so they blend well onto most surfaces but see #Customising and Making your own below for how to change this.

Customising and Making your own

To make your own text decals or customise the ones provided:


The Decal

  • Create a patch and give it the texture: textures/darkmod/decals/signs/decal_gui . This is only available fromDark Mod update 1.03 onward but if you want it earlier this is what to do:
    • Use textures/common/entityGui instead if it doesn't matter if the decal is solid.
    • Create the custom texture listed below at #Custom Texture
  • In Surface Inspector, use these in order: natural, fit, flip horizontal, rotate left 180 degrees.
  • You should now see a single occurrence of the words Entity GUI on the patch and the words should be upright and not mirrored. If not, adjust, rotate, until they do.
  • Note that the text size will be affected by the size of the patch
  • Convert the patch to a func_static entity
  • Give it the spawnarg gui with the path and name of your gui (see #The Gui below as its value.
  • Give it the spawnarg gui_parm1 with your own text as its value.

The Gui

This is the gui file that defines the font. If you have Dark Mod update 1.03 you can modify an existing one. Alternatively, just copy and paste the one below into a text file and save it with your map in a guis folder as eg, my_stone_text.gui. You will need to add that path and name to the gui spawnarg of the decal entity above, eg, gui guis/my_stone_text.gui


windowDef Desktop
{
	rect 0, 0, 640, 480
	backcolor 0, 0, 0, 0

	windowDef SignText
	{
		rect 0, 0, 640,480
		backcolor 0, 0, 0, 0
		text	"gui::gui_parm1"
		font "fonts/stone"
		textscale 2
		forecolor 0, 0, 0, 0.8
		visible 1
	}
}

In the above definition, these are some of the things you can change:

  • Set your font in the font line as shown. It must be in quotation marks as above. Font choices are shown in Fonts Screenshots.
  • Change the font size in textscale. Fractions can be used, eg, 1.5 but remember, resizing the patch or texture scale in Dark Radiant also changes the font size.
  • Change the colour and transparency of the text in the forecolor line. Because of the way Doom 3 blends imagery, for all practical purposes this is limited to very dark colours because they do not react to local game lighting. If you choose lighter colours then they will glow in the dark. (it might be possible to match a colour to a static light situation.) The forecolor values are:
    • red, green, blue, transparency; each in the range 0 to 1.
    • For colours, 0 to 1 is zero to full intensity; for transparency it is invisible (0) to fully opaque (1)
    • For example:
      • 0.9, 0.9, 0, 1 would be high red, high green, no blue, and fully opaque. Red and green light make yellow so this would give glowing yellow text that would not blend well with its background.
      • 0.1, 0, 0, 0.66 This is more practical and would give a dark red that blends well onto its background with 66% opacity.
  • A background colour can be set with the backcolor line exactly the same as for forecolor but is probably of limited use for our purposes. 0.9, 0.9, 0, 1 would have the text on a solid bright yellow background that glows in the dark. 0, 0.1,0, 0.33 would give a faint green background of 33% opacity.


The Texture

This is the non-solid decal gui texture. Copy and paste it into a text file and save it with your map in a materials folder as eg, mymap.mtr. You will need to reload shaders if you already have Dark Radiant running before you can select it.

textures/mymap/decals/signs/decal_gui
{
	qer_editorimage	textures/editor/entityGui.tga
	DECAL_MACRO
	noShadows
	nonsolid
	noimpact
	discrete
	guiSurf	entity
}