Deferred rendering progress
This commit is contained in:
parent
6749552751
commit
2d213340bf
|
@ -50,10 +50,7 @@
|
|||
"id": "lighting",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"id": "receiveShadow",
|
||||
"type": "bool"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "roughness",
|
||||
"type": "float"
|
||||
|
@ -133,10 +130,7 @@
|
|||
"id": "lighting",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"id": "receiveShadow",
|
||||
"type": "bool"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "roughness",
|
||||
"type": "float"
|
||||
|
@ -216,10 +210,7 @@
|
|||
"id": "lighting",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"id": "receiveShadow",
|
||||
"type": "bool"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "roughness",
|
||||
"type": "float"
|
||||
|
@ -299,10 +290,7 @@
|
|||
"id": "lighting",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"id": "receiveShadow",
|
||||
"type": "bool"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "roughness",
|
||||
"type": "float"
|
||||
|
@ -394,10 +382,7 @@
|
|||
"id": "lighting",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"id": "receiveShadow",
|
||||
"type": "bool"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "roughness",
|
||||
"type": "float"
|
||||
|
@ -485,10 +470,7 @@
|
|||
"id": "lighting",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"id": "receiveShadow",
|
||||
"type": "bool"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "roughness",
|
||||
"type": "float"
|
||||
|
@ -575,10 +557,7 @@
|
|||
"id": "lighting",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"id": "receiveShadow",
|
||||
"type": "bool"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "roughness",
|
||||
"type": "float"
|
||||
|
@ -662,10 +641,7 @@
|
|||
"id": "lighting",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"id": "receiveShadow",
|
||||
"type": "bool"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "roughness",
|
||||
"type": "float"
|
||||
|
@ -745,10 +721,7 @@
|
|||
"id": "lighting",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"id": "receiveShadow",
|
||||
"type": "bool"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "roughness",
|
||||
"type": "float"
|
||||
|
@ -840,10 +813,7 @@
|
|||
"id": "lighting",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"id": "receiveShadow",
|
||||
"type": "bool"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "roughness",
|
||||
"type": "float"
|
||||
|
@ -931,10 +901,7 @@
|
|||
"id": "lighting",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"id": "receiveShadow",
|
||||
"type": "bool"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "roughness",
|
||||
"type": "float"
|
||||
|
@ -1021,10 +988,7 @@
|
|||
"id": "lighting",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"id": "receiveShadow",
|
||||
"type": "bool"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "roughness",
|
||||
"type": "float"
|
||||
|
@ -1108,10 +1072,7 @@
|
|||
"id": "lighting",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"id": "receiveShadow",
|
||||
"type": "bool"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "roughness",
|
||||
"type": "float"
|
||||
|
@ -1203,10 +1164,7 @@
|
|||
"id": "lighting",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"id": "receiveShadow",
|
||||
"type": "bool"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "roughness",
|
||||
"type": "float"
|
||||
|
@ -1294,10 +1252,7 @@
|
|||
"id": "lighting",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"id": "receiveShadow",
|
||||
"type": "bool"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "roughness",
|
||||
"type": "float"
|
||||
|
@ -1384,10 +1339,7 @@
|
|||
"id": "lighting",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"id": "receiveShadow",
|
||||
"type": "bool"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "roughness",
|
||||
"type": "float"
|
||||
|
@ -1476,10 +1428,7 @@
|
|||
"id": "lighting",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"id": "receiveShadow",
|
||||
"type": "bool"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "roughness",
|
||||
"type": "float"
|
||||
|
@ -1574,10 +1523,7 @@
|
|||
"id": "lighting",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"id": "receiveShadow",
|
||||
"type": "bool"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "roughness",
|
||||
"type": "float"
|
||||
|
@ -1671,10 +1617,7 @@
|
|||
"id": "lighting",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"id": "receiveShadow",
|
||||
"type": "bool"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "roughness",
|
||||
"type": "float"
|
||||
|
@ -1770,10 +1713,7 @@
|
|||
"id": "lighting",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"id": "receiveShadow",
|
||||
"type": "bool"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "roughness",
|
||||
"type": "float"
|
||||
|
@ -1873,10 +1813,7 @@
|
|||
"id": "lighting",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"id": "receiveShadow",
|
||||
"type": "bool"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "roughness",
|
||||
"type": "float"
|
||||
|
@ -1968,10 +1905,7 @@
|
|||
"id": "lighting",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"id": "receiveShadow",
|
||||
"type": "bool"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "roughness",
|
||||
"type": "float"
|
||||
|
@ -2062,10 +1996,7 @@
|
|||
"id": "lighting",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"id": "receiveShadow",
|
||||
"type": "bool"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "roughness",
|
||||
"type": "float"
|
||||
|
@ -2157,10 +2088,7 @@
|
|||
"id": "lighting",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"id": "receiveShadow",
|
||||
"type": "bool"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "roughness",
|
||||
"type": "float"
|
||||
|
@ -2248,10 +2176,7 @@
|
|||
"id": "lighting",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"id": "receiveShadow",
|
||||
"type": "bool"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "roughness",
|
||||
"type": "float"
|
||||
|
@ -2338,10 +2263,7 @@
|
|||
"id": "lighting",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"id": "receiveShadow",
|
||||
"type": "bool"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "roughness",
|
||||
"type": "float"
|
||||
|
@ -2430,10 +2352,7 @@
|
|||
"id": "lighting",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"id": "receiveShadow",
|
||||
"type": "bool"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "roughness",
|
||||
"type": "float"
|
||||
|
@ -2528,10 +2447,7 @@
|
|||
"id": "lighting",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"id": "receiveShadow",
|
||||
"type": "bool"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "roughness",
|
||||
"type": "float"
|
||||
|
@ -2625,10 +2541,7 @@
|
|||
"id": "lighting",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"id": "receiveShadow",
|
||||
"type": "bool"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "roughness",
|
||||
"type": "float"
|
||||
|
@ -2724,10 +2637,7 @@
|
|||
"id": "lighting",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"id": "receiveShadow",
|
||||
"type": "bool"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "roughness",
|
||||
"type": "float"
|
||||
|
@ -2827,10 +2737,7 @@
|
|||
"id": "lighting",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"id": "receiveShadow",
|
||||
"type": "bool"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "roughness",
|
||||
"type": "float"
|
||||
|
@ -2922,10 +2829,7 @@
|
|||
"id": "lighting",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"id": "receiveShadow",
|
||||
"type": "bool"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "roughness",
|
||||
"type": "float"
|
||||
|
@ -3021,10 +2925,7 @@
|
|||
"id": "lighting",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"id": "receiveShadow",
|
||||
"type": "bool"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "roughness",
|
||||
"type": "float"
|
||||
|
@ -3119,10 +3020,7 @@
|
|||
"id": "lighting",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"id": "receiveShadow",
|
||||
"type": "bool"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "roughness",
|
||||
"type": "float"
|
||||
|
@ -3216,10 +3114,7 @@
|
|||
"id": "lighting",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"id": "receiveShadow",
|
||||
"type": "bool"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "roughness",
|
||||
"type": "float"
|
||||
|
@ -3315,10 +3210,7 @@
|
|||
"id": "lighting",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"id": "receiveShadow",
|
||||
"type": "bool"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "roughness",
|
||||
"type": "float"
|
||||
|
@ -3418,10 +3310,7 @@
|
|||
"id": "lighting",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"id": "receiveShadow",
|
||||
"type": "bool"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "roughness",
|
||||
"type": "float"
|
||||
|
@ -3513,10 +3402,7 @@
|
|||
"id": "lighting",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"id": "receiveShadow",
|
||||
"type": "bool"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "roughness",
|
||||
"type": "float"
|
||||
|
@ -3612,10 +3498,7 @@
|
|||
"id": "lighting",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"id": "receiveShadow",
|
||||
"type": "bool"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "roughness",
|
||||
"type": "float"
|
||||
|
@ -3722,10 +3605,7 @@
|
|||
"id": "lighting",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"id": "receiveShadow",
|
||||
"type": "bool"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "roughness",
|
||||
"type": "float"
|
||||
|
@ -3824,10 +3704,7 @@
|
|||
"id": "lighting",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"id": "receiveShadow",
|
||||
"type": "bool"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "roughness",
|
||||
"type": "float"
|
||||
|
@ -3930,10 +3807,7 @@
|
|||
"id": "lighting",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"id": "receiveShadow",
|
||||
"type": "bool"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "roughness",
|
||||
"type": "float"
|
||||
|
@ -4037,10 +3911,7 @@
|
|||
"id": "lighting",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"id": "receiveShadow",
|
||||
"type": "bool"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "roughness",
|
||||
"type": "float"
|
||||
|
@ -4135,10 +4006,7 @@
|
|||
"id": "lighting",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"id": "receiveShadow",
|
||||
"type": "bool"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "roughness",
|
||||
"type": "float"
|
||||
|
@ -4232,10 +4100,7 @@
|
|||
"id": "lighting",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"id": "receiveShadow",
|
||||
"type": "bool"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "roughness",
|
||||
"type": "float"
|
||||
|
@ -4331,10 +4196,7 @@
|
|||
"id": "lighting",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"id": "receiveShadow",
|
||||
"type": "bool"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "roughness",
|
||||
"type": "float"
|
||||
|
@ -4434,10 +4296,7 @@
|
|||
"id": "lighting",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"id": "receiveShadow",
|
||||
"type": "bool"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "roughness",
|
||||
"type": "float"
|
||||
|
@ -4529,10 +4388,7 @@
|
|||
"id": "lighting",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"id": "receiveShadow",
|
||||
"type": "bool"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "roughness",
|
||||
"type": "float"
|
||||
|
@ -4628,10 +4484,7 @@
|
|||
"id": "lighting",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"id": "receiveShadow",
|
||||
"type": "bool"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "roughness",
|
||||
"type": "float"
|
||||
|
@ -4738,10 +4591,7 @@
|
|||
"id": "lighting",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"id": "receiveShadow",
|
||||
"type": "bool"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "roughness",
|
||||
"type": "float"
|
||||
|
@ -4840,10 +4690,7 @@
|
|||
"id": "lighting",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"id": "receiveShadow",
|
||||
"type": "bool"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "roughness",
|
||||
"type": "float"
|
||||
|
@ -4946,10 +4793,7 @@
|
|||
"id": "lighting",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"id": "receiveShadow",
|
||||
"type": "bool"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "roughness",
|
||||
"type": "float"
|
||||
|
@ -5053,10 +4897,7 @@
|
|||
"id": "lighting",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"id": "receiveShadow",
|
||||
"type": "bool"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "roughness",
|
||||
"type": "float"
|
||||
|
@ -5163,10 +5004,7 @@
|
|||
"id": "lighting",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"id": "receiveShadow",
|
||||
"type": "bool"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "roughness",
|
||||
"type": "float"
|
||||
|
@ -5265,10 +5103,7 @@
|
|||
"id": "lighting",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"id": "receiveShadow",
|
||||
"type": "bool"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "roughness",
|
||||
"type": "float"
|
||||
|
@ -5371,10 +5206,7 @@
|
|||
"id": "lighting",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"id": "receiveShadow",
|
||||
"type": "bool"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "roughness",
|
||||
"type": "float"
|
||||
|
@ -5478,10 +5310,7 @@
|
|||
"id": "lighting",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"id": "receiveShadow",
|
||||
"type": "bool"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "roughness",
|
||||
"type": "float"
|
||||
|
@ -5592,10 +5421,7 @@
|
|||
"id": "lighting",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"id": "receiveShadow",
|
||||
"type": "bool"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "roughness",
|
||||
"type": "float"
|
||||
|
@ -5702,10 +5528,7 @@
|
|||
"id": "lighting",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"id": "receiveShadow",
|
||||
"type": "bool"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "roughness",
|
||||
"type": "float"
|
||||
|
@ -5804,10 +5627,7 @@
|
|||
"id": "lighting",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"id": "receiveShadow",
|
||||
"type": "bool"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "roughness",
|
||||
"type": "float"
|
||||
|
@ -5910,10 +5730,7 @@
|
|||
"id": "lighting",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"id": "receiveShadow",
|
||||
"type": "bool"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "roughness",
|
||||
"type": "float"
|
||||
|
@ -6017,10 +5834,7 @@
|
|||
"id": "lighting",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"id": "receiveShadow",
|
||||
"type": "bool"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "roughness",
|
||||
"type": "float"
|
||||
|
@ -6131,10 +5945,7 @@
|
|||
"id": "lighting",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"id": "receiveShadow",
|
||||
"type": "bool"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "roughness",
|
||||
"type": "float"
|
||||
|
@ -6245,10 +6056,7 @@
|
|||
"id": "lighting",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"id": "receiveShadow",
|
||||
"type": "bool"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "roughness",
|
||||
"type": "float"
|
||||
|
|
|
@ -6,9 +6,20 @@
|
|||
"blend_destination": "blend_zero",
|
||||
"blend_source": "blend_one",
|
||||
"compare_mode": "always",
|
||||
"constants": [],
|
||||
"constants": [
|
||||
{
|
||||
"id": "light",
|
||||
"link": "_lightPosition",
|
||||
"type": "vec3"
|
||||
},
|
||||
{
|
||||
"id": "eye",
|
||||
"link": "_cameraPosition",
|
||||
"type": "vec3"
|
||||
}
|
||||
],
|
||||
"cull_mode": "none",
|
||||
"depth_write": false,
|
||||
"depth_write": true,
|
||||
"fragment_shader": "deferred_pass.frag",
|
||||
"id": "deferred_pass",
|
||||
"texture_units": [
|
||||
|
|
|
@ -19,11 +19,11 @@
|
|||
},
|
||||
{
|
||||
"id": "material_deferred",
|
||||
"shader": "deferred_resource/deferred_pass",
|
||||
"shader": "deferred_pass_resource/deferred_pass",
|
||||
"cast_shadow": true,
|
||||
"contexts": [
|
||||
{
|
||||
"id": "deferred",
|
||||
"id": "deferred_pass",
|
||||
"bind_constants": [],
|
||||
"bind_textures": []
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@
|
|||
},
|
||||
{
|
||||
"command": "draw_quad",
|
||||
"params": ["material_resource", "material_deferred", "deferred"]
|
||||
"params": ["material_resource", "material_deferred", "deferred_pass"]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
41
Sources/Shaders/attrib_pass.frag.glsl
Normal file
41
Sources/Shaders/attrib_pass.frag.glsl
Normal file
|
@ -0,0 +1,41 @@
|
|||
//#extension GL_EXT_draw_buffers : require
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _Texturing
|
||||
uniform sampler2D stex;
|
||||
#endif
|
||||
uniform sampler2D shadowMap;
|
||||
#ifdef _NormalMapping
|
||||
uniform sampler2D normalMap;
|
||||
#endif
|
||||
uniform bool lighting;
|
||||
uniform bool receiveShadow;
|
||||
uniform float roughness;
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragData[0] = vec4(position.xyz, 0);
|
||||
gl_FragData[1] = vec4(normal.xyz, 0);
|
||||
gl_FragData[2] = vec4(normal.xyz, 0);
|
||||
//#ifdef _Texturing
|
||||
//gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0);
|
||||
//#endif
|
||||
}
|
14
Sources/Shaders/deferred_pass.frag.glsl
Normal file
14
Sources/Shaders/deferred_pass.frag.glsl
Normal file
|
@ -0,0 +1,14 @@
|
|||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
uniform sampler2D gbuffer0; // Positions
|
||||
uniform sampler2D gbuffer1; // Normals
|
||||
uniform sampler2D gbuffer2; // Textures
|
||||
|
||||
varying vec2 texCoord;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragColor = vec4(texture2D(gbuffer2, texCoord).rgb, 1.0);
|
||||
}
|
16
Sources/Shaders/deferred_pass.vert.glsl
Normal file
16
Sources/Shaders/deferred_pass.vert.glsl
Normal file
|
@ -0,0 +1,16 @@
|
|||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
attribute vec2 pos;
|
||||
|
||||
varying vec2 texCoord;
|
||||
|
||||
const vec2 madd = vec2(0.5, 0.5);
|
||||
|
||||
void kore() {
|
||||
// Scale vertex attribute to [0-1] range
|
||||
texCoord = pos.xy * madd + madd;
|
||||
|
||||
gl_Position = vec4(pos.xy, 0.0, 1.0);
|
||||
}
|
22
Sources/Shaders/env_map.frag.glsl
Normal file
22
Sources/Shaders/env_map.frag.glsl
Normal file
|
@ -0,0 +1,22 @@
|
|||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#define PI 3.1415926
|
||||
#define TwoPI (2.0 * PI)
|
||||
|
||||
uniform sampler2D envmap;
|
||||
|
||||
varying vec3 wcNormal;
|
||||
|
||||
vec2 envMapEquirect(vec3 wcNormal, float flipEnvMap) {
|
||||
float phi = acos(wcNormal.z);
|
||||
float theta = atan(flipEnvMap * wcNormal.x, wcNormal.y) + PI;
|
||||
return vec2(theta / TwoPI, phi / PI);
|
||||
}
|
||||
|
||||
void kore() {
|
||||
|
||||
vec3 N = normalize(wcNormal);
|
||||
gl_FragColor = texture2D(envmap, envMapEquirect(N, -1.0));
|
||||
}
|
71
Sources/Shaders/env_map.vert.glsl
Normal file
71
Sources/Shaders/env_map.vert.glsl
Normal file
|
@ -0,0 +1,71 @@
|
|||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
|
||||
attribute vec2 pos;
|
||||
|
||||
varying vec3 wcNormal;
|
||||
|
||||
mat4 inverse(mat4 m) {
|
||||
float
|
||||
a00 = m[0][0], a01 = m[0][1], a02 = m[0][2], a03 = m[0][3],
|
||||
a10 = m[1][0], a11 = m[1][1], a12 = m[1][2], a13 = m[1][3],
|
||||
a20 = m[2][0], a21 = m[2][1], a22 = m[2][2], a23 = m[2][3],
|
||||
a30 = m[3][0], a31 = m[3][1], a32 = m[3][2], a33 = m[3][3],
|
||||
|
||||
b00 = a00 * a11 - a01 * a10,
|
||||
b01 = a00 * a12 - a02 * a10,
|
||||
b02 = a00 * a13 - a03 * a10,
|
||||
b03 = a01 * a12 - a02 * a11,
|
||||
b04 = a01 * a13 - a03 * a11,
|
||||
b05 = a02 * a13 - a03 * a12,
|
||||
b06 = a20 * a31 - a21 * a30,
|
||||
b07 = a20 * a32 - a22 * a30,
|
||||
b08 = a20 * a33 - a23 * a30,
|
||||
b09 = a21 * a32 - a22 * a31,
|
||||
b10 = a21 * a33 - a23 * a31,
|
||||
b11 = a22 * a33 - a23 * a32,
|
||||
|
||||
det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;
|
||||
|
||||
return mat4(
|
||||
a11 * b11 - a12 * b10 + a13 * b09,
|
||||
a02 * b10 - a01 * b11 - a03 * b09,
|
||||
a31 * b05 - a32 * b04 + a33 * b03,
|
||||
a22 * b04 - a21 * b05 - a23 * b03,
|
||||
a12 * b08 - a10 * b11 - a13 * b07,
|
||||
a00 * b11 - a02 * b08 + a03 * b07,
|
||||
a32 * b02 - a30 * b05 - a33 * b01,
|
||||
a20 * b05 - a22 * b02 + a23 * b01,
|
||||
a10 * b10 - a11 * b08 + a13 * b06,
|
||||
a01 * b08 - a00 * b10 - a03 * b06,
|
||||
a30 * b04 - a31 * b02 + a33 * b00,
|
||||
a21 * b02 - a20 * b04 - a23 * b00,
|
||||
a11 * b07 - a10 * b09 - a12 * b06,
|
||||
a00 * b09 - a01 * b07 + a02 * b06,
|
||||
a31 * b01 - a30 * b03 - a32 * b00,
|
||||
a20 * b03 - a21 * b01 + a22 * b00) / det;
|
||||
}
|
||||
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
|
||||
void kore() {
|
||||
|
||||
mat4 invP = inverse(P);
|
||||
mat3 invMV = transpose(mat3(V));
|
||||
|
||||
vec4 p = vec4(pos.xy, 0.0, 1.0);
|
||||
|
||||
vec3 unprojected = (invP * p).xyz;
|
||||
|
||||
wcNormal = invMV * unprojected;
|
||||
|
||||
gl_Position = vec4(pos.xy, 0.0, 1.0);
|
||||
}
|
|
@ -98,10 +98,10 @@ float LightingFuncGGX_OPT3(vec3 N, vec3 V, vec3 L, float roughness, float F0) {
|
|||
void kore() {
|
||||
|
||||
float visibility = 1.0;
|
||||
if (receiveShadow && lPos.w > 0.0) {
|
||||
visibility = shadowSimple(lPos);
|
||||
visibility = (visibility * 0.8) + 0.2;
|
||||
}
|
||||
//if (receiveShadow && lPos.w > 0.0) {
|
||||
// visibility = shadowSimple(lPos);
|
||||
// visibility = (visibility * 0.8) + 0.2;
|
||||
//}
|
||||
|
||||
vec4 outColor;
|
||||
vec3 t = pow(matColor.rgb, vec3(2.2));
|
135
Sources/Shaders_/blender.vert.glsl
Normal file
135
Sources/Shaders_/blender.vert.glsl
Normal file
|
@ -0,0 +1,135 @@
|
|||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
#ifdef _NormalMapping
|
||||
attribute vec3 tan;
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
attribute vec4 bone;
|
||||
attribute vec4 weight;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 NM;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
#ifdef _Skinning
|
||||
uniform float skinBones[50 * 12];
|
||||
#endif
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
#ifdef _NormalMapping
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
mat4 getBoneMat(const int boneIndex) {
|
||||
vec4 v0 = vec4(skinBones[boneIndex * 12 + 0],
|
||||
skinBones[boneIndex * 12 + 1],
|
||||
skinBones[boneIndex * 12 + 2],
|
||||
skinBones[boneIndex * 12 + 3]);
|
||||
vec4 v1 = vec4(skinBones[boneIndex * 12 + 4],
|
||||
skinBones[boneIndex * 12 + 5],
|
||||
skinBones[boneIndex * 12 + 6],
|
||||
skinBones[boneIndex * 12 + 7]);
|
||||
vec4 v2 = vec4(skinBones[boneIndex * 12 + 8],
|
||||
skinBones[boneIndex * 12 + 9],
|
||||
skinBones[boneIndex * 12 + 10],
|
||||
skinBones[boneIndex * 12 + 11]);
|
||||
return mat4(v0.x, v0.y, v0.z, v0.w,
|
||||
v1.x, v1.y, v1.z, v1.w,
|
||||
v2.x, v2.y, v2.z, v2.w,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
mat4 getSkinningMat() {
|
||||
return weight.x * getBoneMat(int(bone.x)) +
|
||||
weight.y * getBoneMat(int(bone.y)) +
|
||||
weight.z * getBoneMat(int(bone.z)) +
|
||||
weight.w * getBoneMat(int(bone.w));
|
||||
}
|
||||
|
||||
mat3 getSkinningMatVec(const mat4 skinningMat) {
|
||||
return mat3(skinningMat[0].xyz, skinningMat[1].xyz, skinningMat[2].xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 sPos = (vec4(pos + off, 1.0));
|
||||
#else
|
||||
vec4 sPos = (vec4(pos, 1.0));
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
mat4 skinningMat = getSkinningMat();
|
||||
mat3 skinningMatVec = getSkinningMatVec(skinningMat);
|
||||
sPos = sPos * skinningMat;
|
||||
#endif
|
||||
vec4 mPos = M * sPos;
|
||||
lPos = lightMVP * sPos;
|
||||
|
||||
gl_Position = P * V * mPos;
|
||||
position = mPos.xyz / mPos.w;
|
||||
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
normal = normalize(mat3(NM) * (nor * skinningMatVec));
|
||||
#else
|
||||
normal = normalize(mat3(NM) * nor);
|
||||
#endif
|
||||
|
||||
matColor = diffuseColor;
|
||||
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
vec3 vtan = (tan);
|
||||
vec3 vbitan = cross(normal, vtan) * 1.0;//tangent.w;
|
||||
|
||||
mat3 TBN = transpose(mat3(vtan, vbitan, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#else
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
#endif
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue