Psuedo-documentation: Watermark example
Posted: Mon Sep 29, 2003 12:50 pm
Note: phpbb's search highlighting will break part of this post. If you found this post as a search result, try viewing this thread directly.
Since so many people seem to be having difficulties creating watermarks, I'm providing mine as an example.
While the creation of the image itself is fairly obvious, I would like to make some comments on image size. As stated in the documentation, image dimensions must be a power of two; along this line, an image size of 128x128 is a good guide to ensure the image quality is acceptable at all resolutions. In Quake 3, RtCW, and ET, elements on the HUD are drawn at a virtual resolution of 640x480, regardless of your actual screen resolution; however, extra detail in the textures used will be shown if the screen resolution is high enough to support it. When the image is resized to 48x48 for the HUD, a 128x128 image will be scaled DOWN to fit this space until the user's resolution exceeds 1706x1280, so 128x128 will probably be ample to ensure your texture isn't stretched to fit. A little smaller or larger won't necessarily hurt, however--the primary concern you should keep in mind is download size.
The image itself may be a JPEG or TGA, although a TGA is recommended since JPEG has no support for alpha channels, and therefore cannot contain transparency. ET will always assume that the TGA begins in the lower-left corner, so you will need to be certain that you set whatever program you create the watermark with to save the image this way.
<table align="center"><tr><th align="center">Example .TGA</th></tr><tr><td><img src="http://themuffin.net/etpro/watermark-guide/bc.png" alt="Example watermark" width="256" height="256" border="0"></td></tr><tr><td align="center">[download]</td></table>
Optionally, you can also create a shader script to be distributed with your watermark. Creating a shader script is not required, but it can very slightly lower load time and ensure that your watermark is not blurred by the r_picmip cvar. This example shader script should be usable as a template to make your own script (don't forget to change the filenames, displayed in bold!), if you decide to include a shader script. If you decide to make your own shader script, be certain that you include the 'alphaGen vertex' line in the definition, as it's required for watermark fading and the client's watermarkAlpha setting to work properly. Like all of the shader scripts, this file should go in scripts/.
<table align="center"><tr><th align="center">Example shader script</th></tr><tr><td nowrap="nowrap"><pre>// shader name<br>watermark/bluecherry/bc<br>{<br> nocompress<br> nomipmaps<br> nopicmip<br> {<br> // image filename<br> map watermark/bluecherry/bc.tga<br> blendFunc blend<br> rgbGen vertex<br> alphaGen vertex<br> }<br>}<br></td></tr><tr><td align="center">[download]</td></tr></table>
Next, you need to arrange everything into a pk3 so that the server can properly send it to clients. The correct directory structure must be present inside the pk3, although the required directories aren't much different from what you might normally expect (and should be familiar to anyone who has made a map for RtCW or ET.) The only special case is that the watermark images MUST exist in the watermark/ directory, because the server will prepend this before the specified watermark name. It is, however, recommended that you try to keep all the filenames as unique as possible--keep in mind that clients will need to download this pk3, and may have watermark pk3s from several other servers as well.
<table align="center"><tr><th align="center">Example PK3 contents</th></tr><tr><td nowrap="nowrap"><pre>Archive: watermark-bluecherry.pk3<br> Length Method Size Ratio Date Time CRC-32 Name<br>-------- ------ ------- ----- ---- ---- ------ ----<br> 0 Stored 0 0% 09-29-03 14:28 00000000 scripts/<br> 209 Defl:X 127 39% 09-29-03 14:34 b70745ed scripts/watermark-bluecherry.shader<br> 0 Stored 0 0% 09-29-03 14:23 00000000 watermark/<br> 0 Stored 0 0% 09-29-03 14:20 00000000 watermark/bluecherry/<br> 37593 Defl:X 15158 60% 09-29-03 15:58 046ab77c watermark/bluecherry/bc.tga<br>-------- ------- --- -------<br> 37802 15285 60% 5 files<br></pre></td></tr><tr><td align="center">[download]</td></tr></table>
Finally, put this in your etpro/ directory along with the other data files, and select your watermark in the server configuration. For the example watermark, this could be done with "set b_watermark bluecherry/bc" at the server console or in your server's configuration file. Clients will need to have this file in order to play on your server unless you have sv_pure set to 0, so you will want to make sure your server is configured to allow downloads, and don't forget to make your pk3 available at the redirect site if you use redirected downloads.
So, there's my novel. Any questions?
Since so many people seem to be having difficulties creating watermarks, I'm providing mine as an example.
While the creation of the image itself is fairly obvious, I would like to make some comments on image size. As stated in the documentation, image dimensions must be a power of two; along this line, an image size of 128x128 is a good guide to ensure the image quality is acceptable at all resolutions. In Quake 3, RtCW, and ET, elements on the HUD are drawn at a virtual resolution of 640x480, regardless of your actual screen resolution; however, extra detail in the textures used will be shown if the screen resolution is high enough to support it. When the image is resized to 48x48 for the HUD, a 128x128 image will be scaled DOWN to fit this space until the user's resolution exceeds 1706x1280, so 128x128 will probably be ample to ensure your texture isn't stretched to fit. A little smaller or larger won't necessarily hurt, however--the primary concern you should keep in mind is download size.
The image itself may be a JPEG or TGA, although a TGA is recommended since JPEG has no support for alpha channels, and therefore cannot contain transparency. ET will always assume that the TGA begins in the lower-left corner, so you will need to be certain that you set whatever program you create the watermark with to save the image this way.
<table align="center"><tr><th align="center">Example .TGA</th></tr><tr><td><img src="http://themuffin.net/etpro/watermark-guide/bc.png" alt="Example watermark" width="256" height="256" border="0"></td></tr><tr><td align="center">[download]</td></table>
Optionally, you can also create a shader script to be distributed with your watermark. Creating a shader script is not required, but it can very slightly lower load time and ensure that your watermark is not blurred by the r_picmip cvar. This example shader script should be usable as a template to make your own script (don't forget to change the filenames, displayed in bold!), if you decide to include a shader script. If you decide to make your own shader script, be certain that you include the 'alphaGen vertex' line in the definition, as it's required for watermark fading and the client's watermarkAlpha setting to work properly. Like all of the shader scripts, this file should go in scripts/.
<table align="center"><tr><th align="center">Example shader script</th></tr><tr><td nowrap="nowrap"><pre>// shader name<br>watermark/bluecherry/bc<br>{<br> nocompress<br> nomipmaps<br> nopicmip<br> {<br> // image filename<br> map watermark/bluecherry/bc.tga<br> blendFunc blend<br> rgbGen vertex<br> alphaGen vertex<br> }<br>}<br></td></tr><tr><td align="center">[download]</td></tr></table>
Next, you need to arrange everything into a pk3 so that the server can properly send it to clients. The correct directory structure must be present inside the pk3, although the required directories aren't much different from what you might normally expect (and should be familiar to anyone who has made a map for RtCW or ET.) The only special case is that the watermark images MUST exist in the watermark/ directory, because the server will prepend this before the specified watermark name. It is, however, recommended that you try to keep all the filenames as unique as possible--keep in mind that clients will need to download this pk3, and may have watermark pk3s from several other servers as well.
<table align="center"><tr><th align="center">Example PK3 contents</th></tr><tr><td nowrap="nowrap"><pre>Archive: watermark-bluecherry.pk3<br> Length Method Size Ratio Date Time CRC-32 Name<br>-------- ------ ------- ----- ---- ---- ------ ----<br> 0 Stored 0 0% 09-29-03 14:28 00000000 scripts/<br> 209 Defl:X 127 39% 09-29-03 14:34 b70745ed scripts/watermark-bluecherry.shader<br> 0 Stored 0 0% 09-29-03 14:23 00000000 watermark/<br> 0 Stored 0 0% 09-29-03 14:20 00000000 watermark/bluecherry/<br> 37593 Defl:X 15158 60% 09-29-03 15:58 046ab77c watermark/bluecherry/bc.tga<br>-------- ------- --- -------<br> 37802 15285 60% 5 files<br></pre></td></tr><tr><td align="center">[download]</td></tr></table>
Finally, put this in your etpro/ directory along with the other data files, and select your watermark in the server configuration. For the example watermark, this could be done with "set b_watermark bluecherry/bc" at the server console or in your server's configuration file. Clients will need to have this file in order to play on your server unless you have sv_pure set to 0, so you will want to make sure your server is configured to allow downloads, and don't forget to make your pk3 available at the redirect site if you use redirected downloads.
So, there's my novel. Any questions?