Hard Light Productions Forums

Modding, Mission Design, and Coding => The Modding Workshop => Topic started by: Vertigo 7 on August 14, 2008, 01:54:50 pm

Title: glow points as light sources
Post by: Vertigo 7 on August 14, 2008, 01:54:50 pm
Is it possible to use a glow point as a light source? like say I wanted to illuminate a name plate by positioning a glow point right above the texture.
Title: Re: glow points as light sources
Post by: Topgun on August 14, 2008, 01:56:57 pm
no.
what you do is add lighting in a 3d app or gimp or photo shop or whatever and bake the lighting to a glow map.
Title: Re: glow points as light sources
Post by: Snail on August 15, 2008, 12:59:23 am
How hard would it be from a coding perspective to make glow points actually emit a source of light? And thrusters?

(I'm assuming someone's going to say "impossibly hard", but it was worth asking)
Title: Re: glow points as light sources
Post by: Vertigo 7 on August 15, 2008, 01:09:06 am
it'd prolly be extremely hard unless the glow point file itself can reference to light intensity... if not PCS would need to be reworked to support it as well as fred/fs
Title: Re: glow points as light sources
Post by: Snail on August 15, 2008, 01:17:08 am
I'd have thought it would be possible, so that it uses a similar system to the way weapons fire casts light. But I'm no coder so I have no idea how it would be done, I'm just throwing around ideas.

I should stick to FREDding...
Title: Re: glow points as light sources
Post by: Droid803 on August 15, 2008, 01:18:34 am
That would make texturing easier :P
Title: Re: glow points as light sources
Post by: Scooby_Doo on August 15, 2008, 01:18:52 am
Also I believe Opengl only allows 9? light sources and they are rather process consuming.
Title: Re: glow points as light sources
Post by: Flipside on August 15, 2008, 01:20:59 am
It's more a question of processing time, each light source adds another layer of computation for texture rendering. OpenGL supports something like 8 active hardware lightsources at one time iirc, which is enough for things like weapons, explosions etc, which are short-lived effects, but would soon run out if glowpoints were light sources.

That's why programs like Unreal Tournament pre-render most of the lighting effects on the levels.

Edit: As Scooby also says :)
Title: Re: glow points as light sources
Post by: Snail on August 15, 2008, 01:26:24 am
Ok... So would it be possible to overlay a lighter texture over an existing hull texture, thus creating the illusion of a light source without actually doing it? Wait... That's a glowmap. D'oh.
Title: Re: glow points as light sources
Post by: Nuke on August 15, 2008, 08:49:26 am
what is needed is a system to toggle on and off light sources based on their visibility to the player. so only the most visible 8 sources are used with hardware lighting. then you combine that with a faster, lower quality lighting effects for things like weapons and whatnot, to fill in the background. so every time you get ready to do lighting computation, a list of sources is sorted by distance from the camera * size higher numbers taking the hardwre lights, and lower numbers either using the software lighting or no lighting at all. the idea is if you fill up the foreground, your eyes are distracted from the lack of lighting in the background.
Title: Re: glow points as light sources
Post by: Getter Robo G on August 15, 2008, 08:29:49 pm
You can fake it with a glow map, have your area with a illuminated spot and put your light source around it at the right angle you want to pretend it's casting it... That's what I did with irfranview, but then again I have no skills... :)
Title: Re: glow points as light sources
Post by: Bobboau on August 15, 2008, 09:16:40 pm
jees, ok here's how FS handles lights, only the max number of supported hardware lights can be used  at a time the max number of lights is not MORE than 8. when  more than this number of lights needs to be drawn what it does is it switches to additive alpha after a pass with the first test and does consecutive sets after that untill all lights are drawn.

strictly speaking adding lights is not too hard and it could be done with justs a few lines of code, but a better way of doing this is to have all the static lights precalculated on a texture (which allows as great of lighting calculation precision as you could ever ask for) and apply this on the first lighting pass. this is what glow maps are.