How to tune vertex light?

Discussion for Level editing, modeling, programming, or any of the other technical aspects of Quake
Post Reply
sst13
Posts: 298
Joined: Mon Feb 15, 2010 11:05 pm

How to tune vertex light?

Post by sst13 »

Since I use -dirty a lot in the light compile phase, I ran into a slight problem with the resulting vertex-light.

-dirty makes all the the corners and angles a little bit darker, exactly where most of the vertices sitting around and waiting for some light rays. :D
This leads often to a very dark or uneven vertex-light.

Is there any good way of tune the vertex-light just a little bit?


Things I already tried:

_minvertexlight in the worldspawn: makes the light too flat in the former dark corners. The sens of depth is lost, with high picmip values.
-cpma key during light compile: makes the map way to bright. A mixture between this and the default vertex light would be perfect. If there were a value for the -cpma key to control the thing a little bit, that would be great!
[url=https://sst13.de]Q3A Maps - by sst13[/url]
[url=https://steamcommunity.com/id/_sst13_/myworkshopfiles]Quake Live Workshop[/url]
sst13
Posts: 298
Joined: Mon Feb 15, 2010 11:05 pm

Re: How to tune vertex light?

Post by sst13 »

Ok ladies, I found a very funny way to mix the default vertex light with the -cpma vertex light.

1. I compiled both versions into 2 seperate BSP files (BSP & light stage)
2. turned these 2 BSPs into TGA graphics
3. used a graphic editor to mix these images together
4. turned the resulting TGA graphic back into a BSP file
5. continued to compile the VIS & AAS stage
6. celebrated myself as it worked :D

The results with different mix ratios:
Image

What a BSP looks like as a graphic:
Image




How to do it:

Here are the command lines for compiling the first part: (You may add additional switches and the full paths to your q2map2.exe, bspc.exe, and your mapfiles.)

Code: Select all

//create a second map file
copy "mapname.map" "mapname_cpma.map"

//compile BSP & light with original vertex light
q3map2.exe -meta mapname.map
q3map2.exe -light mapname.bsp
copy "mapname.bsp" "mapname.raw"
del "mapname.bsp"

//compile BSP & light of the second map with cpma vertex light
q3map2.exe -meta mapname_cpma.map
q3map2.exe -light -cpma mapname_cpma.bsp
copy "mapname_cpma.bsp" "mapname_cpma.raw"
del "mapname_cpma.bsp"

//pause for editing the graphic files
pause
You now got 2 *.raw files, you have to import into your graphic editor of choice.
Use the following parameters:

Image widht = 1024
Image height = filesize of the raw file in bytes, divided by 3072. (round up the value) Why 3072? Because 1024 x 3byte per pixel (rgb).
Bits per pixel = 24
Color order = rgb
Interleaved = Yes

If your graphic editor don't support importing *.raw files, you can use https://www.irfanview.com/ for this to create other formats like TGA.

Blend the graphics with the desired ratio.
Then export back into a mapname.raw file with BPP 24, Color order rgb interleaved.


Compiling the second part:

Code: Select all


//continue to compile VIS & AAS stage
copy "mapname.raw" "mapname.bsp"
q3map2.exe -vis mapname.bsp
bspc.exe -optimize -forcesidesvisible -bsp2aas mapname.bsp 
pause

Have fun... sst13
[url=https://sst13.de]Q3A Maps - by sst13[/url]
[url=https://steamcommunity.com/id/_sst13_/myworkshopfiles]Quake Live Workshop[/url]
LDAsh
Posts: 28
Joined: Sat Dec 17, 2016 1:25 pm

Re: How to tune vertex light?

Post by LDAsh »

That's really interesting and good work figuring that out.

I wonder how it would turn out to invert the vertex light and use that to subtract from an enhanced lightmap, to add even more contrast to the visuals. Or maybe to shift hues to give an iridescent quality to everything.
Obsessed
Posts: 112
Joined: Sun Aug 14, 2016 9:02 pm

Re: How to tune vertex light?

Post by Obsessed »

turned these 2 BSPs into TGA graphics
I'm nothing.. :miffed: :disgust: :D

How to tune vertex light?
@sst13, just one question: who still needs this? :question:
sst13
Posts: 298
Joined: Mon Feb 15, 2010 11:05 pm

Re: How to tune vertex light?

Post by sst13 »

Obsessed wrote:just one question: who still needs this? :question:
It's probably not a need of performance anymore, but there are always some "pro-gamer" playing with vertex light + high picmip & other fancy stuff. :D
[url=https://sst13.de]Q3A Maps - by sst13[/url]
[url=https://steamcommunity.com/id/_sst13_/myworkshopfiles]Quake Live Workshop[/url]
Obsessed
Posts: 112
Joined: Sun Aug 14, 2016 9:02 pm

Re: How to tune vertex light?

Post by Obsessed »

@sst13, hmm, may I ask about something different, but similar by it's nature? I've got an error "WARNING: reused image textures/gothic_block/blocks18cgeomtrn2.tga with mixed glWrapClampMode parm" (twice), but: 1) in the game everything is ok, 2) this is an ID's texture/shader and I didn't "reuse" it (the shader). so, I can leave it as is, but my perfectionism pushes me to correct it. :( what could it be? :)
sst13
Posts: 298
Joined: Mon Feb 15, 2010 11:05 pm

Re: How to tune vertex light?

Post by sst13 »

@Obsessed:
This warning occurs when a texture is used in multiple shaders, but using different texture-mapping methodes like map and clampmap.

map tiles the texture infinite.
clampmap produces only a single tile.
[url=https://sst13.de]Q3A Maps - by sst13[/url]
[url=https://steamcommunity.com/id/_sst13_/myworkshopfiles]Quake Live Workshop[/url]
Obsessed
Posts: 112
Joined: Sun Aug 14, 2016 9:02 pm

Re: How to tune vertex light?

Post by Obsessed »

texture is used in multiple shaders, but using different texture-mapping methodes
@sst13, Thank you very much! But what confuses me: I've made a simple box (this is Q3A) with a square brush on the wall, marked it's 1 side with the same texture (blocks18cgeomtrnx.tga - I've just taken it from the "error-map"), and there was no any error message. I just don't know, what did I do to make the error appear and therefore, how to fix it. :D Anyway, if this is a difficult case, I can just leave it as is.

P.S. OMG, I'm already A WARRIOR! :owned: >:D
User avatar
Hipshot
Posts: 1547
Joined: Sun Jan 20, 2002 8:00 am

Re: How to tune vertex light?

Post by Hipshot »

Interesting!

I tend to use vertex these days where I find no use for lightmaps (small things and things that are evenly surfaces), both to speed up compile and reduce the bsp size a bit and you get some performance there too. But I light very differently these days, much more optimized than when I was younger I feel.
Q3Map2 2516 -> http://www.zfight.com/misc/files/q3/q3map_2.5.16_win32_x86.zip
Q3Map2 FS_20g -> http://www.zfight.com/misc/files/q3/q3map2_fs_20g.rar
GtkRadiant 140 -> http://www.zfight.com/misc/files/q3/GtkRadiantSetup-1.4.0-Q3RTCWET.exe
sst13
Posts: 298
Joined: Mon Feb 15, 2010 11:05 pm

Re: How to tune vertex light?

Post by sst13 »

Obsessed wrote:I've made a simple box (this is Q3A) with a square brush on the wall, marked it's 1 side with the same texture (blocks18cgeomtrnx.tga - I've just taken it from the "error-map"), and there was no any error message. I just don't know, what did I do to make the error appear and therefore, how to fix it.
The "blocks18cgeomtrnx" shader is using the "blocks18cgeomtrn2" texture with the default map key.
If you add a shader like "/sfx/healthfloor" to your map, where the same texture is used but with the clampmap key, then the warning occures.
Because Q3 don't know how to handle the texture, tiled or clamped.

If both shader look fine you can ignore this warning. (it's just a warning, not an error)

If you really want to get rid of the warning message, you have to rewrite one of the involved shaders by renaming the shader and changing the map or clampmap key.
[url=https://sst13.de]Q3A Maps - by sst13[/url]
[url=https://steamcommunity.com/id/_sst13_/myworkshopfiles]Quake Live Workshop[/url]
Obsessed
Posts: 112
Joined: Sun Aug 14, 2016 9:02 pm

Re: How to tune vertex light?

Post by Obsessed »

@sst13, Thank you, I'm sure it will help! :) I managed to do everything except "changing the map or clampmap key" in the morning. Yes, I use 2 similar textures/shaders - that one and sfx/spawn_floor. Didn't think that they may conflict. :shrug:

I light very differently these days, much more optimized than when I was younger I feel
I'm just nothing (take #2) :miffed: :D
Post Reply