Quake3World.com
https://www.quake3world.com/forum/

How to tune vertex light?
https://www.quake3world.com/forum/viewtopic.php?f=10&t=54020
Page 1 of 1

Author:  sst13 [ 10-22-2018 06:31 AM ]
Post subject:  How to tune vertex light?

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!

Author:  sst13 [ 10-26-2018 10:12 AM ]
Post subject:  Re: How to tune vertex light?

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:
//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:

//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

Author:  LDAsh [ 10-26-2018 06:29 PM ]
Post subject:  Re: How to tune vertex light?

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.

Author:  Obsessed [ 10-26-2018 08:51 PM ]
Post subject:  Re: How to tune vertex light?

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:

Author:  sst13 [ 10-28-2018 10:02 AM ]
Post subject:  Re: How to tune vertex light?

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

Author:  Obsessed [ 10-28-2018 11:52 AM ]
Post subject:  Re: How to tune vertex light?

@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? :)

Author:  sst13 [ 10-28-2018 03:51 PM ]
Post subject:  Re: How to tune vertex light?

@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.

Author:  Obsessed [ 10-29-2018 01:53 AM ]
Post subject:  Re: How to tune vertex light?

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

Author:  Hipshot [ 10-29-2018 11:07 AM ]
Post subject:  Re: How to tune vertex light?

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.

Author:  sst13 [ 10-29-2018 05:34 PM ]
Post subject:  Re: How to tune vertex light?

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.

Author:  Obsessed [ 10-29-2018 10:48 PM ]
Post subject:  Re: How to tune vertex light?

@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

Page 1 of 1 All times are UTC - 8 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/