Page 1 of 1
Light shader on model
Posted: Thu Dec 31, 2009 9:47 pm
by dave-0
Hi all.
I haven't posted here in a very long time, I made a map way back in 2005 and posted it here with the account name "Kali1900"
Anyway, forgot the email/pw for that account
I have a question about getting a light shader to work on a model, and I've been making my eyes bleed trying to find the answer in the Q3A shader manual or in one of the model lamp shaders. I'm still a noob to mapping

after almost 5 years I decided to install Q3/radiant/3dsmax at work and oh dear, I'm at it again.
Heres what I have:
Code: Select all
models/mapobjects/lamp745
{
q3map_lightimage models/mapobjects/lamp745/li.tga
// this TGA is the source for the color of the blended light
q3map_surfacelight 10000
//emitted light value of 10,000
{
map $lightmap
//source texture is affected by the lightmap
rgbGen identity
// this command handles the overbright bits created by "sunlight"
// in the game
}
{
map models/mapobjects/lamp745/tex.tga
blendFunc filter
rgbGen identity
}
{
map models/mapobjects/lamp745/li.tga
blendFunc add
}
}
The whole model should glow, I'll figure out how to nail it to a specific spot later (probably have to split it up or can u use an alpha to make a specific part of a model emit light ?)
Re: Light shader on model
Posted: Fri Jan 01, 2010 6:00 pm
by obsidian
For models, I would recommend NOT using light emitting shaders. Just manually place a point light next to the lamp in the editor.
If the model is reasonably small in dimensions, I would recommend skipping the lightmap stage and just have the model vertex lit. Better performance and if there is a relatively high poly density, it'll look better too.
I also recommend you stick your custom models in your own subdirectory, models/mapobjects/daveo/
Try this:
Code: Select all
models/mapobjects/daveo/lamp745
{
{
map models/mapobjects/daveo/lamp745/tex.tga
rgbGen vertex
}
{
map models/mapobjects/daveo/lamp745/li.tga
blendFunc add
}
}
You can either break the model up and assign different shaders or use a mask depending on what you want to do. A lot of Q3 light models have separate sections, one for the lamp fixture and another for the actual glow, each with its own shader. A lot of other mapobjects like teleporter models will have glowing bits that are just pulsating additive blend textures in the shader.
Re: Light shader on model
Posted: Tue Jan 05, 2010 12:00 am
by dave-0
Thanks Obsidian
I'll probably just place 4 lights around the model, I tried it with one and it looked pretty bad, as its a cylindrical light (duh!)
Or I may just apply an existing light shader to a cylindrical brush and place inside the model, deleting that part of the model.
Re: Light shader on model
Posted: Tue Jan 05, 2010 12:51 am
by rgoer
or just put a light entity (or string of light entities) inside it
Re: Light shader on model
Posted: Wed Jan 20, 2010 11:52 pm
by dave-0
That didn't work for some reason, first thing I did was place a light inside and it blacked out, I probably didn't compile the md3 properly.
Anyway I have another dumb question !
I have a model that has a rotating part and realized too late that mapobject models can't have animations ? :/

Re: Light shader on model
Posted: Thu Jan 21, 2010 12:10 am
by fKd
need to use the command to stop the model from casting shadows so the light can pass through it... not sure what the tag is...
Re: Light shader on model
Posted: Thu Jan 21, 2010 1:33 am
by obsidian
_castshadows or _cs with a value of 0.
Mapobjects can't have animations but func_entities (like func_rotating) can have a model assigned to it.
You will need a nodraw brush with an origin brush going through it. Convert that to a func_rotating. Then select the func_rotating and then the model and hit CTRL+K to make the func_rotating target the model. In game, the model should rotate with the func_rotating entity.
Re: Light shader on model
Posted: Thu Jan 21, 2010 12:52 pm
by dave-0
Thanks Obsidian, fkd, I will work on that

Re: Light shader on model
Posted: Thu Jan 21, 2010 5:19 pm
by dave-0
Ok, works great! I have the model directly referenced in the func_rotating with the model2 key and it all displays and rotates exactly where I want it perfectly

sweet. (manually setting the origin, I couldn't get an origin brush to work) but now the texture doesn't work :/
if I place the same model in the map statically the texture works fine ... hrm.
I'm doing it wrong aren't I :/ I need to set _cs 0 on the model ... darn. thats why the texture isn't there.
Re: Light shader on model
Posted: Thu Jan 21, 2010 6:02 pm
by dave-0
ok, all works

Thanks for the help

nothing spectacular, but here's a shot:
turbine.jpg