New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
renderer: fix vertex lighting with terrain blending and with non-style lightmap with tcGen lightmap #1026
Conversation
In thunder map, terrain blending was already working with vertex lighting, but the two stages are opaque: textures/thunder_custom/ter_rocksand_xy
{
qer_editorImage textures/thunder_custom_src/ter_rocksand_p
q3map_nonplanar
q3map_shadeAngle 90
q3map_tcGen ivector ( 256 0 0 ) ( 0 256 0 )
q3map_alphaMod dotproduct2 ( 0 0 .75 )
{
diffuseMap textures/shared_pk02_src/rock01_d
normalMap textures/shared_pk02_src/rock01_n
specularMap textures/shared_pk02_src/rock01_s
rgbGen identity
}
{
diffuseMap textures/shared_pk02_src/sand01_d
normalMap textures/shared_pk02_src/sand01_n
specularMap textures/shared_pk02_src/sand01_s
blendFunc blend
alphaGen vertex
}
} In station15, terrain blending was broken with vertex lighting, as one of the stage is not opaque and the code was resetting the alpha channel: textures/station15_custom/ter_mudmoss1
{
qer_editorImage textures/station15_custom_src/ter_mudmoss1_p
q3map_nonplanar
q3map_shadeangle 120
q3map_tcGen ivector ( 256 0 0 ) ( 0 256 0 )
q3map_alphaMod dotproduct2 ( 0 0 .75 )
{
diffuseMap textures/station15_custom_src/ter_moss1_d
rgbGen identity
}
{
diffuseMap textures/station15_custom_src/ter_mud1_d
blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
alphaFunc GE128
rgbGen identity
alphaGen vertex
}
} Here is how it now works: I don't see anymore any problem with other maps, example here with rusty (before/after) that was the map I was used when testing vertex lighting and then when I wrote that original code: I also tested other maps like wolf:et oasis wich is known to do complex mixed lightmap/vertex ligthing and I see no regression when enabling vertex lighting or light mapping. Scenes used to debug:
|
54f7e15
to
e711df6
Compare
… similar debug cvars
… with useless “tcGen lightmap”
I added a commit making a difference between a light style map and a light map with useless “tcGen lightmap”. This fixes #1027: I verified this don't break light styled maps like gloom2 and pulse. Before, after: |
56516a8
to
fb20a05
Compare
fb20a05
to
1593e25
Compare
LGTM |
I guess I've set that value after some trial and error to workaround what I didn't knew was a bug, but I fixed that bug later.
In the current state of the renderer, I don't see bugs popping when removing that part, and this is needed to fix terrain blending.
I also added a commit fixing some bad spacing that was mistakenly merged.