Commit Graph

43 Commits

Author SHA1 Message Date
deve
d5e30ee41e Port also other shaders to use #stk_include 2016-06-27 13:11:27 +02:00
Vincent Lejeune
1732b1cfef Clean up sunlight shader + factorize diffusebrdf 2014-12-14 21:39:18 +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
Vincent Lejeune
fd2da4085b Rename some shader to improve their meaning 2014-12-05 00:20:16 +01:00
Vincent Lejeune
547018f0ab Port PointLight shader 2014-08-22 00:30:14 +02:00
Vincent Lejeune
58c094917e Use an header included in every shaders. 2014-08-02 00:50:56 +02:00
Stephen Just
f4992b80fc Fix errors when compiling shaders with UBOs disabled 2014-05-19 09:57:31 -06:00
vlj
883b39591f Width and height are passed by UBO 2014-05-17 02:39:55 +02:00
Vincent Lejeune
96babc81ad Reenable custom light radius 2014-05-12 19:37:00 +02:00
Vincent Lejeune
d316263660 Tweak light extent again to improve perf 2014-05-05 01:46:57 +02:00
vlj
35df307c3f Tweak light extend. 2014-05-03 23:44:27 +02:00
vlj
2a1623d8ca Use a more efficient screen to view conversion
Also use the opportunity to use UBO where possible.
2014-05-02 18:11:34 +02:00
Vincent Lejeune
18aa119890 Tweak light attenuation.
Doesnt really change the look of the light but reduce their extent.
2014-04-27 18:31:00 +02:00
vlj
c695875654 PointLight: Use a 1/(1 + d + k d^2) attenuation
This is not physically accurate, but a 1/d^2 attenuation makes light
extend too broad, and went too high if close from the source.
2014-04-19 02:04:39 +02:00
vlj
e00ce85d7c Support FresnelSchlick factor. 2014-04-07 21:35:10 +02:00
vlj
79c6424703 Use specularmap as glossiness map. 2014-04-07 21:35:09 +02:00
vlj
cafc07680a Use Blinn Phong model. 2014-04-07 21:35:09 +02:00
Vincent Lejeune
01b88fde9d Factorize DecodeNormal from misc shaders. 2014-03-21 18:17:21 +01:00
Vincent Lejeune
740c251808 Use Instancing for lights. 2014-03-14 16:51:06 +01:00
Vincent Lejeune
af862cb6c5 #version autoadded to shaders and turn some v120 2014-02-28 17:29:05 +01:00
Vincent Lejeune
0243546e4d Use an openGL 3.3 compatibility context when available. 2014-02-12 22:16:10 +01:00
Vincent Lejeune
f50e6f817d Use another normal encoding method from a crytek slide. 2014-01-27 23:29:46 +01:00
Vincent Lejeune
1c98cf0b61 Normalize normals when they are used to get more precision 2014-01-27 22:31:01 +01:00
Vincent Lejeune
5e68334ce9 PointLight: Use depthbuffer 2014-01-27 20:22:01 +01:00
Vincent Lejeune
b94f8f0c18 Light: Factorize some code. 2014-01-22 22:22:54 +01:00
Vincent Lejeune
859be83074 Explicitly define fragment exported values. 2014-01-19 19:31:00 +01:00
Vincent Lejeune
fb6649eaad texture2D is deprecated, use texture instead 2014-01-19 18:53:35 +01:00
vincentlj
23d0b42b5f Light: Simplify slightly shader
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@15069 178a84e3-b1eb-0310-8ba1-8eac791a3b58
2014-01-14 01:24:28 +00:00
vincentlj
fa068d7810 OGL32CTX: Ask #version 130 for all our shaders
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@14919 178a84e3-b1eb-0310-8ba1-8eac791a3b58
2014-01-05 00:08:00 +00:00
vincentlj
a2d1a86bac Lights: Make possible for gpu drivers to unroll loop.
GPU doesn't like indirect addressing and thus it's better to have unrolled loop. This is only possible for loop with a static iteration count.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@14830 178a84e3-b1eb-0310-8ba1-8eac791a3b58
2013-12-29 18:37:45 +00:00
vincentlj
6d0e6a67b2 PointLight:Fix shader arithmetic type mismatch reported by mesa
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@14813 178a84e3-b1eb-0310-8ba1-8eac791a3b58
2013-12-27 17:03:02 +00:00
samuncle
cb21815054 Improved the specularity by adding a little offset to the energy
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@14805 178a84e3-b1eb-0310-8ba1-8eac791a3b58
2013-12-27 02:41:58 +00:00
vincentlj
30a030bd4c Light: Pseudo sort lights distance using bucket to evict them fast.
Lower max light level to 16 as it proves sufficient.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@14801 178a84e3-b1eb-0310-8ba1-8eac791a3b58
2013-12-27 00:34:41 +00:00
vincentlj
4d0b9236b2 Lights: improve bandwidth usage
It should improve performance a lot, but it handles at most 32 simultaneous lights on screen.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@14800 178a84e3-b1eb-0310-8ba1-8eac791a3b58
2013-12-26 22:55:15 +00:00
vincentlj
5512a72d62 Lights: Remove hard edge and attenuate specular
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@14796 178a84e3-b1eb-0310-8ba1-8eac791a3b58
2013-12-26 18:00:54 +00:00
vincentlj
c9b8734717 Plug-in energy parameter into pointlight shader
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@14779 178a84e3-b1eb-0310-8ba1-8eac791a3b58
2013-12-24 23:07:42 +00:00
vincentlj
65b32757f3 Separate Diffuse and Specular components
This allows to bypass alpha test, and have colored specular lights.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@14777 178a84e3-b1eb-0310-8ba1-8eac791a3b58
2013-12-24 20:51:53 +00:00
vincentlj
5f23483bd9 Fix some shaders not building with mesa
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@14775 178a84e3-b1eb-0310-8ba1-8eac791a3b58
2013-12-24 02:47:33 +00:00
vincentlj
88ac0ba6cf Attempt to mimic blender light behavior.
The attenuation assumes a power distributed on the whole sphere surface.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@14769 178a84e3-b1eb-0310-8ba1-8eac791a3b58
2013-12-24 01:44:40 +00:00
vincentlj
34d83859cd Add support for specular light
Note that specular light is applied unconditionnaly, thus every object will shine.
TODO : Specular map should be defined using texture or a material flag.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@14756 178a84e3-b1eb-0310-8ba1-8eac791a3b58
2013-12-23 17:00:34 +00:00
vincentlj
45db87de8a Merge normals and depth RTT into a single one
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@14754 178a84e3-b1eb-0310-8ba1-8eac791a3b58
2013-12-23 16:59:55 +00:00
auria
118705f19a Apply patch by Vlj to put normals in eyespace coordinates and reenable normal mapping, thanks!
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@14737 178a84e3-b1eb-0310-8ba1-8eac791a3b58
2013-12-19 00:13:17 +00:00
auria
5899a26aad Merge cand's graphical improvements branch!! There are many known issues folks, so don't cry victory just now, this is just the beginning. Especially, shadows do not work correctly at this time
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@14590 178a84e3-b1eb-0310-8ba1-8eac791a3b58
2013-11-30 21:33:06 +00:00