Commit Graph

495 Commits

Author SHA1 Message Date
Jonathan b5089ce349 slight speedup by helping embree with alignment
merge some light algorithms together
allow changing attenuation on surface lights with _surflight_atten
replace some emplace_back's with push_back to improve compilation times
2024-06-02 19:49:32 -04:00
Jonathan 0f844ad3e2 don't output debug stuff if we don't need it 2024-05-29 07:12:56 -04:00
Eric Wasylishen 30868eacb7
light: LIGHTING_E5BGR9 + HDR .lit support (#427)
* light: Add support for LIGHTING_E5BGR9.

This is not really finished. Currently mutually exclusive with
regular RGBLIGHTING, and not tested with external .lit file.

* light: replace HDR_PackResult with a version following the OpenGL spec

- add HDR_UnpackE5BRG9 for unpacking
- caller is now responsible for scaling 128 -> 1
- expose in header for tests

* light: move HDR_PackE5BRG9/HDR_UnpackE5BRG9 to common/litfile.hh

* build: std::powf not available in gcc

* common: move LoadLitFile to litfile.hh

* common: LoadLitFile: return hdr variant as well

* lightpreview: add an Exposure slider

* lightpreview: support hdr .lit's, wip

* tests: refactoring to set up testing for hdr lit's

* tests: add test for -hdr and -bspxhdr

* tests: fix LM_Sample to deal with styles correctly

* lightpreview: fix glsl error

* lightpreview: show dialog box for glsl compile errors

---------

Co-authored-by: Daniel Svensson <dsvensson@gmail.com>
2024-05-26 21:55:10 -06:00
Eric Wasylishen a09ad4672f build: remove some constexpr's gcc 11 didn't like 2024-05-20 11:48:44 -06:00
Jonathan 6c9962eb8c some more memory adjustments
settings cleanup, maputil/bsputil changes

(cherry picked from commit 59ac57306f13ff53f935f51bb5df1e59e76753ef)

# Conflicts:
#	bsputil/bsputil.cc
2024-05-20 11:28:03 -04:00
Jonathan 71aa8aaeea
Paril/mem write (#412)
* simplify light_surfaces storage

* memory on writes

* Revert "batch together traces on the whole surface - saves a small amount of time"

This reverts commit 72611b7e97.

# Conflicts:
#	light/ltface.cc

* fix a use-after-move

* don't try to write lightmap if it has no styles

* fix issue with alignment
2024-03-13 20:01:05 -06:00
Jonathan 3d419853d3 store leaves on surf instead of surface light 2024-03-09 00:14:03 -05:00
Jonathan 6c1feb5af8 cut per-surface memory usage down by making streams re-usable per thread 2024-03-08 23:09:16 -05:00
Eric Wasylishen f3da00395d style: replace (void) with () 2024-02-26 21:07:22 -07:00
Eric Wasylishen 12b8066246 light: change remaining double -> float
tiny perf improvement on base1-test.map with light params:

-emissivequality high

before: 7.4s
after: 6.9s

no visible changes in base1.
2024-02-25 23:42:45 -07:00
Jonathan 53850d94ac fix crash in embree tracing due to new batching code
simplify structs for tracing
2024-01-21 08:52:16 -05:00
Eric Wasylishen 8db1d32e9f light: fix excessive bouncing with lit water, or _shadow -1
Fixes #397
2023-12-24 00:44:56 -07:00
Eric Wasylishen 6351cc50e6 rename: vec_t -> double 2023-12-23 21:09:16 -07:00
Jonathan 1eaf2170f8 Merge branch 'brushbsp' of https://github.com/ericwa/ericw-tools into brushbsp
# Conflicts:
#	light/trace_embree.cc
2023-12-07 14:13:36 -05:00
Jonathan 9ed4f3d042 bunch of double -> float
fix Q2 animated textures
2023-12-07 14:11:46 -05:00
Jonathan ec452e2291 remove implicit conversion for qplane3 2023-11-19 19:41:58 -05:00
Eric Wasylishen db0951dc40 light: support embree4 in addition to 3 2023-11-19 14:14:22 -07:00
Eric Wasylishen 22ad2f4141 light: cache list of lightsurfs that are actuall emissive
light.exe -visapprox none ad_sepulcher.bsp

45.5s -> 22.7s
2023-11-13 23:35:32 -07:00
Eric Wasylishen 91734ac8f6 light: fix gcc9 build 2023-09-17 21:24:04 -06:00
Eric Wasylishen e6d9605b86 light: fix lightgrid assertion failure if lightgrid gets a nan (separate bug) 2023-09-17 20:27:29 -06:00
Jonathan 0509c9a790 fix multiple bounce interaction with lightgrid 2023-09-16 11:55:10 -04:00
Jonathan 147be8f87a some optimizations in indirect lighting code
multiple bounce support
2023-09-16 00:41:05 -04:00
Jonathan 5619e2abef map file separation 2023-09-07 14:55:37 -04:00
Jonathan 7d881768fa Revert "Revert "reduce memory usage by only storing VPLs when we need to, and only once""
This reverts commit 2e0e23622b.

Disable rescale by default on sky faces.
Light is now in control of rescales' default value.
Multiply omni light faces by 0.5 to better match qrad3
Remove some asserts to increase perf
2023-09-04 02:51:20 -04:00
Jonathan 2e0e23622b Revert "reduce memory usage by only storing VPLs when we need to, and only once"
This reverts commit fcf39b2ef8.

# Conflicts:
#	include/light/light.hh
#	include/light/surflight.hh
#	light/bounce.cc
#	light/light.cc
#	light/ltface.cc
#	light/surflight.cc
2023-08-26 23:03:25 -04:00
Eric Wasylishen 1c85bb882a light: minimize includes 2023-06-26 01:19:54 -06:00
Eric Wasylishen fbea58d679 code formatting pass 2023-06-25 18:29:48 -06:00
Jonathan caa7418375 async threading for map progress, etc. no cancelling yet 2023-06-19 15:38:16 -04:00
Jonathan 08db6e9bf9 remove fastbounce, add emissivequality
emissivequality affects both emissives
2023-06-19 09:54:25 -04:00
Jonathan 1fbe12767e decouple lightmapping state from emissive state
allow sky to skip lightmapping if lightgrid is enabled in Q2 mode again
2023-06-19 04:11:20 -04:00
Jonathan 94357818f9 experiment with keeping sample data all together in memory, which might help caching. not certain. 2023-06-18 14:06:58 -04:00
Jonathan fcf39b2ef8 reduce memory usage by only storing VPLs when we need to, and only once
fix visapprox auto not actually being auto
2023-06-18 13:29:53 -04:00
Eric Wasylishen 1c6a76e1f8 light: autominlight extensions
- now apply per-luxel, not just to faces that are fully occluded
- add "_autominlight_target" key for specifying a target
  to take the light sample from
- add "_autominlight" key: 0 = force off, default = apply to occluded luxels, 1 = apply to all luxels

wip / subject to change!
2023-06-16 00:14:27 -06:00
Jonathan 0c8c10f553 post-process phase, so minlight doesn't affect emissives 2023-06-10 14:20:53 -04:00
Eric Wasylishen 895a28584c light: experimental autominlight for solid black sides of doors 2023-05-11 00:17:47 -06:00
Eric Wasylishen 290af832af style: rename dirt related member variables to match the actual names 2023-05-08 23:02:59 -06:00
Jonathan 39a54abfc6 add support for a region brush (code needs to be cleaned up a bit though)
allow _surflight_style on brush models
2023-04-28 13:31:50 -04:00
Jonathan 6035290c70 Merge branch 'brushbsp' of https://github.com/ericwa/ericw-tools into brushbsp
# Conflicts:
#	include/common/imglib.hh
#	light/entities.cc
#	light/light.cc
#	light/surflight.cc
2023-04-24 02:19:04 -04:00
Jonathan dddc48e98b simplify `needs_write` for surfflags
add `_surflight_color` key; allows overriding surface light color on an entity basis
load the .wal from wal_json and use the values as a base, if they exist
allow `_surflight_minlight_scale` to be specified on entities
2023-04-24 02:16:39 -04:00
Eric Wasylishen e069d7b9b8 style: update settings api to follow current coding style 2023-04-16 11:55:38 -06:00
Eric Wasylishen addc6e922b tests: add test case for culling of surface lights in the void 2023-04-09 12:39:19 -06:00
Jonathan 5daaeee6fb allow `surflight_minlight_scale` to be specified per brush 2023-03-26 18:29:37 -04:00
Eric Wasylishen adb7ecce15 light: remove -lightgrid_force_cube, -lightgrid_force_pot 2023-03-04 14:43:04 -07:00
Eric Wasylishen 6c3fd1503f light: remove -lightgrid_format uniform, cluster 2023-03-04 14:41:59 -07:00
Eric Wasylishen f0749450d3 light: support -extra for lightgrid 2023-03-04 11:05:50 -07:00
Eric Wasylishen dd6e49c89f light: support _object_channel_mask on func_group 2023-02-20 00:07:08 -07:00
Eric Wasylishen eda6155844 cleanup: run ./clang-format-all.sh
clang-format version 15.0.7
2023-02-18 22:59:43 -07:00
Eric Wasylishen 1d38ff0ff3 light: add -lightgrid_force_pot (power of two) 2023-02-18 20:15:47 -07:00
Eric Wasylishen c590400c46 light: lightgrid: add -lightgrid_force_cube 2023-02-18 19:15:34 -07:00
Eric Wasylishen 48fe527955 light: add _lightgrid_hint point entity key for customizing lightgrid bounds
use it as a info_null key: "_lightgrid_hint" "1"
2023-02-12 15:03:08 -07:00