id Tech Forums

id Tech 4 (Doom3/Prey/Q4) => id Tech 4 Level Editing => Topic started by: Zombie on July 01, 2014, 03:39:08 AM

Title: Correct way to light
Post by: Zombie on July 01, 2014, 03:39:08 AM
I read this on Moddb, and for those looking to poke at idtech please don't do this, this is the opposite of what you should do.

QuoteidTech 4 does better with large lights, less lights. But it's not related to how you size lights. So, tools need to be fluent, not rigid.

If you use larger but fewer lights your scene does 2 things, it looks bland due to using fewer lights and you are wasting performance because your big lights are touching more surfaces than they need to.

Smaller lights are better as you can use more of them, and because they are smaller they touch less polys = less draw calls.

Title: Re: Correct way to light
Post by: The Happy Friar on July 01, 2014, 06:56:31 AM
When I started using D3Edit it was "New" to not use as little brushwork as possible compared to Q1/2/3.  I ended up getting used to it now.

Raven made up a great forum post years ago about how to light D3 tech maps.  It's on archive.org now and I've got it right here: here (http://web.archive.org/web/20060515183308/http://www.map-center.com/modules.php?name=Forums&file=viewtopic&t=4505)

For those link-clicking lazy, here's the whole thing:
QuoteI figured I would compile a small and simple list of Editing tips that will help you guys navigate the editor.  Please feel free to add new ones you discover as well.

The light color scale is as follows:

Type r_showlightcount 1 into the console, when you are in game. You will see the following colors:

1. Black= No light hitting the surface.

2. Red= 1 light hitting the surface (this is excellent).

3. Green= 2 lights hitting a surface (this is great).

4. Blue = 3 lights hitting a surface (This is getting bad. You need to keep these areas small, but it is ok to have a number of smaller areas in a room that are blue).

5. Cyan, pink, or white= 4+ lights hitting a surface this is bad and you should only have this in very small, isloated areas. If you have a large face with any of these colors your lighting is inefficient and you need to either split the brush face according to the light volumes or reduce the overlap.

NOTE: You can get  large brush faces that will show up as white or cyan even when there are no actual light volumes overlapping one another in the area,  This is because a large brush face will be in contact with multiple light volumes, which is just as bad as having multiple light volumes overlapping.  To fix this you can split the large brush face up between the volumes that are making contact with the face.  So instead of having one large face with 4-5 lights contacting it you can have 3 brushes with only one or two light volumes hitting the brush faces.  This works well only if you can keep the engine from merging your splits back together.  There are a number of ways to do this, but I am only going to cover a simple decal method here.  In the example above one brush was split into 3.  In order to keep all three brushes from merging again, select the center brush of the three and turn it into a caulk brush.  Make a simple patch mesh and fit it to be coplanar and exactly the same size as the visible face of the caulk brush.  Texture it to fit the textures around it and you now have 3 brushes that cannot be merged back together by the engine in place of one large one.  Your light colors should drop from Cyan/white to green and red.

This is the thermometer you have to aid in your journey to a playable level.

r_showprimitives 1 will give you the r_speeds. You should try and keep most areas in the 45-60k region. 70 k is also fine, but if you are making mp maps I would lean towards a max of 65k for any given view.  This is pretty subjective because one can simply make a point that their level needs a little bit more machine bulk in their readme if they want to go a little higher end, but this of course limits your download crowd.

com_showFPS 1 will show the Frames Per Second in the top right hand corner of your screen.

Tech. Bits:

One other thing to keep in mind is that large brush faces that have more than one light volume touching them will show a color that registers all of the light volumes in contact with the face. In other words, If you have a brush that makes up a large wall and there are 5 light volumes touching a single face of that wall in various sections (with absolutely no light volume overlap between the 5 lights) the brush face will still show up a pink/white. To avoid this you need to make sure that brushes are not extremely large and are split up accordingly. (explanation above)

One other engine specific trait is that if you just simply split a brush to reduce the amount of light volumes in contact with the face you may lose your split when the map is compiled. Try splitting brushes along the edge of a texture boundary. If the engine finds manual splits across a texture's width (not along its edge) then the engine will say..."Hey both brushes share the same texture... I am going to merge them.." This is a nice feature that reduces extraneous polys during compile, but makes it more challenging to split faces.

Editing Lights:

1. To edit the properties of a light, select the light and hit the j key. This will bring up the light editing window. You can set the light as projected, or make the light origin available for manipulation, change the color and the saturation (brightness) of a light, change the light volume size, and change the light texture in this menu.

2. To edit the light origin you must select the light and hit the j key to bring up the light menu. In the light menu you click the center box and hit apply at the bottom of the menu. Now you have to unselect and reselect the light to actually drag the light origin around.

3. The brightness slider does not work at all so don't waste your time with it. The saturation slider at the far right of the color window is how you change the brighness of a light. You can also choose a texture that dims the light as well.

Brush Logic:

Just so people start levels with efficiency in mind I highly recommend you study the texture sets well. The days of Q3 detail-a-wall-with-masses-of-brushes to fill space are gone! Texture stacking is far superior in look to the brushwork typical in Quake 3. Why is this
?...Because brushes pulled out away from the wall create shadow volumes that are expensive and typically look less impressive in this engine (they cast really harsh shadows that require more light volumes to soften up). I am not saying you cannot break up your walls for detail, but I am saying create a nice balance between the two.

This also means stay away from the tri-soup method of terrain and lean towards modeling terrain sections out in Lightwave or some other modeling program of your choice. The surface has nicer poly spread and less harsh edges than tri-souped or gensurfed terrain chunks. The lighting will look much nicer on a good model mesh.

Question Session (Brush Logic):

 
Quote:
Am I understanding this correctly if you mean that one should try to keep the number of brushes down but at the same time not use too large brush faces cos the lightning is so demanding?


I should have stated it a little better. You do not need to try and keep the overall brush count of a level down. You should try splitting flat walls and allow texture stacking (different textures that fit together) to give you a nice shell of detail, and try to lower the amount of brushes that are pulled out, away, or sunken into the wall along the way. The problem associated with the Q3 style of building is that there are too many harsh shadow volumes that are both expensive and ugly. Try building structures and then making a second pass to see how much can be mere stacking as apposed to brushwork giving the shape. By no means do you have to avoid detail, but just try and use the light and the textures to do a lot of work for you to cut down on shadow volumes. Curves are also brilliant in this engine and they don't LOD. You can hit the "S" Key with any patch and select the Subdivisions box to reduce the patch subdivisions on the fly. This will make a big difference for you and you will notice that curves that are almost diamonds will look like nice cylinders in game in many cases.

 
Quote:
Is this engine gonna make it difficult, in your opinion, to create larger/outdoors areas because of this


Not if you keep all of this in mind.  Outdoor areas are very do-able, but the amount of lights have to be reduced to keep the color grid in the red or green in most areas. The other thing I recommend is the use of a modeling program for terrain, so that the mesh will have a nice controlled arrangement of poly's and will light with less shadow volumes than a jagged and non-uniform wad of polys. It is very possible (http://web.archive.org/web/20060515183308im_/http://www.map-center.com/modules/Forums/images/smiles/icon_smile.gif)

Lloyd Morris's Tips:

Not sure if this has been covered yet but one quick way to create a light of the size you want without guessing/calculating values is to create a brush of the size light you want and then right-click and select light entity to convert it to a light.

Also, I haven't played with the original d3 editor (the one which ships with the game) since finishing up d3mp a few months back, so some of these may have changed, but these are some of the useful commands I used while editing:

r_showportals 1 shows the portals working (green is open and the area behind is drawn) red is closed but the area in front is drawn and the area behind isn't.

r_showtris 1,2 or 3 show triangles drawn by the engine. 1 shows tris visible but culls tris behind other tris. 2 is probably most like q3 showtris. 3 shows everything not cut by the engines pvs.

Also while running the game from the editor I used the editlights command. This shows you where lights are ingame and allows you to edit them realtime from within the game.


Modellers should bind the following commands to keys (eg f1 - f4)

bind f1 toggle r_skipdiffuse 0 1 2
bind f2 toggle r_skipspecular 0 1
bind f3 toggle r_skipbump 0 1
bind f4 toggle r_shadows 0 1


They're pretty self explanitory.[/t][/t][/t][/t][/t][/t]
[/td][/tr][/table][/td][/tr][/table]
Title: Re: Correct way to light
Post by: Zombie on July 01, 2014, 08:09:18 AM
Nice one Friar!

I do agree it isn't just about lights, but about your models/brush work to keep things optimised as much as possible.

Should've added that to my initial post  O0
Title: Re: Correct way to light
Post by: nbohr1more on July 20, 2014, 02:26:48 PM
Sikkpin made a mod that allows for cubemaps to act as the texture source for lights. With that mod, the idea of
using less and larger lights to improve performance comes to fruition better. That said, it must be specified that
any light overlaps will cause additional render passes so it's in your best interest to ensure that light overlaps are kept
to a minimum regardless of the size of the light or number of underlying polygons. Since Doom 3 tries to merge as many
polys into the same structure as possible this can lead to paradoxical situations such as "adding more geometric detail
improves performance while more barren warehouse-style geometry performs worse".

Some clever folks have found some interesting exceptions\workarounds to these rules:

http://www.lunaran.com/page.php?id=165

http://forum.tgmonline.it/showthread.php?5137-Lightmaps-in-Doom-3-Engine-A-Hybrid-Approach-To-Real-Time-Lighting

Title: Re: Correct way to light
Post by: solarsplace on December 23, 2014, 12:30:13 PM
Hi

I am interested in this "Also while running the game from the editor I used the editlights command. This shows you where lights are ingame and allows you to edit them realtime from within the game. "

I have been trying for ages to get this to work. I have bound editLights to a key, but I have no idea how to select a light in game. I have tried searching the net for ages and various combinations of selecting the light in the editor, loading the game via the editor then running editLights via key bind. But I always get no light entities selected appearing in the tool window.

If anyone can tell me how to select a light in the game that would be brilliant!

Thanks in advance.
Title: Re: Correct way to light
Post by: motorsep on December 23, 2014, 09:05:45 PM
Get a light into your crosshair - fire! (LMB) Can't be simpler than that ;)

Note that lighting with Lunaran's method is inefficient and quite limiting. It's interesting, original, but totally inefficient.

Cubemap lights will have issues with vertical surfaces. So there isn't any win in using those.

Real-time GI or lightmaps (fake works too) are the only two ways to light level efficiently.
Title: Re: Correct way to light
Post by: solarsplace on December 26, 2014, 08:51:52 AM
Hi motorsep

Thanks, not sure what I was doing before, but that works fine now. Many thanks. I do wish the light would update in real time like in the editor though. You need to keep pressing apply for it to update and although its not a big thing its a pain when doing precise fine tuning...

Cheers