Commit Graph
50 Commits
Author SHA1 Message Date
Zack Middleton e3abcffeb0 OpenGL2: Fix using merged lightmaps with tcGen environment
tcGen environment generates texcoords in range of 0.0 to 1.0 and they
need to be offset to the position/size in the merged lightmap atlas.

This also needs to be after tcMods so they apply for the original range.
This fixes tcMod scale used by main_q3abanner and shinygrate1_4.

This issue was visible on the blue monitor (comp3c) near the plasmagun
in q3dm0 and the Quake III Arena banner in q3dm17.

Affected shaders in Quake 3 and Team Arena maps:

textures/base_wall/comp3
textures/base_wall/comp3b
textures/base_wall/comp3b_dark
textures/base_wall/comp3c
textures/base_wall/main_q3abanner
textures/base_wall/shinygrate1_4
textures/sfx/teslacoil

All of the shaders are used by q3dm0 but other maps also use some.
2024-02-10 16:23:54 -05:00
Zack Middleton eaefa35580 OpenGL2: Fix merged lightmap hacks to have real lightmap index
This fixes the texcoord range to be 0.0 to 1.0 for external lightmaps in
shaders that also have an internal lightmap. (Instead of 2.0 to 3.0 for
example.) This only affects clampMap as repeating wrapping sampled the
correct location. I haven't found such a shader but I need to get real
lightmap index for future merged lightmap hacks.
2024-02-10 16:23:54 -05:00
Zack Middleton b07ff2a3ca OpenGL2: Fix parsing q3gl2_sun without two additional tokens
If mapLightScale and shadowScale weren't included at the end of
q3gl2_sun, the next shader line was skipped by SkipRestOfLine().

COM_ParseExt() with allowLineBreaks=qfalse, returns "" once and
then goes to the next line anyway. (Doesn't work well multiple
"optional" tokens. It looks like a vanilla bug.)
2023-12-23 14:31:47 -05:00
Zack Middleton ae0878ca61 OpenGL2: Fix q3map2 lightstyles effects
Fixes World of Padman wop_trashmap.

For r_mergeLightmaps 1
- Fix tcMod transform on "map $lightmap" stages
- Fix external lightmap image texcoords if shader also has an internal
  lightmap

For r_sunlightMode 1
- Fix "tcGen lightmap" stages with blendFunc GL_SRC_ALPHA GL_ONE being
  converted to white image + modulate lightmap and drawing incorrectly
2023-12-23 14:31:47 -05:00
Zack Middleton 42d2fb908c OpenGL2: Fix parsing specularScale in shaders
Fix specularScale <metallic> <smoothness> with r_pbr 1 which has been
broken since r_pbr was implemented in 2016.

Fix specularScale <r> <g> <b> <gloss> setting b to gloss and leaving
gloss as 0 since it was implemented in 2014.
2018-05-11 23:18:39 -05:00
Zack Middleton 00c3480938 OpenGL2: Fix crash when BSP has deluxe maps and vertex lit surfaces
Reported by Mickaël Thomas (mickael9).
2018-02-18 13:05:27 -06:00
Zack Middleton 3d6aa05694 OpenGL2: Fix dark lightmap on shader in mpteam6
Team Arena's mpteam6 map has a shader textures/base_wall2/space_concrete
that contains an opaque stage, two non-lightmap blendfunc filter stages,
a blendfunc add stage, and a lightmap stage. The lightmap was attached
to all four of the non-lightmap stages causing the filter stages to
darken the lightmap multiple times.

Change setting up the lightall GLSL shader to only use lightmap if it's
the first stage or not a blendfunc filter stage. Now only the opaque
and blendfunc add stages of the mpteam6 shader use the lightmap.

Reported by Alexander Nadeau (wareya).
2018-02-04 14:34:17 -06:00
Edward Betts fe42b8653d Correct spelling mistakes. 2017-11-22 01:40:20 -06:00
Zack Middleton e62941396d Remove unused imgFlag_t value IMGFLAG_SRGB 2017-07-30 15:39:32 -05:00
SmileTheory d549b642bc OpenGL2: Use an OpenGL 3.2 core context if available. 2017-07-13 12:03:10 -07:00
Zack Middleton 4dffc52c1d Add warnings for animMap and videoMap shader keywords 2017-07-02 17:00:07 -05:00
SmileTheory ffcec94f50 OpenGL2: Load images with "_nh" suffix as parallax normalmaps. 2016-10-27 02:10:40 -07:00
SmileTheory 8749d62bbd OpenGL2: Remove per fragment tangent space calculation code. 2016-09-14 03:57:51 -07:00
SmileTheory 4faf1008a0 OpenGL2: Remove map color scaling and r_forceSunMapLightScale.
Also simplify overbright code in ComputeShaderColors().
2016-09-14 02:59:54 -07:00
SmileTheory ad952b9537 OpenGL2: Merge several cvars into r_pbr.
r_glossIsRoughness, r_specularIsMetallic, r_framebufferGamma, r_tonemapGamma, r_materialGamma, r_lightGamma
2016-02-01 21:37:23 -08:00
SmileTheory b52ede0445 OpenGL2: Add r_glossIsRoughness. 2015-12-08 21:23:50 -08:00
SmileTheory 2954bdfa65 OpenGL2: automatically load textures with a _s suffix as specular. 2015-12-02 17:08:40 -08:00
Zack Middleton 5e575ae82e Apply greyscaling to fog blocks 2015-07-04 19:17:58 -05:00
Ensiform 43c7f1e734 Inform how many shader stages the max is in the warning message 2015-01-26 02:39:59 -06:00
SmileTheory b1821e303d OpenGL2: remove lightmap support from generic glsl shader.
This path was barely used and doing this compiles fewer shaders.
2014-11-10 21:59:37 -08:00
Zack Middleton 918eed9295 OpenGL2: Don't segfault if r_ext_multitexture is disabled 2014-09-29 01:02:13 -05:00
Zack Middleton a955d975b7 Add function for clearing global shader instead of duplicating the code 2014-09-27 01:35:35 -05:00
Tim Angus 6665ea4a49 Fix renderergl2 warnings 2014-09-01 11:35:49 +01:00
Zack Middleton e5f54c584a Fix incorrect rgbGen const reading uninitialized memory
If ParseVector fails, color isn't fully set.
2014-08-27 20:35:16 -05:00
Zack Middleton eeeaf3f125 Fix potential buffer overflow caused by long tcMod args
Found by Coverity.
2014-05-25 18:44:17 -05:00
Zack Middleton 9c99cf29db Have OpenGL2 "map $lightmap" check for NULL tr.lightmaps too
Zero length lightmap lump will have NULL tr.lightmaps.

OpenGL1 already has this check, because r_vertexLight 1
would crash Team Arena. OpenGL2 does not disable loading lightmaps
when r_vertexLight is 1 though, so it does not have that issue.
2014-05-25 18:41:57 -05:00
SmileTheory 4fe69cb418 OpenGL2: Remove sRGB support, replace with gamma cvars. 2014-04-16 05:26:03 -07:00
Zack Middleton 07290a7d52 Fix typo in animMap and videoMap warnings 2014-03-10 19:58:55 -05:00
MAN-AT-ARMS 11ed883298 OpenGL2: Set default normal/specular in RE_RegisterShaderFromImage 2014-03-04 20:31:31 -05:00
SmileTheory ee67d0a981 OpenGL2: Add normalScale and parallaxDepth stage keywords and helper cvars. 2014-03-03 21:02:39 -08:00
SmileTheory bc2efc4870 #6077: OpenGL2: Add r_ignoreDstAlpha. 2013-12-17 04:08:25 -08:00
SmileTheory 6e5f8cc918 OpenGL2: Calculate bitangent in shader, and store normal/tangent as normalized byte arrays. 2013-11-12 19:21:51 -08:00
SmileTheory 3846c115e6 OpenGL2: Reduce glsl shader count by using a uniform to disable textures. 2013-11-03 19:34:22 -08:00
SmileTheory 08fcecc829 OpenGL2: Clean up texmod calculations, and improve vertex animation handling. 2013-10-14 01:55:54 -07:00
SmileTheory f8355ba2fb OpenGL2: Fix TCGEN_ENVIRONMENT stages not rendering correctly. 2013-10-10 03:41:31 -07:00
SmileTheory acbeca6042 OpenGL2: Remove AGEN_FRESNEL(superceded by cubemap patch), and some small fixes and optimizations. 2013-09-24 03:29:49 -07:00
SmileTheory 7e875c6941 #5979: Cubemap support for opengl2. 2013-09-16 00:54:26 -07:00
SmileTheory d46916082d #5999: OpenGL2: Don't use lightall shader with deforms or adjustColorsForFog. 2013-08-23 01:35:17 -07:00
SmileTheory ebd164deaf #6004: OpenGL2: Make any CGEN_LIGHTING_DIFFUSE stages use lightall shader. 2013-08-23 00:55:28 -07:00
Zack Middleton d4f785c465 Improve warning for shader missing opening brace 2013-06-02 21:59:01 -05:00
Zack Middleton 3ec2b02dce Check for shaders without closing brace
Shaders without closing brace can eat shaders in other files.
Pass depth to SkipBracedSection instead of reparsing text as it messed up parse line numbers.
2013-06-02 21:55:19 -05:00
Zack Middleton eb73dcb7f4 Catch more bad shader syntax cases
Use to only ignore file in cases where both { and \0 were missing after shader name. Now ignore file when either are missing, such as "}\0".
2013-05-30 22:58:58 -05:00
SmileTheory 8270d54a25 Don't scale shadow multipliers by overbrightbits, and improve documentation. 2013-04-22 21:52:16 -07:00
SmileTheory 6a763f0671 Merge branch 'HEAD' of https://github.com/ioquake/ioq3.git into suntest 2013-04-02 00:18:24 -07:00
SmileTheory 28e14c4546 Add sunlight/lightmap merging by multiply (r_sunlightMode 1)
Merge additive sunlight and map lighting into one GLSL shader (r_sunlightMode 2)
Change single lightmap blends to use lightall
2013-04-02 00:17:24 -07:00
Tim Angus 98360bcd57 Fix some of the things clang --analyze flagged 2013-03-26 16:50:03 +00:00
SmileTheory e14a814ba2 Support more tcgens in lightall shader. 2013-03-14 23:11:27 -07:00
SmileTheory 9eef320c91 Remove some more automatic sRGB image flags. 2013-03-12 22:00:51 -07:00
SmileTheory e6e0d47099 Fix clampmapped images being always treated as sRGB. 2013-03-07 14:23:28 -08:00
Tim Angus f6fb9eb602 renderer -> renderergl1, rend2 -> renderergl2 2013-02-15 23:46:37 +00:00