GenSurf
Quake2 map surface generator

1.7 10/03/99
- Added support for hint brushes in Half-Life maps. This feature FINALLY makes
  GenSurf surfaces useful in Half-Life (previous versions... in a word... sucked).
  To make use of this feature you will need Sean 'Zoner' Cavanaugh's compiling
  tools. You can get them from http://halflife.gamedesign.net/resources/zhlt.shtml.
  The addition of hint brushes to GenSurf surfaces in Half-Life does all sorts of
  good things:
     Most importantly it prevents excessive brush fragmentation, and 
     so knocks r_speeds WAY down. 
     It eliminates (from limited tests I've run) "leaf portal saw into leaf"
     errors and the associate hall-of-mirrors effects you get in the game.
     It apparently fixes a few lighting errors, though I'm not sure why. This
     was a pleasant surprise/additional bonus.

  Many thanks to Sean for providing these tools. Woohoo!

- Added support (sort of) for Genesis3D. Users seem to like this feature, however 
  I've never been able to get good results. Since the Genesis3D engine is quite 
  a bit different than the standard q2 engine games and because there are a limited
  number of hours in the day (24 last time I checked), I won't be offering much 
  support for this feature. If you have questions feel free to ask, but I may not 
  be able to provide much help.

1.6 5/31/99
- Added support for Heretic 2. Thanks to trix/dhazel for his assistance.
  NOTE to Heretic 2 users: H2 uses surface flags to determine the sound of 
  footsteps. There are default surface flags for gravel, wood, stone, and metal 
  textures that are contained in the texture files. GenSurf will correctly
  retrieve those surface flags if either 1) you choose textures from a pak file,
  or 2) you generate map files in the /MAPS folder below the game directory.
  In the latter case GenSurf backs up one level from the /MAPS folder and looks
  for the texture in or below the /TEXTURES folder.
  If you don't have "use pak file" checked AND the map is written to a folder
  OTHER than gamedir/maps, GenSurf will not find the texture and retrieve the 
  correct surface flags. This can easily be corrected in an editor.

1.5 5/11/99
- Added support for SiN. NOTE: To make use of GenSurf's detail hint brushes,
  you'll need to extract the updated qbsp3.exe and replace your existing copy.
  The text file for qbsp3 contains a list of all changes made to that code.

- Sped up the decimation routine quite a bit, and found a hint brush scheme 
  that reduces poly counts but doesn't produce visual glitches for decimated 
  grids.

- Removed qbsp3 from the distribution. Since Geoffrey DeWan's qbsp3 1.07 
  supports detail hint brushes, there's no longer any need for my own qbsp3.
  Download Geoffrey DeWan's qbsp3 1.07 from 
  http://users.net66.com/~gdewan/quake2.html

- Bullet-proofed some of the input values. For example, setting the horizontal 
  vertical extents to the same values (0 width) with the Preview window open
  in previous versions would cause a crash. Thanks to gimp for prodding me to
  fix this.

- Added the ability to decimate the surface grid by throwing out vertices which 
  do little to define the shape. For many surfaces, you can produce roughly the 
  same shape surface with a high decimation value (75-85%). This will generally 
  result in a map with lower polygon counts (and better in-game performance).

  I started out using the same QSLIM program used by mgs for performing 
  decimation, but there were several problems with it - primarily that it used 
  floating point values for all nodes. Although it was a trivial matter to 
  round those values to integers, this sometimes resulted in illegal brushes. 
  After searching the web for similar routines, I settled on doing it my damn 
  self :-). The routine used by GenSurf is simple and fast-running, and though 
  it isn't as sophisticated as other available methods, it produces pretty fair 
  results (if I do say so myself). I'll document this procedure on the GenSurf 
  web page after you find all the bugs for me :-).

  Because the decimation routine typically takes several seconds to run, the 
  decimation value is not saved from one session to the next as other parameters 
  are - instead it is always 0 initially. If this wasn't done and the decimation 
  value was preserved from one run to the next, GenSurf might seem to be dead in 
  the water when first started.

  NOTE for Quake2 and KingPin users: If you have selected "detail hint brushes" 
  on the Texture tab (and you should for better r_speeds), it is possible that 
  those hint brushes will cause strange visual errors in the game if you've used 
  a non-zero decimate value. Specifically, you may encounter brushes that seem 
  to be infinitely tall that the player can walk through. In this release of 
  GenSurf, no hint brushes will touch other hint brushes if a non-zero decimate 
  value is selected. In all tests that have been performed to date, this scheme 
  seems to prevent visual errors from occurring while still providing some of 
  the benefits of using those brushes. If this problem does occur for you, please 
  forward the map to me. These errors do not occur if no decimation is performed, 
  because the hint brushes are aligned in a rectangular grid.

- Added ceiling orientation. Thanks to Pat for the suggestion.

- Added support for Kingpin. Huh? Kingpin hasn't been released yet! Yeah, I 
  know. Call me anxious. Aside from there currently not being any rad programs 
  that support Targa files, surfaces generated by GenSurf are ready to go. The 
  only "maybe" that I'm not sure about is the size of the player's bounding box. 
  Currently GenSurf assumes the bounding box is the same size as the Q2 marine.

- Player start is now correctly game-dependent. In previous version it was 
  possible to generate a map with the player stuck in the surface for Half-Life.

- GenSurf now adds a ".map" extension to the output .map name if one isn't 
  specified, and complains if the extension is anything other than ".map".

- "Use detail brushes" is now disabled and forced on if "detail hint brushes" 
  is checked. When I first added the detail hint brush feature, I thought there 
  might be an obscure case where you'd want detail hint brushes but not detail 
  surfaces... but after mulling it over I can't think of a scenario where this 
  would be beneficial. This change should help avoid a little confusion. 

- Fixed a bug due to spin buttons causing the associated text box to use commas
  for thousands separator. Thanks to Robert Fegley for pointing out the error.

1.4.1 beta 3/31/99
- Argghhh. Several bug fixes associated with getting texture names from a pak 
  file in this morning's version. Yeah I'm a dunce. 

1.4 beta 3/31/99
Bug/Problem fixes:
- Fixed a stupid mistake: Previous version set the Phong ID on the back face on 
  north- and south-facing cliff walls, rather than the front face.
- Fixed a minor problem associated with fixed points and the random number 
  generator. Because fixed points are skipped over when calculating values for 
  the fractal method, simply selecting a point to fix would change the random 
  number sequence and generate a new surface, even though no input had been 
  changed. This version gets around this problem by generating a random number 
  for every point, though the number isn't used if a point has been fixed.
- Preview window is now sized to fit your desktop, including the task bar... 
  this is another of those "that ain't the way I work" problems - thanks to 
  Mad Dog for pointing out that although I "Auto-hide" my task bar, others may 
  have Windows set up "incorrectly" :-)
- This version is quite a bit more careful about the placement of the 
  Info_player_start. In previous versions it was possible to generate a map 
  with the player stuck in the surface. Thanks to Chris Brodie for pointing out 
  the error.
- GenSurf now does a better job of interpolating values from bitmaps. In 
  previous versions, vertices were mapped to the nearest pixel in the bitmap. 
  This was fine for large bitmaps, but produced obvious roundoff errors in small 
  bitmaps. The interpolation scheme now does a bilinear interpolation between 
  the 4 pixels that bound a vertex. Thanks to Owen Coughlan for pointing out 
  this problem.

New features:
- Added support for Half-Life, although, to be honest....ummm... it stinks. 
  Since HL has neither the detail content property nor hint brushes, there's 
  currently no way to use GenSurf's "detail hint brushes" to cut down on brush 
  fragmentation, so the r_speeds of an HL GenSurf surface will be much higher 
  than the same surface in Quake2. In addition, qbsp2 is prone to producing a 
  lot of leaf portal errors - the bad news here is that unlike the Q2 warning, 
  this one means business. In several test maps I've made that have leaf portal 
  warnings there have been several see-through brushes in HL. Both of these 
  problems may be solved with some modifications to the qbsp2 and/or qcsg source 
  code - I'm working on it.
- Not a new feature - just a note: adding HL support caused me to reorganize how 
  the settings files were written. If you've previously saved a settings file in 
  GenSurf, the texture information will be incorrect when you open it in this 
  version. Sorry for the inconvenience, but this won't be a problem again.
- Added support for scanning pak/wad files for textures (still no preview, 
  though.
- Roughness and fixed points features now work with bitmap images. NOTE: There's 
  a bit of a chicken-and-the-egg problem here. If you set several fixed points, 
  then select a bitmap image, those fixed points will still be in effect - not a 
  problem as long as you're aware of how things work. To release all fixed 
  points and mimic the bitmap exactly, set Roughness (on the General tab) to 0, 
  and click Free All on the Fixed Points tab.
- A range of vertices may be selected on the Fixed Points tab by pressing 
  Shift+Click, and you can toggle a selection with Ctrl+Click. This is pretty 
  handy for creating flat areas on your surface.
- Added "Ladder" checkbox on Texture tab. Play Spiderman in your map. Some of 
  you purists may have strong objections to this... ummm.... don't use it if you 
  don't like it. NOTE: This feature is not recommended for ground surfaces, 
  unless you like running through molasses. Suggested by Ryan Hanthorn.

1.3      3/20/99
So much for my plans to leave this alone!
- Now adds Phong shading ID for the surface plane only. Previous versions
  added this value for all planes - which was kinda stupid. Thanks to Mad Dog
  for straightening me out.
- Added a second texture input for faces other than the surface. (Owen Coughlan)
- Added a "rate of change" for fixed values. This is a pretty cool effect, I 
  think. See the GenSurf web page (www.magnolia.net/~rascal/gensurf/gensurf.htm)
  for an example. Another Mad Dog suggestion.
- Divided things up into tabbed dialogs, 'cause it was getting a bit too crowded.
  I can now add infinite input parameters, so keep the suggestions coming - that's
  a joke. :-)
- Fixed a stupid mistake with fractal surfaces with grid sizes that were not 
  powers of 2.

1.2      3/18/99
Bah! Bug fixes:
- A previous ummm... "optimization" prevented the "roughness" value from 
  working correctly in some circumstances. 
- "Free all" on the "Fix Points" dialog didn't... fixed points in the last 
  row or last column remained fixed. 

- Changed _sun_light value for skybox from 450 to 280 and _sun_ambient from 
  30 to 20... looks better to me. You're welcome to your wrong opinion :-) 

1.1      3/17/99
- Detail brushes are now given skip faces at either end, and are also made 
  the same length. This change won't affect the GenSurf-generated surface 
  at all, but should lessen the probability of splitting other brushes that 
  are added to the map. Thanks to compiler-guru Geoffrey DeWan for this 
  suggestion.

1.0      3/16/99
- Changed "add hint brushes" to "detail hint brushes". After much 
  hair-pulling and teeth-gnashing, I've given up on a general-purpose, 
  one-size-fits-all hint brush solution to improving visibility in these 
  maps. However, Alexander Malmberg's suggestion to use hint brushes with 
  the detail property is a very good (in my opinion) way to eliminate all 
  brush cuts in these surfaces, which will often provide better r_speeds 
  than any "normal" hint brush solution. For this method to be effective, 
  you will also need to check "Use detail brushes", which will use the 
  detail content property on the generated surface. The only trouble with 
  detail hint brushes is that qbsp3 automatically turns off the detail 
  property for hint brushes. I've changed the source code to allow these 
  brushes, though. This version of qbsp3 is now distributed with GenSurf. 
  If you plan to use the "detail hint brushes" feature of GenSurf, replace 
  your original copy of qbsp3 with the attached version. Please note that 
  detail hint brushes are not a cure-all for brush splits. They work very 
  well for terrain surfaces because 1) the terrain surface consists of 
  brushes placed in a very orderly rectangular array, and 2) the hint 
  brushes bound the surface brushes - there is no gap between the hint 
  brushes and the surface brushes.
- Added ability to read an 8-bit (256 color) bitmap, and interpret the 
  color indices as values for each vertex. The aspect ratio of the bitmap 
  is ignored - GenSurf maps the corners of the bitmap to the corners you've 
  specified in GenSurf's input. You supply a value for color 0 and a value 
  for color 255; all other values are linearly interpolated. Although this 
  feature will work with any 256 color bitmap, it generally makes more sense 
  to use gray scale images.
- Added "Save" and "Open" buttons to save/read GenSurf settings. This feature 
  might be useful if you are using many "fixed points"... the fixity and value 
  of these points are saved to the settings file, so you won't have to re-enter 
  them every time you want to produce the same surface.
- Added a visual representation of an info_player_start's bounding box to the 
  preview window. This should help give a sense of scale.
- Added a random number seed for the fractal form. This allows you to produce 
  an infinite (well... ok, very big) variety of surfaces with the same input, 
  while maintaining reproducible results.
- Fixed several nagging visual/interface problems, including 1) the "view angle" 
  window was left open when the preview window was closed. 2) the "range affected" 
  value for fixed points is not used for the fractal form, but this text box was 
  enabled, which was misleading. 3) "Fix Points" didn't allow you to alter points 
  along the border of your surface if "Linear Border" was selected, even if a 
  waveform for which "Linear Border" isn't in effect was used.

0.5      3/11/99
- Added "Fractal" waveform. Thanks to Bakersman (kindred Rust visitor) 
  for this suggestion. This option is very good at creating rough outdoor
  areas. Used in conjunction with "Fix Points" you can come up with a 
  pretty nifty outdoor surface. The old "roughness" value is still used 
  with the other waveforms.
- Another Bakersman suggestion: the orientation of the triangles used 
  for the surface is alternated. The previous version (with triangles 
  all having the same orientation) was prone to producing artificial 
  ridges and valleys where you didn't necessarily intend. This version 
  is, um..., half as likely to produce that sort of thing. 
- Added ability to spin the preview around the 3 coordinate axes. This 
  didn't turn out quite like I had hoped - the method used has the effect 
  of spinning the surface while keeping the viewpoint fixed. A more intuitive 
  (and easier to operate) method would be to fix the surface in place and 
  move the viewpoint... maybe next time.
- Added "Browse" button for textures. Thanks to Owen Coughlan for shaming 
  me into providing this feature :-)

0.4.1    3/10/99
- Minor changes to "Fix Points"

0.4.0    3/10/99
- Added "Fix Points" feature that allows you to specify the amplitude 
  for one or more selected vertices, along with a range from the 
  selected vertex that other vertices are effected. This works 
  better than I had hoped - suggestions are welcome.
- Added "add hint brushes" feature. This feature requires a bit of 
  explanation: GenSurf currently doesn't strain itself figuring out 
  good hint brush placement. It stacks 64 unit tall hint brushes 
  with the same footprint as a grid square at each grid square location.
  IF your surface undulates so much that portions of the surface aren't 
  visible from other parts of the surface, the use of this option will 
  almost certainly result in improved in-game performance. However, that 
  improvement SOMETIMES comes at a cost - increased vis time. I'm 
  continuing to work on this. Hopefully I'll be able to come up with 
  a scheme that improves r_speeds significantly without a substantial 
  increase in vis time.
- Improved graphics - preview window is updated without the annoying 
  screen-flashing.

0.3.0
- Added ArghRad 2 "value" field for Phong shading.
- Added texture scale and offset fields.

Known problems:
- Qoole 2.5 is known to foul up GenSurf-created maps and produce orphan 
  planes in the game that the player can walk through. Qoole 99 does not 
  have this problem. You can get around Qoole 2.5's butchery by using the 
  -noopt command line option with qbsp3. Thanks to Geoffrey DeWan for this 
  tip, and to Rust-regulars Beelzabub and Owen Coughlan for pointing out 
  the problem.

- GenSurf maps often produce "leaf portal saw into leaf" warnings, even 
  when using Geoffrey DeWan's qbsp3 (which eliminates many of these 
  warnings). However, it's my belief that these warnings (IF you use 
  GD's compiler) are only due to small roundoff errors and do not cause 
  any of the problems normally associated with these warnings (long vis 
  time, visual errors in the game). If you encounter any of these problems 
  when using GenSurf-generated surfaces, please let me know.

As with so much of what I do, many thanks go to Mad Dog for providing a 
wealth of suggestions. Please let me know if you have any problems/
suggestions/comments with this or any other version of GenSurf.

David Hyde    rascal@magnolia.net


 ************************ DISCLAIMER ***************************
 *                                                             *
 *   David Hyde makes no warranties regarding the computer     *
 *   program GENSURF.EXE. Users assume responsibility for the  *
 *   results achieved for computer program use and should      *
 *   verify applicability and accuracy.                        *
 *                                                             *
 *   Neither id Software nor Ritual Entertainment supports the *
 *   changes made to the included version of qbsp3.exe. Use    *
 *   this progam at your own risk.                             *
 *                                                             *
 ***************************************************************
