Light shader on model

Discussion for Level editing, modeling, programming, or any of the other technical aspects of Quake
Post Reply
dave-0
Posts: 18
Joined: Thu Dec 31, 2009 9:39 pm

Light shader on model

Post 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. :rolleyes:

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 ?)
Last edited by AEon on Fri Jan 01, 2010 6:49 pm, edited 2 times in total.
Reason: Placed you code in a [code] block, to help us better read it.
obsidian
Posts: 10970
Joined: Mon Feb 04, 2002 8:00 am

Re: Light shader on model

Post 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.
[size=85][url=http://gtkradiant.com]GtkRadiant[/url] | [url=http://q3map2.robotrenegade.com]Q3Map2[/url] | [url=http://q3map2.robotrenegade.com/docs/shader_manual/]Shader Manual[/url][/size]
dave-0
Posts: 18
Joined: Thu Dec 31, 2009 9:39 pm

Re: Light shader on model

Post 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.
rgoer
Posts: 798
Joined: Sun Aug 17, 2003 7:00 am

Re: Light shader on model

Post by rgoer »

or just put a light entity (or string of light entities) inside it
dave-0
Posts: 18
Joined: Thu Dec 31, 2009 9:39 pm

Re: Light shader on model

Post 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 ? :/
:dork:
fKd
Posts: 2478
Joined: Sat Jun 03, 2006 2:54 am
Location: Wellington
Contact:

Re: Light shader on model

Post 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...
obsidian
Posts: 10970
Joined: Mon Feb 04, 2002 8:00 am

Re: Light shader on model

Post 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.
[size=85][url=http://gtkradiant.com]GtkRadiant[/url] | [url=http://q3map2.robotrenegade.com]Q3Map2[/url] | [url=http://q3map2.robotrenegade.com/docs/shader_manual/]Shader Manual[/url][/size]
dave-0
Posts: 18
Joined: Thu Dec 31, 2009 9:39 pm

Re: Light shader on model

Post by dave-0 »

Thanks Obsidian, fkd, I will work on that :)
dave-0
Posts: 18
Joined: Thu Dec 31, 2009 9:39 pm

Re: Light shader on model

Post 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 :D 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.
dave-0
Posts: 18
Joined: Thu Dec 31, 2009 9:39 pm

Re: Light shader on model

Post by dave-0 »

ok, all works :)
Thanks for the help :)
nothing spectacular, but here's a shot:
turbine.jpg
Post Reply