Editing Darkplaces lighting/Introduction
Warning: You are not logged in.
Your IP address will be recorded in this page's edit history.The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 3: | Line 3: | ||
==What is a light== | ==What is a light== | ||
− | In Darkplaces engine, light is entity that engine or compiler use to illuminate objects around. Light's entity keys are options. There is three type of light sources: '''static''', '''dynamic''' and '''fake'''. | + | In Darkplaces engine, light is entity that engine or compiler use to illuminate objects around it. Light's entity keys are options. There is three type of light sources: '''static''', '''dynamic''' and '''fake'''. |
===Static lightsources=== | ===Static lightsources=== | ||
− | Entity which classname begins with "light" is static lightsource. Usually its just classname "light", the differences between classnames are used to attach some additional functionality ( | + | Entity which classname begins with "light" is static lightsource. Usually its just classname "light", the differences between classnames are used to attach some additional functionality (like spawning of a flame effect). But for map compiler, all "light*" entities are same and using same property set. |
Q3map2 generates static lighting data when map is compiled. Depending on map size, it could last from few seconds to a hours of compilation. Generated textures and attributes are very fast to render and dont have any hit from lights count and radius (can have thousands of lights on a map, its just affects the compile time, not gameplay). | Q3map2 generates static lighting data when map is compiled. Depending on map size, it could last from few seconds to a hours of compilation. Generated textures and attributes are very fast to render and dont have any hit from lights count and radius (can have thousands of lights on a map, its just affects the compile time, not gameplay). | ||
Line 14: | Line 14: | ||
===Fake lightsources=== | ===Fake lightsources=== | ||
− | + | There is some special lightsources that is using render tricks. They are not real lights, but just make some effects that looks like a light. This is quite grude, but also very fast (since it ignores generic lighting math). Coronas and glares are fake lights. | |
==Key Concepts== | ==Key Concepts== | ||
+ | This is some key concepts Darkplaces lightning system was build around. | ||
===Power has a price=== | ===Power has a price=== | ||
Line 27: | Line 28: | ||
Darkplaces lighting is not unified. It combines several techniques in order to get best performance and visual quality. There is no need to light up whole level with hi-quality realtime lighting, as it will take too much CPU and GPU time. Small objects should receive a grude and fast lighting, while important objects should have best quality. To reach this goal, Darkplaces lighting have two parts - static lighting and dynamic lighting. | Darkplaces lighting is not unified. It combines several techniques in order to get best performance and visual quality. There is no need to light up whole level with hi-quality realtime lighting, as it will take too much CPU and GPU time. Small objects should receive a grude and fast lighting, while important objects should have best quality. To reach this goal, Darkplaces lighting have two parts - static lighting and dynamic lighting. | ||
− | For static lighting illumination data is generated when map is being compiled. All objects that is not moving, rotating, animating, transforming in any way, by default, should be illuminated with static lighting. Also any light that is not moving, switching, animating, should be static | + | For static lighting illumination data is generated when map is being compiled. All objects that is not moving, rotating, animating, transforming in any way, by default, should be illuminated with static lighting. Also any light that is not moving, switching, animating, should be static to. THe trick is that both of previous rules should be used synchronously. If there is some dynamic object with many static objects, and it cannot be lit well with static lighting, should make all scene illuminated with dynamic light. |
Map compiler (for Blood Omnicide it is [[Q3Map2]]) is a tool that generates static lighting data. It is a full featured raytracer able to render non-point sources, area sources, spot lights, alpha shadows, can store light vectors in deluxemaps (in order to get normalmapping and specular working for lightmapped surfaces) etc. All this features makes static lighting to look same as dynamic, but render alot faster. There is 3 techniques available: | Map compiler (for Blood Omnicide it is [[Q3Map2]]) is a tool that generates static lighting data. It is a full featured raytracer able to render non-point sources, area sources, spot lights, alpha shadows, can store light vectors in deluxemaps (in order to get normalmapping and specular working for lightmapped surfaces) etc. All this features makes static lighting to look same as dynamic, but render alot faster. There is 3 techniques available: | ||
Line 36: | Line 37: | ||
Dynamic lighting comes from dynamic lightsources and can illuminate objects that is moving, rotating, animating, transforming in any way. It is very flexible and time consuming as it get computed in realtime, each frame. At other features like simulation of non-point sources, spotlights is less efficient with dynamic lighting because of limited computation time (it should be less than several milliseconds). | Dynamic lighting comes from dynamic lightsources and can illuminate objects that is moving, rotating, animating, transforming in any way. It is very flexible and time consuming as it get computed in realtime, each frame. At other features like simulation of non-point sources, spotlights is less efficient with dynamic lighting because of limited computation time (it should be less than several milliseconds). | ||
− | Here is the table showing features | + | Here is the table showing features if different techniques: |
{| width=500 cellspacing=0 cellpadding=2 border=1 style="border-collapse:collapse" | {| width=500 cellspacing=0 cellpadding=2 border=1 style="border-collapse:collapse" | ||
! width=40% rowspan=2 | Task | ! width=40% rowspan=2 | Task | ||
Line 46: | Line 47: | ||
! width=15% | Lightgrid | ! width=15% | Lightgrid | ||
|- | |- | ||
− | | colspan=5 align=center | Features (1 - bad, 2 - average, 3 - good, 4 - very good | + | | colspan=5 align=center | Features (1 - bad, 2 - average, 3 - good, 4 - very good) |
|- | |- | ||
| Details | | Details | ||
Line 60: | Line 61: | ||
| align=center | <font color=red>'''1'''</font> | | align=center | <font color=red>'''1'''</font> | ||
|- | |- | ||
− | | | + | | RAM |
| align=center | <font color=green>'''4'''</font> | | align=center | <font color=green>'''4'''</font> | ||
| align=center | <font color=red>'''1'''</font> | | align=center | <font color=red>'''1'''</font> | ||
Line 72: | Line 73: | ||
| align=center | <font color=green>'''4'''</font> | | align=center | <font color=green>'''4'''</font> | ||
|- | |- | ||
− | | Penumbra | + | | Penumbra |
| align=center | <font color=red>'''1'''</font> | | align=center | <font color=red>'''1'''</font> | ||
| align=center | <font color=green>'''4'''</font> | | align=center | <font color=green>'''4'''</font> | ||
Line 84: | Line 85: | ||
| align=center | <font color=red>'''1'''</font> | | align=center | <font color=red>'''1'''</font> | ||
|- | |- | ||
− | | colspan=5 align=center | Surface-based effects | + | | colspan=5 align=center | Surface-based effects |
|- | |- | ||
| Bumpmapping | | Bumpmapping | ||
Line 122: | Line 123: | ||
| align=center | <font color=green>'''+'''</font> | | align=center | <font color=green>'''+'''</font> | ||
|- | |- | ||
− | | colspan=5 align=center | Used to illuminate | + | | colspan=5 align=center | '''Used to illuminate''' |
|- | |- | ||
| Map surfaces | | Map surfaces | ||
Line 134: | Line 135: | ||
| align=center | <font color=green>'''+'''</font> | | align=center | <font color=green>'''+'''</font> | ||
| align=center | <font color=green>'''+'''</font> | | align=center | <font color=green>'''+'''</font> | ||
− | | align=center | <font color=green>''' | + | | align=center | <font color=green>'''-'''</font> |
|- | |- | ||
| Moving/rotating BModels | | Moving/rotating BModels |