Help with lighting

Advanced OpenGL source port fork from ZDoom, picking up where ZDoomGL left off.
[Home] [Download] [Git builds (Win)] [Git builds (Mac)] [Wiki] [Repo] [Bugs&Suggestions]

Moderator: Graf Zahl

User avatar
Enjay
Developer
Developer
Posts: 4748
Joined: Tue Aug 30, 2005 23:19
Location: Scotland
Contact:

Help with lighting

Post by Enjay »

Can anyone point me in the direction of some documentation dealing with how to allocate dynamic lights to things (like monsters, fireballs, rockets, etc). I've DL'd the dynamics_2.zip file and I think I can make sense of the entries, but if there is some documentation somewhere I can read to give me the full skinny it would be helpful (I've had a search around and can't find it). I'm assuming that since Graf hasn't mentioned it in the documentation thread that the system comes from another port, so obviously the documentation for that port would be suitable.

Also, the Glowing flats feature - I can't seem to get it to work. I copied the glowdefs example from this thread

http://forum.drdteam.org/viewtopic.php?t=426

but with my glowdefs lump loaded, I see no obvious difference with flats that I think should be glowing (eg the nukage pits in E1M1, the lava in E3M6...) Am I doing something wrong?

Here's my glowdefs lump

Code: Select all

Flats 
{ 
   LAVA1 
   LAVA2 
   LAVA3 
   LAVA4 
   NUKAGE1 
   NUKAGE2 
   NUKAGE3 
   BLOOD1 
   BLOOD2 
   BLOOD3 
} 
User avatar
Graf Zahl
GZDoom Developer
GZDoom Developer
Posts: 7148
Joined: Wed Jul 20, 2005 9:48
Location: Germany
Contact:

Post by Graf Zahl »

You have to specify it in MAPINFO. I didn't want to make it global for all maps. Please note that currently it doesn't work for sectors with slopes which is why I haven't officially documented it. It's really just some unfinished development garbage from an attempt to get the Doom64TC levels to work.

If you don't mind creating an incompatibility with ZDoom just add

GLOWDEFS "GLOWDEFS" to the defaultmap section.

The dynamic light definitions are taken directly from ZDoomGL. I don'T know whether any real documentation exists.
User avatar
BlackFish
Posts: 108
Joined: Thu Sep 01, 2005 18:33

Post by BlackFish »

I can make documentation sometime this weekend. It's pretty simple.
SlayeR
Posts: 120
Joined: Wed Aug 31, 2005 6:23
Location: Somewhere
Contact:

Post by SlayeR »

Yeah there is no real documentation for it. For a good reference though have a look through my default light defs for zdoomgl. It's not too hard to figure out ;)

Here's an attempt at some documentation :P

[spoiler]

Code: Select all

Firstly you must define the lights themselves:

<lighttype> <LIGHTNAME>
{
    ...
}

<ighttype>: They type of light. This can be "pointlight", "flickerlight", "flickerlight2", "pulselight" or "sectorlight"
LIGHTNAME: The name of the light (to be used later when binding it to objects/frames)

Inside the brackets you define the light properties. These differ for the different types of lights. Here are examples of each type (* means the property is optional):

pointlight POINT
{
    color <RED> <GREEN> <BLUE>
    size <SIZE>
    *offset <X> <Y> <Z>
}

RED, GREEN and BLUE: Colour components (each between 0.0 and 1.0)
SIZE: Size of the light, in map units (I think)
X, Y and Z: The offset for the light in map units, with Y being the 'up' axis. Defaults to 0,0,0

pulselight PULSE
{
    color <RED> <GREEN> <BLUE>
    size <SIZE>
    secondarySize <SECSIZE>
    interval <INTERVAL>
    *offset <X> <Y> <Z>
}

SECSIZE: The size to 'pulse' to. In the same units as 'size'
INTERVAL: The time it takes to complete a full pulse (from 0.0 to * (I guess), not sure on the units/scale)

flickerlight FLICKER
{
    color <RED> <GREEN> <BLUE>
    size <SIZE>
    secondarySize <SECSIZE>
    chance <CHANCE>
    *offset <X> <Y> <Z>
}

SECSIZE: The second size to flicker (will alternate between SIZE and SECSIZE)
CHANCE: The chance it will flicker to the second size (same as INTERVAL from pulselight)

flickerlight2 FLICKER2
{
    color <RED> <GREEN> <BLUE>
    size <SIZE>
    secondarySize <SECSIZE>
    interval <INTERVAL>
    *offset <X> <Y> <Z>
}

SIZE and SECSIZE: Lower and upper bounds for the size (the light will pick a random value between the two)
INTERVAL: The time between 'flickering' to a new random size. (same units/scale as INTERVAL for pulselight)

The sectorlight takes it's intensity from the light level of the sector it's in
sectorlight SECLIGHT
{
    color <RED> <GREEN> <BLUE>
    size <SIZE>
    scale <SCALE>
    *offset <X> <Y> <Z>
}

SCALE: How much of the containing sector's intensity to use (between 0.0 and 1.0)



Now you bind the lights to specific objects and sprite frames

object <CLASSNAME>
{
    frame <SPRITENAME>
    {
         light <LIGHTNAME>
         ...
    }
    ...
}

CLASSNAME: An actor class. A full list of these can be found at the ZDoom wiki.
SPRITENAME: The first few letters of the sprite name. For example, "MISL" will bind the light to all frames (used by that object) beginning with "MISL". 
LIGHTNAME: The name of a previously defined light (see above). It is possible to bind multiple lights to a single object/frame.
[/spoiler]

Also here's a nice exampe from my zdoomgl light defs:

Code: Select all

pointlight BLURSPHERE1
{
    color 1.0 0.0 0.0
    size 40
    offset 0 16 0
}

pointlight BLURSPHERE2
{
    color 0.0 0.0 1.0
    size 32
    offset 0 16 0
}

pointlight BLURSPHERE3
{
    color 0.0 0.0 1.0
    size 24
    offset 0 16 0
}

pointlight BLURSPHERE4
{
    color 0.0 0.0 1.0
    size 16
    offset 0 16 0
}

pointlight BLURSPHERE5
{
    color 0.0 0.0 1.0
    size 8
    offset 0 16 0
}

object BlurSphere
{
    frame PINS { light BLURSPHERE1 }

    frame PINSA { light BLURSPHERE2 }
    frame PINSB { light BLURSPHERE3 }
    frame PINSC { light BLURSPHERE4 }
    frame PINSD { light BLURSPHERE5 }
}
That binds the light BLURSPHERE1 to all of the BlurSphere's frames (PINS*) for the red sphere, and extra lights on top of it (BLURSPHERE2-5 to PINSA-D) for the animated blue blob in the middle ;)
User avatar
Graf Zahl
GZDoom Developer
GZDoom Developer
Posts: 7148
Joined: Wed Jul 20, 2005 9:48
Location: Germany
Contact:

Post by Graf Zahl »

If you think ypu have something usable feel free to post it in the documentation thread. I have kept it unlocked so that everyone can add to it. If I think it is misplaced I still can delete it again.
User avatar
BlazingPhoenix
Posts: 488
Joined: Sun Aug 28, 2005 5:11
Contact:

Post by BlazingPhoenix »

can you make new dynamic lights, out of decorate monster projectiles? (just wondering)
User avatar
Enjay
Developer
Developer
Posts: 4748
Joined: Tue Aug 30, 2005 23:19
Location: Scotland
Contact:

Post by Enjay »

Ok thanks. When I get home from work, I'll get a chance to look at this stuff properly.

An unrelated question - GLnodes. I think GZDoom builds them itself, but is there any advantage to building them with GLBSP prior to playing GZDoom? If so, how do I use them? Do I just leave a GWA file in the relevant directory? Can they be incorporated into a WAD somehow (for neatness if nothing else)?

Thanks.
User avatar
Graf Zahl
GZDoom Developer
GZDoom Developer
Posts: 7148
Joined: Wed Jul 20, 2005 9:48
Location: Germany
Contact:

Post by Graf Zahl »

Glnodes. Well, there is normally no need to build them, especially for small maps. It's only worth the effort if you are playing large maps and the time to build the nodes bothers you.

It works as follows:

Step 1. The engine checks what type the internal nodes are and loads them (that means normal non-GL nodes as well.)
Step 2. If step 1 fails it tries to load GL nodes from the loaded WADs or a GWA file with the same name as the file the level came from.
Step 3. If Step 2 fails an internal node build is performed

Now it gets interesting

Step 4. It checks the loaded nodes for usability for GL rendering. If it finds they cannot be used the segs are deleted and the nodes and subsectors copied to other variables. The game still needs them to get a sector from a coordinate. Using the newly built GL nodes breaks some WADs fatally.
Step 5. If the nodes in Step 4 are non-GL nodes it first tries to load GL nodes from the loaded WADs or a GWA file.
Step 6. If Step 5 fails an internal node build is performed

If you want to incorporate GL nodes in your WAD I recommend using ZDBSP's compressed node format. It is significantly shorter and since ZDoom can read it as well you can omit the regular nodes from the WAD completely.
User avatar
Enjay
Developer
Developer
Posts: 4748
Joined: Tue Aug 30, 2005 23:19
Location: Scotland
Contact:

Post by Enjay »

OK, lots of info. Thank you.

I'll try and build some nodes when I get home and see how the different options work out for me. It was taking 13-14 seconds to build nodes for a slightly modified ZDCM1 I have, so I figured I'd find out what the alternatives were.
User avatar
Enjay
Developer
Developer
Posts: 4748
Joined: Tue Aug 30, 2005 23:19
Location: Scotland
Contact:

Post by Enjay »

OK, I failed to get glowing flats working myself. I think I have done everything suggested, but no glow. Has anyone put together a working WAD using this not-yet-supported-feature? Even a single room demo should allow me to see where I'm going wrong.

Thanks.
Nuxius
Posts: 106
Joined: Fri Sep 02, 2005 9:15
Location: Texas

Post by Nuxius »

Since I'm currently at work and bored out of my mind, I decided to give this glowdefs thing a shot to see if I could whip something up.

Well, after hacking away at it for about 30-45 min, I can safely say I have totally "failed it".

I've poured over the zdoom wiki trying to get a better understanding of how to use MAPINFO, but I still can't peice together what I'm supposed to do here.

I suppose it would be very helpful if someone could type out a example MAPINFO that applies these GLOWDEFS to map01 of DoomII. Yes, yes it would be very helpful :D
User avatar
Graf Zahl
GZDoom Developer
GZDoom Developer
Posts: 7148
Joined: Wed Jul 20, 2005 9:48
Location: Germany
Contact:

Post by Graf Zahl »

Code: Select all

Defaultmap
	GLOWDEFS "glow004"
	SKY1 "sky4tall" 0
	forcenoskystretch
	Cluster 4
	nojump

MAP E4M1 "Hell Beneath"
	Music "d_e3m4"
	Next E4M2

MAP E4M2 "Perfect Hatred"
	Music "d_doom"
	Secretnext E4M9
	Next E4M3
It's in DEFAULTMAP because it should be applied to all following maps.
User avatar
Enjay
Developer
Developer
Posts: 4748
Joined: Tue Aug 30, 2005 23:19
Location: Scotland
Contact:

Post by Enjay »

OK thank you. Finally I have it working. I'm not sure what I was doing differently to what you are, as far as I could tell I'd done basically the same stuff. :dunno:
User avatar
Enjay
Developer
Developer
Posts: 4748
Joined: Tue Aug 30, 2005 23:19
Location: Scotland
Contact:

Post by Enjay »

Graf Zahl wrote:Please note that currently it doesn't work for sectors with slopes which is why I haven't officially documented it.
Yeah, I've seen a few places where slopes screw it up now. :( Shame, it's a nice effect but sometimes the slope conflict is prohibitively nasty.
User avatar
Graf Zahl
GZDoom Developer
GZDoom Developer
Posts: 7148
Joined: Wed Jul 20, 2005 9:48
Location: Germany
Contact:

Post by Graf Zahl »

I have two choices:

1. Use light maps. I don't want to do that because it eats unnecessary processing power.
2. Split the polygon somehow so I can continue to use vertex lighting. The problem is that this has to be done in a very specific manner to prevent the light from screwing up. So far my attempts have all caused undesirable side effects.

And of cpurse once it works for slopes I want to extend it so that you don't need glowing flats for the effect.
Locked

Return to “GZDoom”