Commit Graph

830 Commits

Author SHA1 Message Date
Deve
bc6ff38b22 Simplify light factor when advanced lighting is disabled.
In this case only diffuseMatColor really matters, other values are constant.

It improves performance on GLES renderer and it's also noticeably faster for GL on desktop.
For example:
- fps increased for me from 60 to 69 on Hacienda with intel HD 4000
- from 43 to 49 on lighthouse

There is much less difference on nvidia graphics card, but still it gives small performance improvement.
2017-08-06 22:18:18 +02:00
Deve
d44802a482 Add a workaround for some qualcomm devices on android 4.4 2017-07-11 00:37:31 +02:00
Benau
8653d410f8 Option 1 for fixing android 4.4
Reinit vertex attribute pointer each time, performance may hurt
2017-07-09 00:46:42 +08:00
Deve
af98b526d6 Give few more fps in GLES renderer by pre-computing diffuse/specular color 2017-03-28 22:15:33 +02:00
Deve
a7f0d3762c Some fixes for GLES renderer.
- Don't use BGRA format at all. It doesn't work with non-typical cases (i.e. with srgb or compressed textures) and also casues artifacts on some android devices. I kept the extension in central settings, but it probably won't be used.
- Use sRGB texture format when advanced lighting is enabled. This makes it closer to the original OpenGL renderer and also avoids to have even more #ifdef's for sRGB conversions.
- Keep RGBA textures for non-advanced lighting to make it simpler.

Now advanced lighting in GLES looks almost the same as in OpenGL 3.x (without shadows/GI)
2017-03-25 22:23:46 +01:00
Sam
97670ed23c Improved wind effect for vegetation 2017-03-12 21:35:48 +01:00
Deve
adfa8f30f9 Better fix for missing transparency in GLES legacy pipeline 2017-03-08 23:17:03 +01:00
Deve
11024569b0 More tweaks to GLES legacy pipeline 2017-03-02 22:19:10 +01:00
deve
82e724c12e One more fix for GLES legacy pipeline 2017-02-27 06:41:26 +01:00
Deve
40fe3585bb One more fix for legacy pipeline in GLES renderer.
It looks that the second texture is not used at all and it may cause a crash, so just disable it.
2017-02-27 00:58:43 +01:00
Benau
c635e8d1c4 Get rid of some srgb conversion in shader, see #2787 2017-02-13 10:06:35 +08:00
Deve
68a99fd38b Fixed sRGB for GLES renderer.
It's a bit ugly solution because we should handle it properly in one place and not add another sRGB correction... But it's already working solution and it doesn't affect the OpenGL renderer, so we can use it until better fix will be done.
Now the GLES renderer looks almost the same as the original OpenGL 3.x one :)
2017-02-11 23:56:44 +01:00
Deve
5df2531a65 Added a hack that removes ugly lines when shadows are enabled.
Mathematically it's not 100% correct, but it looks much better.
2017-02-07 21:48:50 +01:00
Deve
28d85d7ba3 Use explicit attrib location when the extension is available.
It allows to enable it easily in GLES renderer. And we check if this extension is available anyway because it's needed for shadows, so we can use it for other shaders too.
2017-02-01 21:58:10 +01:00
samuncle
e86e146442 Add emit map to a shader, so cars in candela are like small dots 2017-01-20 00:06:35 -05:00
samuncle
b9dd867c86 Use gamma corrected decal 2017-01-14 09:41:29 -05:00
Deve
6a16f23132 Fixed GLES 2016-12-31 03:41:37 +01:00
samuncle
b669382b93 Change the detail map to a more usefull decal shader. Now we can add easily details to texture 2016-12-28 10:23:07 -05:00
Deve
424b62552e Fixed MLAA in GLES renderer.
This function was used by Cand for his OpenGL 2.1 renderer. The round function is available since GLSL 1.3 (OpenGL 3.0), so there is no need to override it.
If it will be needed in future, I suggest to change the name to round_stk or something similar.
2016-12-23 15:12:16 +01:00
Benau
15d6c7207a Minor improvements for non-instanced shaders 2016-12-23 19:22:30 +08:00
Benau
d932451295 Don't out a interpolated color change
It will should be determined by colorization mask in fragment shader
2016-12-23 11:38:32 +08:00
Benau
f7e2122b79 Allow drawing instanced glow color without explicit location 2016-12-23 10:36:35 +08:00
Benau
8008ec851e Allow to use hardware skinning with opengl 3.1
Now we only need UBO to store the joint matrices to support it
2016-12-23 01:31:13 +08:00
Benau
4f2e2331ee Correct the spelling of shader files 2016-12-18 14:59:37 +08:00
Benau
752d847b09 Add the remaining shaders for GL3 hardware skinning
Also use the same shader code for normal map shader
2016-12-15 15:55:14 +08:00
Benau
a696fd6dff Add transparent skinned mesh shader 2016-12-15 09:52:02 +08:00
Benau
85bd8c3146 Add unlit and normal map skinned mesh shader
Also fix normal map with skinned mesh, now vertices and joints
will be recalculated for tangents mesh
2016-12-14 16:28:37 +08:00
Benau
e9b68a8a1f Use a non-hardcoded values for mat4 array (max 1024)
Also cull mesh that doesn't have enough space to be rendered
2016-12-11 15:50:53 +08:00
Benau
8ca0c54bdc Merge remote-tracking branch 'origin/master' into hardware_skinning 2016-12-10 10:09:30 +08:00
samuncle
ae0b1136f5 better shader for underwater vegetation 2016-12-09 11:38:56 -05:00
Benau
c68492f42b Use a for loop for four bones (thanks leyyin suggestion!) 2016-12-09 23:21:41 +08:00
Benau
94f6d09bf5 Allow indirect and azdo shadow rendering for skinned mesh 2016-12-09 22:37:17 +08:00
Benau
76e070b709 Allow GL3 to have hardware skinning 2016-12-09 18:41:13 +08:00
Benau
b7e047b4c1 Avoid using else if in skinning vertex shader 2016-12-09 14:16:30 +08:00
Benau
57d9e83ed4 First version of hardware skinning
Todo: shadow, non-instanced shaders, culling, changeable offset...
2016-12-07 02:15:11 +08:00
Benau
ed43d16a1c Allow alpha test shader to be colorizable 2016-12-04 13:21:39 +08:00
Benau
7d5f786da8 Make grass shader colorizable 2016-12-04 00:59:09 +08:00
Benau
4261a96d06 Fix inconsistency between grass shader and the instanced version
1. Assign the missing depth stencil texture (dtex)

2. Correct the movement and color
2016-12-03 15:54:59 +08:00
Benau
acf0ac909f And a correct ifdef for bindless texture 2016-11-30 15:00:08 +08:00
Benau
9e8fb63dc4 Fix AZDO with colorization
Also re-arrange texture layer
2016-11-30 13:52:06 +08:00
Benau
5884d7b9d8 Avoid using matrix4 calculation 2016-11-28 15:44:14 +08:00
Benau
45c5b0ffd6 Improved colorization in instanced rendering 2016-11-28 13:08:27 +08:00
Benau
decf3b9715 4 bindless textures + texture translation + colorization in vao 2016-11-28 10:47:14 +08:00
Benau
60908c3e1d Try to use vec2 for texture translation only
In stk, only setTextureTranslate is used which modify 8,9 of
matrix array. Also don't update it when it is identity.
2016-11-28 10:41:27 +08:00
Benau
2f0252be98 Merge remote-tracking branch 'origin/master' into renderer_refactoring 2016-10-28 21:41:49 +08:00
deve
5502fa4ebe Declare custom alpha also when bindless sampler is enabled 2016-10-17 08:23:27 +02:00
Benau
af223ddf24 Try to use sun color to determine custom alpha for ghost karts
This may need more adjustments, also add custom_alpha uniform float
to transparent fragment shader to remove duplicated shader
2016-10-17 01:03:10 +08:00
Benau
23a1b08efe Allow normal map karts to be used in ghost race
Also split ghost karts out of additive shader, so fixed issues like
"drivers are facing backwards", "water in abyss affects ghost karts"

Todo: maybe transparency depend on current track color?
2016-10-16 15:40:40 +08:00
Deve
3a9b2b9872 Fixed advanced lighting on android 2016-09-12 21:43:31 +02:00
deve
5abc047b0c Declare precision also in vertex shaders in GLES renderer.
Some drivers complain that it was declared only in fragment shaders.
2016-08-26 10:35:48 +02:00
Elderme
41cd1e0364 merged with master 2016-08-18 22:36:19 +02:00
Deve
bd6ad544cc Fixed bloom with scale_rtts_factor parameter. 2016-08-15 08:46:02 +02:00
Elderme
cd1b9a66a0 Merged master in branch 2016-07-26 21:31:52 +02:00
Benau
8408a7c158 Merge remote-tracking branch 'origin/master' into colorful_track_object 2016-07-15 09:27:59 +08:00
Benau
53374176ad First try to support colorization texture mask 2016-07-15 00:53:22 +08:00
Deve
886382bb54 Merge remote-tracking branch 'origin/master' into gles 2016-07-11 23:43:10 +02:00
Deve
0f7976e5f8 Merge branch 'master' into gles 2016-07-11 23:23:02 +02:00
Deve
f1effe3208 Revert "Fixed a grass being too dark in some places."
This reverts commit 2b734a9579.
2016-07-09 02:20:06 +02:00
Deve
2b734a9579 Fixed a grass being too dark in some places.
It seems to be an inconsistency in using sRGB rendering.
2016-07-07 01:52:22 +02:00
Deve
04d3bfb9a1 Restore previous version of object pass shader.
This one doesn't have sense at all. We should make sure that uniforms are always initialized in c++ code.
2016-07-05 01:10:53 +02:00
Deve
9ceab23c5f Apply ssao fix from master 2016-06-30 00:50:33 +02:00
Deve
0fb119068b Fixes in more shaders 2016-06-28 21:55:51 +02:00
Benau
22e5c0909c Allow setting color without copying the mesh 2016-06-28 14:55:48 +08:00
Deve
bf54626815 Added missing file 2016-06-27 23:06:48 +02:00
deve
964baad705 Some fixes 2016-06-27 13:39:20 +02:00
deve
d5e30ee41e Port also other shaders to use #stk_include 2016-06-27 13:11:27 +02:00
Benau
892bc490f7 Make shaders run as efficient as possible 2016-06-27 13:49:27 +08:00
Deve
f679078e75 Port some basic shaders to use #stk_include.
Already working race with disabled advanced lighting :)
2016-06-26 16:39:34 +02:00
Benau
8bae12e080 Fix potential warning 2016-06-26 15:52:47 +08:00
Benau
b467d0819d Add a missed shader 2016-06-26 07:16:07 +08:00
Benau
416050a923 Use a more simple way to render red/blue karts 2016-06-26 07:14:11 +08:00
Deve
ce8a1c4e1b Already working GUI in shader-based pipeline 2016-06-25 15:10:53 +02:00
Elderme
80713ec019 Fixed glow color issue when GL_ARB_draw_indirect extension is not available 2016-06-25 14:55:51 +02:00
Benau
2f217fd55b Allow render red or blue karts in soccer mode using shader 2016-06-25 16:29:54 +08:00
Deve
d13716a917 Initial linux version.
Currently works only with irrlicht-based renderer because shaders are not ported yet.
2016-06-24 02:47:13 +02:00
Elderme
b359e8f9fd Merged with master, solved conflicts 2016-06-18 19:28:54 +02:00
Deve
cc92ee6ef3 One more tweak in SSAO.
Just use mod(x, 6.283185307179586) as suggested by mesa developer, instead converting it to degrees and back to radians.
2016-05-26 11:48:57 +02:00
Deve
cee0de3af3 Fixed a bug in my previous commit.
I forgot that sin and cos functions want angle value in radians.
Now the code looks a bit ugly, but generates proper values.
2016-05-26 02:39:35 +02:00
Deve
cdae595724 Fixed SSAO on intel.
In ssao.frag we are computing theta valaue and it looks that intel driver doesn't like too big values for sinus and cosinus computations.

I just used modulo 360 to store lower angle values in theta variable.
2016-05-25 23:16:01 +02:00
Deve
58f7424b4f Add a workaround for skybox.
The problem was with shader-based pipeline with disabled "advanced effects" in options.

In this case we don't use RTTs and gl_FragCoord contains values in range of whole window. So fo 2 players we still get gl_FragCoord.y = 0..window_size instead of gl_FragCoord.y = 0..window_size/2.

The easiest way to solve it seems to be modulo it by current viewport size. It should be compatible with advanced pipeline as well as single-player games.

Atm. I'm not sure if this should be applied to 0.9.2 branch. It should work fine, but needs some testing.
2016-05-08 21:39:50 +02:00
Deve
62ea873373 Fixed compute shaders on mesa.
It was reporting an error:
[error  ] GLWrap: Error in shader gaussian6h.comp
[error  ] GLWrap: 0:77(1): error: storage qualifiers must come after precise, invariant, interpolation, layout and auxiliary storage qualifiers
2016-05-03 21:48:21 +02:00
Deve
8a288f05ff Implement lightning effect using shaders 2015-10-31 01:00:48 +01:00
Elderme
0fc3d3336e removed useless varying in rhpassthrough.geom shader 2015-10-05 21:22:22 +02:00
samuncle
26298e9e1a Add several new particle effect and correct the bug to enable emit map & alpha testing 2015-09-29 20:08:56 +02:00
Elderme
0b748634ae Removed calls to resizeBox for nitro emitter 2015-08-13 18:15:34 +02:00
Elderme
01c8b25cb6 When the particles position is computed, the position of the emitter in both current and previous frames is now taken into account. There is no more visual artifact when the particles velocity and emitter velocity are not aligned (for example with nitro particles when a kart is skidding) 2015-08-13 14:53:45 +02:00
samuncle
9087d0f837 Increase the strenght of the lens dust 2015-07-27 02:00:34 +02:00
samuncle
1ca6339589 Add color to the lens dust 2015-07-26 05:30:29 +02:00
samuncle
51bd87d303 ground work for lens dust 2015-07-26 04:48:29 +02:00
samuncle
d95f9d844d put into comment the blue lens flare if we need in the future 2015-07-26 01:51:28 +02:00
samuncle
12b1ea5a6c Turn on color for lens flare 2015-07-26 01:46:19 +02:00
hiker
4d6a9726b6 Renamed shader. 2015-05-21 16:37:59 +10:00
hiker
dc8361b941 Fixed spelling of shader. 2015-05-21 11:19:40 +10:00
hiker
52017e31ea Removed unused shader. 2015-05-19 16:36:24 +10:00
hiker
e337b72789 Moved *Detailed* shader into render_geometry, renamed all detailled
to detailed.
2015-05-11 17:17:08 +10:00
hiker
d09f6d3c7a Revert "Clean bloomblending since it's not used anymore"
This reverts commit 2206f8ad5c.

Conflicts:

	src/graphics/post_processing.cpp
2015-03-16 08:49:36 +11:00
hiker
d9375c9a43 Revert 65cb55add4 (Make bloom less
pixelated using Intel doc) since it causes crashes on hd3000.
2015-03-16 08:37:59 +11:00
auriamg
cb5670c843 Merge pull request #1994 from Flakebi/credits
Fix transparency of fallback characters
2015-02-28 19:00:45 -05:00
Deve
988f5ea933 Hopefully proper fix for #2007 2015-02-26 20:16:39 +01:00
Vincent Lejeune
26b38a3afe GodRay use correct screencoord 2015-02-24 22:29:31 +01:00
Vincent Lejeune
419b96c068 Do not use extra uv for mlaa 2015-02-24 22:08:49 +01:00
Vincent Lejeune
bcffedc186 Start working on proper SDSM 2015-02-23 22:35:53 +01:00
Vincent Lejeune
2206f8ad5c Clean bloomblending since it's not used anymore 2015-02-23 22:11:57 +01:00
Vincent Lejeune
06f0188a5b Fix passthrough shader
It was not using half coordinate center
2015-02-23 22:02:32 +01:00
Vincent Lejeune
65cb55add4 Make bloom less pixelated using Intel doc 2015-02-23 21:41:22 +01:00
Vincent Lejeune
13a2f9f597 First part of #1988 fix 2015-02-22 20:31:14 +01:00
Flakebi
a371338c14 Fix transparency of fallback characters 2015-02-21 18:06:27 +01:00
Vincent Lejeune
9641380171 Fix billboard transparency 2015-02-19 00:44:21 +01:00
Vincent Lejeune
56f1dff65d Split scattering function in ambiant/point light part
This fix #1913
2015-01-24 20:00:04 +01:00
Vincent Lejeune
73a20508ef Remove unused shaders 2015-01-17 02:49:48 +01:00
Vincent Lejeune
f22cf2a05e Use a fullscreen pass for skybox 2015-01-15 20:50:19 +01:00
Vincent Lejeune
70e8b4c854 When there are 8 lod level, 7 is the max 2015-01-15 19:52:48 +01:00
Vincent Lejeune
08cb4b4297 Fix tangent/bitangent computation
Shouldn't make any difference since we don't rescale that much
2015-01-12 23:01:35 +01:00
Vincent Lejeune
cfbbeef441 Clamp lod level in SSAO shader later. 2015-01-12 22:47:53 +01:00
Vincent Lejeune
95e2213b1e SSAO can me 0 sometimes 2015-01-12 20:13:11 +01:00
Vincent Lejeune
b8ab68b31a Fix precision issue in SSAO 2015-01-12 20:05:40 +01:00
Vincent Lejeune
3bcdc04279 Fix precision issue in CIE/RGB conversions 2015-01-12 20:05:16 +01:00
Vincent Lejeune
019ec344fe Allow to reduce shadow resolution 2015-01-11 00:45:38 +01:00
Vincent Lejeune
cc43861896 Tangent/Bitangent direction only matters. 2015-01-07 21:51:23 +01:00
Vincent Lejeune
3451d4e9a0 Add a ESM/PCF switch 2015-01-01 20:06:34 +01:00
Vincent Lejeune
883ab43e29 Assume __VERSION >= 130 everywhere 2015-01-01 03:18:13 +01:00
Vincent Lejeune
d8b3cf9c8f Factorise MRP 2014-12-27 03:22:06 +01:00
Vincent Lejeune
e42cdc5d64 Used #ifndef in header.txt 2014-12-27 03:21:55 +01:00
samuncle
c54fed411f Merge branch 'master' of https://github.com/supertuxkart/stk-code 2014-12-21 09:58:06 +01:00
samuncle
b54ddb9828 Add emit map to object pass 2 shader 2014-12-21 09:58:03 +01:00
Vincent Lejeune
c4e5a720f7 Do not undefine builtin macros. 2014-12-18 22:09:14 +01:00
Vincent Lejeune
84cf087ae6 Forget to update grass pass 2 sun location 2014-12-16 02:10:26 +01:00
Vincent Lejeune
7aa7e2d148 Factorise sun color/position 2014-12-15 23:09:19 +01:00
Vincent Lejeune
03694d9c7c Factorise SH coefficient in an UBO 2014-12-15 00:18:03 +01:00
Vincent Lejeune
4b2abef56c Remove redondant uniform in IBL 2014-12-14 21:55:15 +01:00
Vincent Lejeune
1732b1cfef Clean up sunlight shader + factorize diffusebrdf 2014-12-14 21:39:18 +01:00
Vincent Lejeune
d50dde4c97 Revert "Try to fix ibl precision issue"
This reverts commit 1cf592394b.
2014-12-14 02:48:47 +01:00
Vincent Lejeune
1cf592394b Try to fix ibl precision issue 2014-12-13 22:35:46 +01:00
Vincent Lejeune
7872bc7860 Fix image format for bilateral blur 2014-12-13 22:28:16 +01:00
Vincent Lejeune
1c05d9ef68 Port colored lines too 2014-12-11 01:44:58 +01:00
Vincent Lejeune
db6600a687 Frustrum shader is updated to new system 2014-12-11 01:19:17 +01:00
samuncle
cb8017cae1 clamping values to avoid pink specularity 2014-12-10 03:02:36 +01:00
Vincent Lejeune
a8ce996047 Revert "Simplify sunlight shadow shader."
This reverts commit cc7f95163c.
2014-12-09 21:20:55 +01:00
Vincent Lejeune
cc7f95163c Simplify sunlight shadow shader. 2014-12-09 19:00:21 +01:00
Vincent Lejeune
c91c04c862 Same for shadow blur pass 2014-12-09 18:54:27 +01:00
Vincent Lejeune
b24fd621a5 Precompute coefficient in gaussian blur pass 2014-12-09 18:43:48 +01:00
Vincent Lejeune
d97b9f2d0e Clamp SpecularIBL value on positive range 2014-12-09 01:33:58 +01:00
Vincent Lejeune
2667791621 Tweak IBL 2014-12-08 19:36:23 +01:00
Vincent Lejeune
72fdf816e7 Fix Importance sampling 2014-12-08 19:16:26 +01:00
Vincent Lejeune
2b0680d92d Use texture buffer instead of uniform for samples
Should fix nvidia glsl error
2014-12-08 18:24:43 +01:00
Vincent Lejeune
6041c48fbe Source DiffuseIBL algorithm 2014-12-07 21:37:16 +01:00
Vincent Lejeune
a320eebece Cleanup tonemap shader 2014-12-07 21:27:26 +01:00
Vincent Lejeune
a094bbae19 Factorize DiffuseIBL and SpecularIBL 2014-12-07 19:10:22 +01:00
Vincent Lejeune
e491422bdc Weight sample in importance sampling 2014-12-07 18:26:51 +01:00
Vincent Lejeune
1e2656dc88 Use clamp instead of max(0, dot(normalized, normalized))
Should help GLSL compiler to optimize them.
2014-12-05 17:51:18 +01:00