Commit Graph

55 Commits

Author SHA1 Message Date
Eric Wasylishen a6a89db530 light: refactor tracelist to be a list of modelinfo_t instead of dmodel_t 2016-04-05 23:25:36 -06:00
Eric Wasylishen e11e9d5c1f light: embree support 2016-03-30 14:58:21 -06:00
Eric Wasylishen d2f1eb2b2b light: support _phong and _phong_angle on bmodels for compatibility with other qbsp's. 2016-03-05 22:51:17 -07:00
Eric Wasylishen 41972a376a qbsp, light: Strip texinfo flags other than TEX_SPECIAL.
Write extended ones to a "mapname.texinfo" file.
Support "_dirt" and "_minlight" flags on func_detail/group.
2016-03-05 00:26:54 -07:00
Eric Wasylishen 0b4c044473 light: fix dirtmapping traces 2016-03-04 20:40:14 -07:00
Eric Wasylishen fec88c3186 light: fix build on MSVC 2016-03-02 19:21:30 -08:00
Eric Wasylishen 492d94c1fe light: new phong shading keys, "_phong_angle" and "_phong".
"_phong" "1" is a shortcut for "_phong_angle" "89".
"_phong_angle" sets the max angle in degrees between faces that will get smoothed.
2016-03-02 20:00:05 -07:00
Eric Wasylishen f641e93ca2 light: convert light.c to light.cc 2016-03-02 17:07:02 -07:00
Eric Wasylishen 4ed6db3020 light: add new TraceFaces API which gives accurate info on the first hit face of a trace.
Need to use this for: dirtmapping, fence textures, GI
2016-02-21 22:31:06 -07:00
Eric Wasylishen 4e74e530c0 light: dynamically allocate memory for lighting each face 2016-02-20 14:43:38 -07:00
Eric Wasylishen 22dd1726de light: move lightsurf_t etc. to header 2016-02-20 14:41:58 -07:00
Eric Wasylishen 1fd1637de1 light: add -phongdebug option 2016-02-15 20:27:03 -07:00
Eric Wasylishen 1630b8756e tyrutils-ericw-spike rebased on to 998c9d3acb 2016-02-15 16:16:37 -07:00
Eric Wasylishen a439f891a1 CalcPoints: Skip the trace if a PointContents says the point is already unobstructed.
Handles beveled walkways in telefragged.bsp which touch a wall along one edge, but don't split the wall.
Previously, the walkways were blocking most of the traces for the wall, messing up all of the wall sample points.
2016-02-11 22:38:23 -07:00
Eric Wasylishen 420125cc67 replace tabs with spaces.
for FILE in $(find . -name "*.h" -or -name "*.c"); do cat $FILE | expand > temp; cat temp > $FILE; done
2015-12-07 15:08:48 -07:00
Eric Wasylishen e6fcf3d6da light: add -surflight_dump option to export generated surface lights to a map file 2015-12-05 20:27:51 -07:00
Eric Wasylishen 81cefad71a light: handle surface lights on rotators 2015-12-05 20:07:20 -07:00
Eric Wasylishen 50b556993a light: experimental -parse_escape_sequences option to toggle \b escape sequence (toggles bold text) 2015-11-26 18:30:10 -07:00
Eric Wasylishen 1e9a0ac2b3 light: add "-sunsamples" flag to control number of samples for _sunlight_penumbra and _sunlight2 2015-10-23 19:54:41 -06:00
Eric Wasylishen 46cbcfd12b light: add -dirtangle flag to control dirtmapping cone angle 2015-08-28 20:22:54 -06:00
Eric Wasylishen 3c918db489 light: add -onlyents switch 2015-08-20 12:14:13 -06:00
Eric Wasylishen 5302a3b539 light: add -surflight_subdivide command line flag to control subdivision size 2015-08-05 12:10:14 -06:00
Eric Wasylishen e9f240b623 light: .lux file support from Spike 2015-07-09 16:34:12 -06:00
Eric Wasylishen e242a9c910 light: Add gamma control with -gamma flag and "_gamma" key 2015-07-09 16:33:07 -06:00
Eric Wasylishen 54e7c2ab8e light: fence texture tracing 2015-04-27 00:26:42 -06:00
Eric Wasylishen ef471ee44f Support "_dirt" "-1" on bmodels to disable dirtmapping 2015-04-25 20:45:54 -06:00
Eric Wasylishen be8c42460c _sunlight2 (sky light, light dome) support from q3map2
_sunlight penumbra (deviance) from q3map2
light penumbra from q3map2
2015-04-25 20:45:44 -06:00
Eric Wasylishen 741d341332 Dirtmapping (ambient occlusion) from q3map2 2015-04-25 20:45:32 -06:00
Kevin Shanahan 4b1e3aec1a light, vis, bsputil, bspinfo: Add BSP2 support
Add BSP2 support to the remaining utils.  Since these share the common
bspfile.[ch] files, it was more effort than is justifiable to break this
into multiple staged patches - so you just get this disgustingly big
commit instead.  Here is basically what was done:

 * Modify the bspdata_t struct with a union of the two bsp formats
 * Modify the tools to use bsp2_t for all internal processing
 * Split out the byte swapping routines for the different bsp data types
 * Add simple (although verbose) code to convert bsp29 <-> bsp2

Hundreds of lines added to bspfile.c, but mostly trivial stuff.  The tools
internally had little modification except to substitute the bsp2 type
names.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-09-25 15:18:50 +09:30
Kevin Shanahan 89abf25218 common: convert all tools to instanced bsp data
Transition all tools to access the BSP data via the bspdata struct instead
of the shared globals.  Remove the compatibility code from bspfile which
copied the global values to/from the instanced bspdata struct.

Mostly the changes just involved passing along the bspdata struct to the
various functions which needed to reference the data.  TraceLine and
MakeTNodes in light got some extra changes so that we cache the node
dplane pointer and remove the need to pass the bspdata struct to every
trace operation!

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-08-22 11:01:08 +09:30
Kevin Shanahan 51419621ec common: add the bsp2/bsp29 data types
Rename the default bsp29 data types and add the bsp2 data types to
the common bspfile.h.  Propogate the bsp29 names into the other tools as
simple renames for now.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-08-20 13:25:16 +09:30
Kevin Shanahan 12e24085c1 light: always calculate color values for light samples
Simplify the code by removing the if (colored) conditionals from the
code path.  CPU cost is insignificant compared to tracing the rays.
As before, only write the lit file if colored lights are detected or
the use explicity requests it.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-07-03 13:03:27 +09:30
Kevin Shanahan a0fc4cab3e light: remove (now) unused MAXLIGHTS define
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-07-03 11:49:07 +09:30
Kevin Shanahan 4625245b09 light: implement the -addmin command line parameter
Makes minlight additive rather than just bringing low levels up to the
minimum.  Not entirely identical to the bjp implementation as it seems to
treat local minlights in some strange ways, but in most cases the
behaviour should be identical.

Added missing help text for -anglescale|-anglesense parameters too.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-04 15:55:58 +10:30
Kevin Shanahan 636a94f260 light: implemented _anglescale key (AKA "_angelsense")
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-15 21:27:14 +10:30
Kevin Shanahan 4abc7d31b7 light: remove the old -compress option
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-15 20:43:12 +10:30
Kevin Shanahan cc8477c6d9 light: implement -soft command line option
Add the -soft command line option which implements post-processing on
the lightmap surface to blend adjacent samples together to smooth out
hard shadow lines.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-14 11:28:22 +10:30
Kevin Shanahan cc36d8eadc light: rewrite light tracing function and update callers
Substantial changes to TestLineOrSky which now becomes TraceLine to
more conveniently trace lines through the BSP and, terminate the trace
on specific contents and return information about the termination
point.

TraceLine also more correcly handles the cases where points are close
enough to the node planes to be considered "on-node" to ensure we get
a good intersection point back, when requested.

Finally, the algorithm for making the small adjustments to surface
points in CalcPoints has been changed so if the surface point can't
see the midpoint, we find the obscuring surface and move the surface
point just above that. Seems to work better and eliminates some (but
not quite all - midpoint is still not quite the ideal point to use)
random black spots.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-12 16:40:16 +10:30
Kevin Shanahan 359ddfa41e light: remove nominlimit option and negative color value support
"nominlimit" is a more sensible default - people expect negative
lights to be able to subtract from minlight. The negative colors never
really worked properly and there's not really any worthwhile use for
the (that I know of).

Hopefully nobody will be too upset by these two changes to the old
behaviour.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-10 20:24:19 +10:30
Kevin Shanahan e8d640f88f light: use lightsample_t for minlight and sunlight
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-10 18:42:35 +10:30
Kevin Shanahan f82562f9e4 light: use lightsample_t for entity light values
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-10 18:28:00 +10:30
Kevin Shanahan d57e7d50fd light: use lightsample_t for modelinfo->minlight
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-10 17:17:42 +10:30
Kevin Shanahan eb92d5eac1 light: remove a couple of unneeded function declarations from header
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-09 19:18:36 +10:30
Kevin Shanahan 3749cfa734 light: pass the dface pointer into lightface
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-09 19:14:33 +10:30
Kevin Shanahan d6ef23453a light: implement self shadowing option for brush models
Brush models can now self shadow without casting shadows on their
environment, using the "_shadowself" entity key.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-08 15:02:36 +10:30
Kevin Shanahan a6e42ab860 light: implement brush model entity shadows
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-08 11:37:36 +10:30
Kevin Shanahan b4387359a4 light: implement minlighting for bmodels
Collect the appropriate keys from the models at load time and pass them
into the minlighting function (if > world minlight).

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-07 18:22:25 +10:30
Kevin Shanahan 33b4ba2040 light: remove the never-used nolightface array
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-07 15:18:36 +10:30
Kevin Shanahan a8d8150791 light: implement the -gate option
Precalculate the distance at which lights will fade to zero brightness.
For lights with inverse falloff, use the gate value to determine the
cut-off distance.  Use this value to cull samples and avoid the ray
tracing overhead.

Hopefully not too controversially, I am going to default this to "on" with
a gate value of 0.001. Unless you have > 1000 lights contributing
fractional light values across your map, this is not going to make any
visible difference.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-03 13:36:52 +10:30
Kevin Shanahan 052805c4ca light: fix race in allocation of white/coloured lightmap data
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-02 12:18:54 +10:30