How to Create a Surface LIght

Discussion for Level editing, modeling, programming, or any of the other technical aspects of Quake
Post Reply
Syber Raith
Posts: 4
Joined: Sun Feb 26, 2017 5:39 pm

How to Create a Surface LIght

Post by Syber Raith »

I have been trying for a week now to make a custom surface light shader with GTKRadiant 1.6.5.

I have noticed that surface light shaders such as textures/base_light/ceil_white5k from pak0.pak work just fine. However, when I try to make a surface light that follows the same patteren it just failes to emit light and only shows up as a regular, non-light emitting, texture.

For example here is the shader for textures/base_light/ceil_white5k:

textures/base_light/ceil_white5k as extracted from pak0.pak:

textures/base_light/ceil_white5k
{
qer_editorimage textures/base_light/ceil1_38.tga
surfaceparm nomarks
q3map_surfacelight 5000
{
map $lightmap
rgbGen identity
}
{
map textures/base_light/ceil1_38.tga
blendFunc GL_DST_COLOR GL_ZERO
rgbGen identity
}
{
map textures/base_light/ceil1_38.blend.tga
blendfunc GL_ONE GL_ONE
}
}

Now if I even copy that one verbatim changing only the paths to the shader text and image files, all I get is a regular texture displayed on a non-light emitting brush.

Here's a screen shot from Wolfcam it does the same thing in ioquake of a brush covered with a copy of the above shader extracted from the pk0.pak given a different name and put into the base sripts and texture folders.

As you can see the texture shows up fine although there is an absence of any emitted light from the surface of the brush to illuminate the small room I have it in.

Any help would be appreciated.

BTW Wolfcam seems to lack or has misplaced the shaders for the machine gun muzzle flash and model blood splater when being hit. Anybody know what they are called?
cityy
Posts: 1020
Joined: Mon Aug 10, 2009 8:23 am

Re: How to Create a Surface LIght

Post by cityy »

Have you added your new shaderfile to the shaderlist?
Also you will be looking for q3map_lightsubdivide sooner or later.
www.ferdinandlist.de/leveldesign
User avatar
CZghost
Posts: 1943
Joined: Wed Jun 22, 2011 1:45 pm
Location: Czechia
Contact:

Re: How to Create a Surface LIght

Post by CZghost »

cityy wrote:Have you added your new shaderfile to the shaderlist?
Also you will be looking for q3map_lightsubdivide sooner or later.
Lol you've been quicker :D

Another thought: Always make sure that every path in your shaders in entire shader file is actually correct. One incorrect path may result in entire shader file corruption (which may also trigger next, otherwise good shaders appear missing, breaking entire game). Check also syntax correctness of your shaders. This one looks fine from screenshot.

Is that Quake Live or Quake III Arena? Why are you using Wolfcam? You need to use Wolfcam for neighter of these games anymore. Quake Live supports for custom maps additions now and Quake III Arena is already custom additions friendly. Looks like you're missing crosshair from screenshot...
[ Linktree | Twitch | YouTube | Instagram | Websites ]
When you feel the worst, turn to the sun and all the shadows will fall behind you.” - John Lennon
Syber Raith
Posts: 4
Joined: Sun Feb 26, 2017 5:39 pm

Re: How to Create a Surface LIght

Post by Syber Raith »

I'm using Wolfcam because it was suggested somewhere. I've figured out could just as well use ioquake which is Q3 Area, I just have to set radiant to the other engine path.

All my paths are correct as far as I can tell. Basically I using a text book example. The only differrence between mine and the one in the pak0 is file location. I believe I have the paths correct because the engine can find the texture. I have other shaders I've written in my custom shader file which is listed in shaders.txt and they work.

So, I'm at a loss to explain why the surfacelight keyword is apparently being ignored in my custom shaders.

Here's the one that fails to work:

textures/custom/custom_white_light
{
qer_editorimage textures/custom/ceil1_38.tga
q3map_surfacelight 5000
{
map $lightmap
rgbGen identity
}
{
map textures/custom/ceil1_38.tga
blendFunc GL_DST_COLOR GL_ZERO
rgbGen identity
}
{
map textures/custom/ceil1_38.blend.tga
blendfunc GL_ONE GL_ONE
}
}

This is the one in the screenshot. It's a simple copy except for file location. By the way I want the marks so I took that line out.
User avatar
CZghost
Posts: 1943
Joined: Wed Jun 22, 2011 1:45 pm
Location: Czechia
Contact:

Re: How to Create a Surface LIght

Post by CZghost »

And did you actually include that shader file in your shaderlist? Light emitting is generated by q3map2 compiler. If q3map2 doesn't see your shader file in shaderlist, it doesn't load it to consider it while compiling. That includes also for lighting stage, which is highly important in this case. So q3map2 just sees it like an ordinary texture without any effects, so it doesn't enlight the area...
[ Linktree | Twitch | YouTube | Instagram | Websites ]
When you feel the worst, turn to the sun and all the shadows will fall behind you.” - John Lennon
Syber Raith
Posts: 4
Joined: Sun Feb 26, 2017 5:39 pm

Re: How to Create a Surface LIght

Post by Syber Raith »

That sounds like what's happening. Although my custom.shader file is included in shaderlist.txt and other shaders in that file work. I said shader.txt before, but that's what I meant shaderlist.txt.

Is there another shaderlist for q3map2?

***

I just tried compiling and running the map with NetRadiant instead of GTKRadiant and it works. The problem must be either the command GtkRadiant is sending to q3map2 or in the version of q3map2 the my install of GtkRadiant provided. Man, did I ever stress myself out for days over that.

NetRadiant has a paticularly nasty bug in it on my system in that if I minimize the window it locks up my whole editor--keyboard and screen.
I have to restart explorer.exe from the taskmanager to get going again. I wonder what that's about.

Anyway at least the lights are on... :cool:
User avatar
CZghost
Posts: 1943
Joined: Wed Jun 22, 2011 1:45 pm
Location: Czechia
Contact:

Re: How to Create a Surface LIght

Post by CZghost »

It should work with GtkRadiant's q3map2. NetRadiant uses somewhat modified version of q3map2, though. If your GtkRadiant q3map2 (original) version doesn't accept the shader file, then something must be wrong in it. There are two shaderlists in the scripts folder: default_shaderlist.txt and shaderlist.txt - but the default_shaderlist.txt is used only once when the ordinary shaderlist.txt file is missing at the time of first usage of GtkRadiant, that ordinary file is then created from the default one. q3map2 uses only that one ordinary shaderlist. Didn't you make a typo in the shaderlist.txt (or didn't saved the shader file with typo)? You must write exactly the same shader filename in the shaderlist as you saved it. So namely your shader file is named syber3dm1.shader, so you have to write syber3dm1 in your shaderlist. That's very important...
[ Linktree | Twitch | YouTube | Instagram | Websites ]
When you feel the worst, turn to the sun and all the shadows will fall behind you.” - John Lennon
obsidian
Posts: 10970
Joined: Mon Feb 04, 2002 8:00 am

Re: How to Create a Surface LIght

Post by obsidian »

Try a test case with something like rgbGen const ( 1 0 0 ) on a single stage. Does the image show up red?

If not, then Q3 and Q3Map2 do not see your shader file and the engine is defaulting to the raw texture only. If yes, then Q3 is correctly using your shader but Q3Map2 does not.

Also check your compiler logs for errors.

Lastly, if you have a fairly bright light with the intention of having a fairly high backsplash, you probably don't need a lightmap for that shader since it'll be fullbright anyway.
[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]
Syber Raith
Posts: 4
Joined: Sun Feb 26, 2017 5:39 pm

Re: How to Create a Surface LIght

Post by Syber Raith »

I'm fairly sure it's the latter case. Since I wrote other shaders that use rgbGen wave to do things, it was just the q3map2 surfacelight key word that seemed to be getting ignored. NetRadiant worked on the same files in the same engine folder.

I tried coping the version of q3map2 from the NetRadiant folder to the GtkRadiant folder although that failed to help. So it might be one of the other components, q3data or something else. I'm still destressing about it. When I unwind enough I might try to track down the exact component that is the problem.

I had originally wanted to create a white ceiling across the entire room as the light source in the room. After i got it working I found that that really failed to work out as I had imagined anyway. So I went back to using light entities under a white texture on the ceiling. That accomplished the effect I wanted, just less elegantly.
User avatar
CZghost
Posts: 1943
Joined: Wed Jun 22, 2011 1:45 pm
Location: Czechia
Contact:

Re: How to Create a Surface LIght

Post by CZghost »

At least you finally managed to get your light working :D

I really don't know what's wrong with your GtkRadiant installation. Are you using the latest build (1.6.4)? NetRadiant is made up from GtkRadiant 1.5 and I'm afraid it's not further supported and developed. GtkRadiant is. If you don't have latest GtkRadiant version, try it up instead of NetRadiant...
[ Linktree | Twitch | YouTube | Instagram | Websites ]
When you feel the worst, turn to the sun and all the shadows will fall behind you.” - John Lennon
obsidian
Posts: 10970
Joined: Mon Feb 04, 2002 8:00 am

Re: How to Create a Surface LIght

Post by obsidian »

When compiling, are you using the 32-bit or 64-bit version of Q3Map2? Could you try using the other one and report back whether or not it works?
[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]
Post Reply