w23 / xash3d-fwgs

Vulkan Ray Tracing fork of Xash3D FWGS engine. Intended to be merged into master at some point in the future.
163 stars 16 forks source link

Info: Lighting #38

Closed 0x4E69676874466F78 closed 1 year ago

0x4E69676874466F78 commented 3 years ago

General

https://github.com/ValveSoftware/halflife/blob/master/utils/qrad/qrad.txt https://sites.google.com/site/svenmanor/tutorials/light Also: https://csm.dev/threads/radius-osveschenija-v-half-life.38602/#post-935193 https://github.com/ValveSoftware/halflife/blob/master/utils/qrad/lightmap.c#L1020

The first part of the radiosity process is the accurate calculation of direct lighting. All entity lights and the bright (5000 or greater) surface patches exactly trace lines to the individual lightmap samples. If -bounce 0 is specified, thats it for the lighting. Otherwise, the lightmap values are summed up to give the initial amount of light to be bounced around the world in the radiosity pass. ISSUES WITH BMODELS Brush models emit and absorb light like other surfaces, but they do not block light, so after normalization, a little less light lands on the nearby surfaces, because it was absorbed both by the door and the surfaces beyond it. You probably won't notice anything unless you have a row of spotlights on normal walls, then an identical one on a bmodel. ISSUES WITH WATER Light does NOT cross through water surfaces if the vis has been calculated, because the areas are in different potentially visible sets, but if you run qrad without a vis, then light will be sent through as well. (QRAD DOCUMENTATION)

Surface lighting

All textures that are on the "light emiting" list will cast light into the world, oriented down the surface normal. A value of 100-300 is reasonable for a large, dim surface, like slime, lava, or a dark sky. Lights that will illuminate large areas with a small surface area will have values of 5000 or greater. The total amount of light emited from a surface is proportional to the surface's area, so the size of the brush face has as much effect on the light sent into the world as the light value. Surface lighting falls off with the sqare of distance, so if you double the height of a room, you will need to have four times the light intensity on the ceiling to get the floor the same brightness. The walls would then be much brighter near the top than they were with the smaller room as well. (QRAD DOCUMENTATION)

rad file, see #37

light

https://github.com/ValveSoftware/halflife/blob/master/utils/qrad/lightmap.c#L901

They should function similar to quake 1 lights, with linear falloff instead of inverse quadratic. (QRAD DOCUMENTATION)

keyvalues

light_spot

The field "_cone" determines the spread of the spotlight. If not specified, a _cone of 15 will default. (QRAD DOCUMENTATION)

https://github.com/ValveSoftware/halflife/blob/master/utils/qrad/lightmap.c#L935

keyvalues

light_environment

Skys emit light like other surfaces, but have slightly different characteristics. They emit light from all angles, so it doesn't matter if you see a horizontal or vertical sky brush. Light also does not bounce off of a sky in the radiosity pass, if it flies out a sky texture it is just gone. (QRAD DOCUMENTATION)

https://github.com/ValveSoftware/halflife/blob/master/utils/qrad/lightmap.c#L935 Note: Some maps have multiple light_environment entities. If so, every light setting will be listed. В QRAD источники применяются к рядом стоящим SURF_DRAWSKY, в HLRAD light_environment (light_spot _sky=1) единственный глобальный.

keyvalues

dynamic_light

TBD

func_wall and etc

keyvalues

ELIGHT and DLIGHT

https://twhl.info/wiki/page/VERC%3A_Dynamic_Lighting

Specificity of ZHLT/VHLT

http://zhlt.info/entity-changes.html https://sites.google.com/site/svenmanor/tutorials/advancedlight (a lot of useful information)

At least need to be implemented:

info_texlights

keyvalues

Undocumented features

http://ralertmod.narod.ru/hlra-articles-nedok.htm http://ralertmod.narod.ru/ent_env_model.htm#effects-par

0x4E69676874466F78 commented 1 year ago

https://github.com/w23/xash3d-fwgs/wiki/Lighting