Entities Lump: Lights

If you're looking for mapping help or you reckon you're a mapping guru, post your questions / solutions here

Moderator: Moderators

Post Reply
chacham15
Private
Posts: 7
Joined: Sun Apr 20, 2008 8:00 pm

Entities Lump: Lights

Post by chacham15 »

Hey you guys, Im writing my own Mohaa Map rendering program. In the BSP file, the entities lump contains information about the lights. I was wondering, is the light entity which contains an angle a spot light and the one that doesnt is a point light? And if so, can I render these with a call to glLightfv? Also, is _color a diffuse color? Lastly, the light value im guessing is an intensity, how do I take that into account with OpenGL? Thanks for any and all answers and for the time taken to answer these probably easy questions.

-chacham15
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post by Rookie One.pl »

Hello! :)

Yeah, a light with an angle property is a spotlight. The angle determines the size of the cone, though, rather than the direction it shines in. The direction is determined by the entity the light targets (you can get a directional vector by subtracting the light's origin from the targeted entity's origin and normalizing the result).

Yes, _color is indeed a diffuse color. :) There's no other type of lighting you can get with this engine.

As for the OpenGL questions, I'm afraid I can't help you. :? But if you're just doing rendering for previewing the maps, I think using the lightmaps would be a far better solution, as the OpenGL lighting has some limitations (there's only like 8 of them available?).
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
chacham15
Private
Posts: 7
Joined: Sun Apr 20, 2008 8:00 pm

Post by chacham15 »

So, I realize that you dont know much about OpenGL, but maybe someone who does can help here. I wanted to write some code like the following to draw patches:

glVertexPointer(3, GL_FLOAT,sizeof(BSPVertex), &vertex[0].position);

glClientActiveTextureARB(GL_TEXTURE0_ARB);
glTexCoordPointer(2, GL_FLOAT,sizeof(BSPVertex), &vertex[0].textureCoord);

glClientActiveTextureARB(GL_TEXTURE1_ARB);
glTexCoordPointer(2, GL_FLOAT, sizeof(BSPVertex), &vertex[0].lightmapCoord);

glMultiDrawElementsEXT(GL_TRIANGLE_STRIP, trianglesPerRow.getCArray(),
GL_UNSIGNED_INT, (const void **)(rowIndexes.getCArray()), patch.level);

Is this still possible with all of the extra lighting that needs to be done? If so, how would that be done? (A link to a tutorial or something like that would be really great). So, I dont know much about shaders, but is this what a shader would do?

So the light sources in Mohaa come from the LightMaps lump, the lights listed in the Entities lump, and the lightvol lump. Is that right? Also, are lights somehow included in the BSP tree or are they always rendered?

Im sorry for asking so many questions, but any and all helo you're willing to provide is greatly appreciateed!

-chahcam15
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post by Rookie One.pl »

I wouldn't expect any OpenGL programmers here, this is a mapping/modding forum, not a programming one.

The light info in the entity lump is just a leftover from the compilation and is not used by the game at all.

This means all you have is the lightmaps and the light grid (light volumes). Lightmaps are textures that are mapped onto static geometry (the world - walls, floors etc.) to provide an illusion of lighting, while the light grid is used to illuminate dynamic geometry (e.g. player models, weapons) using Gouraud shading.

If all you want is a simple BSP renderer, you only need to care about the lightmaps.

Currently the problem with using the light grid data is that its format is totally different than Quake III's - it's pretty complex, we still haven't worked it out in OpenMoHAA, but we'll get it right eventually. :)
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
chacham15
Private
Posts: 7
Joined: Sun Apr 20, 2008 8:00 pm

Post by chacham15 »

Ah, that actually helps a lot! Thanks!
Post Reply