Panagiotis Christopoulos Charitos 16 ani în urmă
părinte
comite
0eed03adbb

+ 0 - 23
bs_bp_volfog.glsl

@@ -1,23 +0,0 @@
-#pragma anki vert_shader_begins
-
-void main()
-{
-	gl_Position = ftransform();
-}
-
-#pragma anki frag_shader_begins
-
-#pragma anki include "shaders/linear_depth.glsl"
-
-uniform sampler2D ms_depth_fai;
-
-void main()
-{
-	vec2 tex_coords_ = gl_FragCoord.xy*vec2( 1.0/R_W, 1.0/R_H );
-	
-	float depth_exp_ = texture2D( ms_depth_fai, tex_coords_ ).r;
-	if( depth_exp_ == 1 ) discard;
-	
-	float depth_ = LinearizeDepth( depth_exp_, 0.1, 10.0 );
-	gl_FragColor = vec4( depth_ );
-}

+ 0 - 14
dbg.glsl

@@ -1,14 +0,0 @@
-#pragma anki vert_shader_begins
-
-void main()
-{
-	gl_Position = ftransform();
-	gl_FrontColor = gl_Color;
-}
-
-#pragma anki frag_shader_begins
-
-void main()
-{
-	gl_FragData[0].rgb = gl_Color.rgb;
-}

+ 0 - 1
dp.glsl

@@ -1 +0,0 @@
-#pragma anki include "shaders/dp_generic.glsl"

+ 0 - 35
dp_generic.glsl

@@ -1,35 +0,0 @@
-#pragma anki vert_shader_begins
-
-varying vec2 tex_coords;
-
-void main()
-{
-	#if defined( _GRASS_LIKE_ )
-		tex_coords = gl_MultiTexCoord0.xy;
-	#endif
-
-	#if defined( _HW_SKINNING_ )
-		mat3 _rot;
-		vec3 _tsl;
-
-		HWSkinning( _rot, _tsl );
-		
-		vec3 pos_lspace = ( _rot * gl_Vertex.xyz) + _tsl;
-		gl_Position =  gl_ModelViewProjectionMatrix * vec4(pos_lspace, 1.0);
-	#else
-	  gl_Position = ftransform();
-	#endif
-}
-
-#pragma anki frag_shader_begins
-
-uniform sampler2D diffuse_map;
-varying vec2 tex_coords;
-
-void main()
-{
-	#if defined( _GRASS_LIKE_ )
-		vec4 _diff = texture2D( diffuse_map, tex_coords );
-		if( _diff.a == 0.0 ) discard;
-	#endif
-}

+ 0 - 3
dp_grass.glsl

@@ -1,3 +0,0 @@
-#define _GRASS_LIKE_
-
-#pragma anki include "shaders/dp_generic.glsl"

+ 0 - 10
dp_hw_skinning.glsl

@@ -1,10 +0,0 @@
-#define _HW_SKINNING_
-
-#pragma anki uniform skinning_rotations 0
-#pragma anki uniform skinning_translations 1
-#pragma anki attribute vert_weight_bones_num 0
-#pragma anki attribute vert_weight_bone_ids 1
-#pragma anki attribute vert_weight_weights 2
-
-#pragma anki include "shaders/hw_skinning.glsl"
-#pragma anki include "shaders/dp_generic.glsl"

+ 0 - 17
final.glsl

@@ -1,17 +0,0 @@
-#pragma anki vert_shader_begins
-
-#pragma anki inlcude "shaders/simple_vert.glsl"
-
-#pragma anki frag_shader_begins
-
-#pragma anki uniform raster_image 0
-uniform sampler2D raster_image;
-varying vec2 tex_coords;
-
-void main()
-{
-	//if( gl_FragCoord.x > 0.5 ) discard;
-
-	gl_FragColor.rgb = texture2D( raster_image, tex_coords ).rgb;
-	//gl_FragColor.rgb = gl_FragCoord.xyz;
-}

+ 0 - 26
hw_skinning.glsl

@@ -1,26 +0,0 @@
-
-// hardware skinning data
-attribute float vert_weight_bones_num;
-attribute vec4  vert_weight_bone_ids;
-attribute vec4  vert_weight_weights;
-
-const int MAX_BONES_PER_MESH = 60;
-
-uniform mat3 skinning_rotations[ MAX_BONES_PER_MESH ];
-uniform vec3 skinning_translations[ MAX_BONES_PER_MESH ];
-
-
-void HWSkinning( out mat3 _rot, out vec3 _tsl )
-{
-	_rot = mat3( 0.0 );
-	_tsl = vec3( 0.0 );
-
-	for( int i=0; i<int(vert_weight_bones_num); i++ )
-	{
-		int bone_id = int( vert_weight_bone_ids[i] );
-		float weight = vert_weight_weights[i];
-
-		_rot += skinning_rotations[bone_id] * weight;
-		_tsl += skinning_translations[bone_id] * weight;
-	}
-}

+ 0 - 16
is_ap.glsl

@@ -1,16 +0,0 @@
-#pragma anki vert_shader_begins
-
-#pragma anki include "shaders/simple_vert.glsl"
-
-#pragma anki frag_shader_begins
-
-#pragma anki uniform ambient_color 0
-uniform vec3 ambient_color;
-#pragma anki uniform ms_diffuse_fai 1
-uniform sampler2D ms_diffuse_fai;
-varying vec2 tex_coords;
-
-void main()
-{
-	gl_FragData[0].rgb = texture2D( ms_diffuse_fai, tex_coords ).rgb * ambient_color;
-}

+ 0 - 288
is_lp_generic.glsl

@@ -1,288 +0,0 @@
-#pragma anki vert_shader_begins
-
-#pragma anki attribute view_vector 0
-attribute vec3 view_vector;
-varying vec2 tex_coords;
-varying vec3 vpos;
-
-void main()
-{
-	vpos = view_vector;
-	vec2 vert_pos = gl_Vertex.xy; // the vert coords are {1.0,1.0}, {0.0,1.0}, {0.0,0.0}, {1.0,0.0}
-	tex_coords = vert_pos;
-	vec2 vert_pos_ndc = vert_pos*2.0 - 1.0;
-	gl_Position = vec4( vert_pos_ndc, 0.0, 1.0 );
-}
-
-
-#pragma anki frag_shader_begins
-
-#pragma anki include "shaders/pack.glsl"
-
-#pragma anki uniform ms_normal_fai 0
-#pragma anki uniform ms_diffuse_fai 1
-#pragma anki uniform ms_specular_fai 2
-#pragma anki uniform ms_depth_fai 3
-uniform sampler2D ms_normal_fai, ms_diffuse_fai, ms_specular_fai, ms_depth_fai;
-#pragma anki uniform planes 4
-uniform vec2 planes; // for the calculation of frag pos in view space
-uniform sampler2D light_tex;
-uniform sampler2DShadow shadow_map;
-
-varying vec2 tex_coords;
-varying vec3 vpos; // for the calculation of frag pos in view space
-
-
-/*
-=======================================================================================================================================
-FragPosVSpace                                                                                                                         =
-return frag pos in view space                                                                                                         =
-=======================================================================================================================================
-*/
-vec3 FragPosVSpace()
-{
-	float _depth = texture2D( ms_depth_fai, tex_coords ).r;
-
-	if( _depth == 1.0 ) discard;
-
-	vec3 _frag_pos_vspace;
-	vec3 _vposn = normalize(vpos);
-	_frag_pos_vspace.z = -planes.y/(planes.x+_depth);
-	_frag_pos_vspace.xy = _vposn.xy/_vposn.z*_frag_pos_vspace.z;
-	return _frag_pos_vspace;
-}
-
-
-/*
-=======================================================================================================================================
-Attenuation                                                                                                                           =
-return the attenuation factor fiven the distance from the frag to the light source                                                    =
-=======================================================================================================================================
-*/
-float Attenuation( in float _frag_light_dist )
-{
-	float _inv_light_radius = gl_LightSource[0].position.w;
-	return clamp(1.0 - _inv_light_radius * sqrt(_frag_light_dist), 0.0, 1.0);
-	//return 1.0 - _frag_light_dist * _inv_light_radius;
-}
-
-
-/*
-=======================================================================================================================================
-PCF                                                                                                                                   =
-it returns a blured shadow                                                                                                            =
-=======================================================================================================================================
-*/
-#if defined(_SPOT_LIGHT_) && defined( _SHADOW_ )
-
-float PCF_Off( in vec3 _shadow_uv )
-{
-	return shadow2D(shadow_map, _shadow_uv ).r;
-}
-
-
-float PCF_Low( in vec3 _shadow_uv )
-{
-	float _shadow_col = shadow2D(shadow_map, _shadow_uv ).r;
-	const float _map_scale = 1.0 / SHADOWMAP_SIZE;
-
-	_shadow_col += shadow2D(shadow_map, _shadow_uv.xyz + vec3( _map_scale,  _map_scale, 0.0)).r;
-	_shadow_col += shadow2D(shadow_map, _shadow_uv.xyz + vec3( _map_scale, -_map_scale, 0.0)).r;
-	_shadow_col += shadow2D(shadow_map, _shadow_uv.xyz + vec3( _map_scale,         0.0, 0.0)).r;
-	_shadow_col += shadow2D(shadow_map, _shadow_uv.xyz + vec3(-_map_scale,  _map_scale, 0.0)).r;
-	_shadow_col += shadow2D(shadow_map, _shadow_uv.xyz + vec3(-_map_scale, -_map_scale, 0.0)).r;
-	_shadow_col += shadow2D(shadow_map, _shadow_uv.xyz + vec3(-_map_scale,         0.0, 0.0)).r;
-	_shadow_col += shadow2D(shadow_map, _shadow_uv.xyz + vec3(        0.0,  _map_scale, 0.0)).r;
-	_shadow_col += shadow2D(shadow_map, _shadow_uv.xyz + vec3(        0.0, -_map_scale, 0.0)).r;
-	_shadow_col *= 1.0/9.0;
-
-	return _shadow_col;
-}
-
-
-float PCF_Medium( in vec3 _shadow_uv )
-{
-	float _shadow_col = shadow2D(shadow_map, _shadow_uv ).r;
-	float _map_scale = 1.0 / SHADOWMAP_SIZE;
-
-	_shadow_col += shadow2D(shadow_map, _shadow_uv.xyz + vec3( _map_scale,  _map_scale, 0.0)).r;
-	_shadow_col += shadow2D(shadow_map, _shadow_uv.xyz + vec3( _map_scale, -_map_scale, 0.0)).r;
-	_shadow_col += shadow2D(shadow_map, _shadow_uv.xyz + vec3( _map_scale,         0.0, 0.0)).r;
-	_shadow_col += shadow2D(shadow_map, _shadow_uv.xyz + vec3(-_map_scale,  _map_scale, 0.0)).r;
-	_shadow_col += shadow2D(shadow_map, _shadow_uv.xyz + vec3(-_map_scale, -_map_scale, 0.0)).r;
-	_shadow_col += shadow2D(shadow_map, _shadow_uv.xyz + vec3(-_map_scale,         0.0, 0.0)).r;
-	_shadow_col += shadow2D(shadow_map, _shadow_uv.xyz + vec3(        0.0,  _map_scale, 0.0)).r;
-	_shadow_col += shadow2D(shadow_map, _shadow_uv.xyz + vec3(        0.0, -_map_scale, 0.0)).r;
-
-	_map_scale *= 2.0;
-
-	_shadow_col += shadow2D(shadow_map, _shadow_uv.xyz + vec3( _map_scale,  _map_scale, 0.0)).r;
-	_shadow_col += shadow2D(shadow_map, _shadow_uv.xyz + vec3( _map_scale, -_map_scale, 0.0)).r;
-	_shadow_col += shadow2D(shadow_map, _shadow_uv.xyz + vec3( _map_scale,         0.0, 0.0)).r;
-	_shadow_col += shadow2D(shadow_map, _shadow_uv.xyz + vec3(-_map_scale,  _map_scale, 0.0)).r;
-	_shadow_col += shadow2D(shadow_map, _shadow_uv.xyz + vec3(-_map_scale, -_map_scale, 0.0)).r;
-	_shadow_col += shadow2D(shadow_map, _shadow_uv.xyz + vec3(-_map_scale,         0.0, 0.0)).r;
-	_shadow_col += shadow2D(shadow_map, _shadow_uv.xyz + vec3(        0.0,  _map_scale, 0.0)).r;
-	_shadow_col += shadow2D(shadow_map, _shadow_uv.xyz + vec3(        0.0, -_map_scale, 0.0)).r;
-
-	_shadow_col *= 0.058823529; // aka: _shadow_col /= 17.0;
-	return _shadow_col;
-}
-
-
-float PCF_High( in vec3 _shadow_uv )
-{
-	float _shadow_col = shadow2D(shadow_map, _shadow_uv ).r;
-	float _map_scale = 1.0 / SHADOWMAP_SIZE;
-
-	_shadow_col += shadow2D(shadow_map, _shadow_uv.xyz + vec3( _map_scale,  _map_scale, 0.0)).r;
-	_shadow_col += shadow2D(shadow_map, _shadow_uv.xyz + vec3( _map_scale, -_map_scale, 0.0)).r;
-	_shadow_col += shadow2D(shadow_map, _shadow_uv.xyz + vec3( _map_scale,  	     0.0, 0.0)).r;
-	_shadow_col += shadow2D(shadow_map, _shadow_uv.xyz + vec3(-_map_scale,  _map_scale, 0.0)).r;
-	_shadow_col += shadow2D(shadow_map, _shadow_uv.xyz + vec3(-_map_scale, -_map_scale, 0.0)).r;
-	_shadow_col += shadow2D(shadow_map, _shadow_uv.xyz + vec3(-_map_scale,  	     0.0, 0.0)).r;
-	_shadow_col += shadow2D(shadow_map, _shadow_uv.xyz + vec3(        0.0,  _map_scale, 0.0)).r;
-	_shadow_col += shadow2D(shadow_map, _shadow_uv.xyz + vec3(        0.0, -_map_scale, 0.0)).r;
-
-
-	float _map_scale_2 = 2.0 * _map_scale;
-
-	_shadow_col += shadow2D(shadow_map, _shadow_uv.xyz + vec3(_map_scale_2, _map_scale_2, 0.0)).r;
-	_shadow_col += shadow2D(shadow_map, _shadow_uv.xyz + vec3(_map_scale, _map_scale_2, 0.0)).r;
-	_shadow_col += shadow2D(shadow_map, _shadow_uv.xyz + vec3(0.0, _map_scale_2, 0.0)).r;
-	_shadow_col += shadow2D(shadow_map, _shadow_uv.xyz + vec3(-_map_scale, _map_scale_2, 0.0)).r;
-	_shadow_col += shadow2D(shadow_map, _shadow_uv.xyz + vec3(-_map_scale_2, _map_scale_2, 0.0)).r;
-	_shadow_col += shadow2D(shadow_map, _shadow_uv.xyz + vec3(-_map_scale_2, _map_scale, 0.0)).r;
-	_shadow_col += shadow2D(shadow_map, _shadow_uv.xyz + vec3(-_map_scale_2, 0.0, 0.0)).r;
-	_shadow_col += shadow2D(shadow_map, _shadow_uv.xyz + vec3(-_map_scale_2, -_map_scale, 0.0)).r;
-	_shadow_col += shadow2D(shadow_map, _shadow_uv.xyz + vec3(-_map_scale_2, -_map_scale_2, 0.0)).r;
-	_shadow_col += shadow2D(shadow_map, _shadow_uv.xyz + vec3(-_map_scale, -_map_scale_2, 0.0)).r;
-	_shadow_col += shadow2D(shadow_map, _shadow_uv.xyz + vec3(0.0, -_map_scale_2, 0.0)).r;
-	_shadow_col += shadow2D(shadow_map, _shadow_uv.xyz + vec3(_map_scale, -_map_scale_2, 0.0)).r;
-	_shadow_col += shadow2D(shadow_map, _shadow_uv.xyz + vec3(_map_scale_2, -_map_scale_2, 0.0)).r;
-	_shadow_col += shadow2D(shadow_map, _shadow_uv.xyz + vec3(_map_scale_2, -_map_scale, 0.0)).r;
-	_shadow_col += shadow2D(shadow_map, _shadow_uv.xyz + vec3(_map_scale_2, 0.0, 0.0)).r;
-	_shadow_col += shadow2D(shadow_map, _shadow_uv.xyz + vec3(_map_scale_2, _map_scale, 0.0)).r;
-
-	_shadow_col /= 25.0;
-	return _shadow_col;
-}
-#endif
-
-
-
-/*
-=======================================================================================================================================
-Phong                                                                                                                                 =
-=======================================================================================================================================
-*/
-vec3 Phong( in vec3 _frag_pos_vspace, out float _frag_light_dist )
-{
-	// get the lambert term
-	vec3 _light_pos_eyespace = gl_LightSource[0].position.xyz;
-	vec3 _light_frag_vec = _light_pos_eyespace - _frag_pos_vspace;
-
-	_frag_light_dist = dot( _light_frag_vec, _light_frag_vec ); // instead of using normalize(_frag_light_dist) we brake the operation...
-	vec3 _light_dir = _light_frag_vec * inversesqrt(_frag_light_dist); // ...because we want frag_light_dist for the calc of the attenuation
-
-	// read the normal
-	//vec3 _normal = texture2D( ms_normal_fai, tex_coords ).rgb;
-	vec3 _normal = UnpackNormal( texture2D( ms_normal_fai, tex_coords ).rg );
-
-	// the lambert term
-	float _lambert_term = dot( _normal, _light_dir );
-
-	if( _lambert_term < 0.0 ) discard;
-	//_lambert_term = max( 0.0, _lambert_term );
-
-	// diffuce lighting
-	vec3 _diffuse = texture2D( ms_diffuse_fai, tex_coords ).rgb;
-	_diffuse = (_diffuse * gl_LightSource[0].diffuse.rgb);
-	vec3 _color = _diffuse * _lambert_term;
-
-	// specular lighting
-	vec4 _specular_mix = texture2D( ms_specular_fai, tex_coords );
-	vec3 _specular = _specular_mix.xyz;
-	float _shininess = _specular_mix.w;
-
-	vec3 _eye_vec = normalize( -_frag_pos_vspace );
-	vec3 _h = normalize( _light_dir + _eye_vec );
-	float _spec_intensity = pow(max(0.0, dot(_normal, _h)), _shininess);
-	_color += _specular * vec3(gl_LightSource[0].specular) * (_spec_intensity * _lambert_term);
-
-	return _color;
-}
-
-
-
-/*
-=======================================================================================================================================
-main                                                                                                                                  =
-=======================================================================================================================================
-*/
-void main()
-{
-	// get frag pos in view space
-	vec3 _frag_pos_vspace = FragPosVSpace();
-
-	//===================================================================================================================================
-	// POINT LIGHT                                                                                                                      =
-	//===================================================================================================================================
-	#if defined(_POINT_LIGHT_)
-		// The func Phong calculates the frag to light distance (_frag_light_dist) and be cause we need that distance
-		// latter for other calculations we export it
-		float _frag_light_dist;
-		vec3 _color = Phong( _frag_pos_vspace, _frag_light_dist );
-		gl_FragData[0] = vec4( _color * Attenuation(_frag_light_dist), 1.0 );
-
-	//===================================================================================================================================
-	// SPOT LIGHT                                                                                                                       =
-	//===================================================================================================================================
-	#elif defined(_SPOT_LIGHT_)
-		vec4 _tex_coord2 = gl_TextureMatrix[0] * vec4(_frag_pos_vspace, 1.0);
-		vec3 _tex_coords3 = _tex_coord2.xyz / _tex_coord2.w;
-
-		if
-		(
-			_tex_coord2.w > 0.0 &&
-			_tex_coords3.x > 0.0 &&
-			_tex_coords3.x < 1.0 &&
-			_tex_coords3.y > 0.0 &&
-			_tex_coords3.y < 1.0 &&
-			_tex_coord2.w < 1.0/gl_LightSource[0].position.w
-		)
-		{
-			#if defined( _SHADOW_ )
-				#if defined( _SHADOW_MAPPING_PCF_ )
-					float _shadow_color = PCF_Low( _tex_coords3 );
-				#else
-					float _shadow_color = PCF_Off( _tex_coords3 );
-				#endif
-
-				if( _shadow_color == 0.0 ) discard;
-			#endif // shadow
-
-			float _frag_light_dist;
-			vec3 _color = Phong( _frag_pos_vspace, _frag_light_dist );
-
-			vec3 _texel = texture2DProj( light_tex, _tex_coord2.xyz ).rgb;
-			float _att = Attenuation(_frag_light_dist);
-
-			#if defined( _SHADOW_ )
-				gl_FragData[0] = vec4(_texel * _color * (_shadow_color * _att), 1.0);
-			#else
-				gl_FragData[0] = vec4( _color * _texel * _att, 1.0 );
-			#endif
-			//gl_FragData[0] = vec4( 1.0, 0.0, 1.0, 1.0 );
-		}
-		else
-		{
-			discard;
-		}
-	#endif // spot light
-
-	/*#if defined(_SPOT_LIGHT_)
-	gl_FragData[0] = vec4( UnpackNormal(texture2D( ms_normal_fai, tex_coords ).rg), 1.0 );
-	//gl_FragData[0] = vec4( texture2D( ms_depth_fai, tex_coords ).rg), 1.0 );
-	#endif*/
-}

+ 0 - 3
is_lp_point.glsl

@@ -1,3 +0,0 @@
-#define _POINT_LIGHT_
-
-#pragma anki include "shaders/is_lp_generic.glsl"

+ 0 - 5
is_lp_spot.glsl

@@ -1,5 +0,0 @@
-#define _SPOT_LIGHT_
-
-#pragma anki uniform light_tex 5
-
-#pragma anki include "shaders/is_lp_generic.glsl"

+ 0 - 7
is_lp_spot_shad.glsl

@@ -1,7 +0,0 @@
-#define _SPOT_LIGHT_
-#define _SHADOW_
-
-#pragma anki uniform light_tex 5
-#pragma anki uniform shadow_map 6
-
-#pragma anki include "shaders/is_lp_generic.glsl"

+ 0 - 11
linear_depth.glsl

@@ -1,11 +0,0 @@
-// convert to linear depth
-
-float LinearizeDepth( in float depth_, in float znear_, in float zfar_ )
-{
-	return (2.0 * znear_) / (zfar_ + znear_ - depth_ * (zfar_ - znear_));
-}
-
-float ReadFromTexAndLinearizeDepth( in sampler2D depth_map_, in vec2 tex_coord_, in float znear_, in float zfar_ )
-{
-	return LinearizeDepth( texture2D( depth_map_, tex_coord_ ).r, znear_, zfar_ );
-}

+ 0 - 9
ms_mp format (dnspgke)

@@ -1,9 +0,0 @@
-dnspgke aka
-
-diffuse mapping
-normal mapping
-specular mapping
-parallax mapping
-grass like
-hardware skinning
-environment mapping

+ 0 - 5
ms_mp_dne.glsl

@@ -1,5 +0,0 @@
-#define _HAS_DIFFUSE_MAP_
-#define _HAS_NORMAL_MAP_
-#define _ENVIRONMENT_MAPPING_
-
-#pragma anki include "shaders/ms_mp_generic.glsl"

+ 0 - 6
ms_mp_dnsk.glsl

@@ -1,6 +0,0 @@
-#define _HAS_DIFFUSE_MAP_
-#define _HAS_NORMAL_MAP_
-#define _HAS_SPECULAR_MAP_
-#define _HARDWARE_SKINNING_
-
-#pragma anki include "shaders/ms_mp_generic.glsl"

+ 0 - 268
ms_mp_generic.glsl

@@ -1,268 +0,0 @@
-#pragma anki vert_shader_begins
-
-/**
- * This a generic shader to fill the deferred shading buffers. You can always build your own if you dont need to write in all the
- * buffers.
- */
-#pragma anki include "shaders/hw_skinning.glsl"
-
-varying vec3 normal;
-
-
-#if defined( _HAS_DIFFUSE_MAP_ ) || defined( _HAS_NORMAL_MAP_ ) || defined( _HAS_SPECULAR_MAP_ )
-	#define NEEDS_TEX_MAPPING 1
-#else
-	#define NEEDS_TEX_MAPPING 0
-#endif
-
-
-#if defined( _HAS_NORMAL_MAP_ ) || defined( _PARALLAX_MAPPING_ )
-	#define NEEDS_TANGENT 1
-#else
-	#define NEEDS_TANGENT 0
-#endif
-
-
-varying vec2 tex_coords_v2f;
-uniform vec2 tex_coords;
-
-attribute vec4 tangent;
-varying vec3 tangent_v2f;
-varying float w_v2f;
-
-varying vec3 eye_v2f; ///< In tangent space
-varying vec3 vert_pos_eye_space_v2f;
-
-
-
-//=====================================================================================================================================
-// main                                                                                                                               =
-//=====================================================================================================================================
-void main()
-{
-	// calculate the vert pos, normal and tangent
-
-	// if we have hardware skinning then:
-	#if defined( _HARDWARE_SKINNING_ )
-		mat3 _rot;
-		vec3 _tsl;
-
-		HWSkinning( _rot, _tsl );
-
-		normal = gl_NormalMatrix * ( _rot * gl_Normal );
-
-		#if NEEDS_TANGENT
-			tangent_v2f = gl_NormalMatrix * ( _rot * vec3(tangent) );
-		#endif
-
-		vec3 pos_lspace = ( _rot * gl_Vertex.xyz) + _tsl;
-		gl_Position =  gl_ModelViewProjectionMatrix * vec4(pos_lspace, 1.0);
-
-	// if DONT have hardware skinning
-	#else
-		normal = gl_NormalMatrix * gl_Normal;
-
-		#if NEEDS_TANGENT
-			tangent_v2f = gl_NormalMatrix * vec3(tangent);
-		#endif
-
-		gl_Position = ftransform();
-	#endif
-
-
-	// calculate the rest
-
-	#if NEEDS_TEX_MAPPING
-		tex_coords_v2f = gl_MultiTexCoord0.xy;
-	#endif
-
-
-	#if NEEDS_TANGENT
-		w_v2f = tangent.w;
-	#endif
-
-
-	#if defined( _ENVIRONMENT_MAPPING_ )
-		vert_pos_eye_space_v2f = vec3( gl_ModelViewMatrix * gl_Vertex );
-	#endif
-
-
-	#if defined( _PARALLAX_MAPPING_ )
-		vec3 t = gl_NormalMatrix * tangent.xyz;
-		vec3 n = normal;
-		vec3 b = cross( n, t ) /* tangent.w*/;
-
-		vec3 eye_pos = gl_Position.xyz - gl_ModelViewMatrixInverse[3].xyz;
-		eye_pos = eye_pos - ( gl_ModelViewMatrixInverse * gl_Vertex ).xyz;
-
-		mat3 tbn_mat = mat3( t, b, n );
-		eye = tbn_mat * eye_pos;
-		//eye.y = -eye.y;
-		//eye.x = -eye.x;
-	#endif
-}
-
-
-#pragma anki frag_shader_begins
-
-/**
-Note: The process of calculating the diffuse color for the diffuse MSFAI is divided into two parts. The first happens before the
-normal calculation and the other just after it. In the first part we read the texture (or the gl_Color) and we set the _diff_color.
-In case of grass we discard. In the second part we calculate a SEM color and we combine it with the _diff_color. We cannot put
-the second part before normal calculation because SEM needs the _new_normal. Also we cannot put the first part after normal
-calculation because in case of grass we will waste calculations for the normal. For that two reasons we split the diffuse
-calculations in two parts
-*/
-
-#pragma anki include "shaders/pack.glsl"
-
-/*
-=======================================================================================================================================
-VARS                                                                                                                                  =
-=======================================================================================================================================
-*/
-varying vec3 normal;
-
-#if defined( _HAS_DIFFUSE_MAP_ )
-	uniform sampler2D diffuse_map;
-#endif
-
-#if defined( _HAS_NORMAL_MAP_ )
-	uniform sampler2D normal_map;
-	varying vec3 tangent_v2f;
-	varying float w_v2f;
-#endif
-
-#if defined( _HAS_SPECULAR_MAP_ )
-	uniform sampler2D specular_map;
-#endif
-
-#if defined( _HAS_DIFFUSE_MAP_ ) || defined( _HAS_NORMAL_MAP_ ) || defined( _HAS_SPECULAR_MAP_ ) || defined( _PARALLAX_MAPPING_ )
-	varying vec2 tex_coords_v2f;
-#endif
-
-#if defined( _PARALLAX_MAPPING_ )
-	uniform sampler2D height_map;
-	varying vec3 eye;
-#endif
-
-
-#if defined( _ENVIRONMENT_MAPPING_ )
-	uniform sampler2D environment_map;
-	varying vec3 vert_pos_eye_space_v2f;
-#endif
-
-
-/*
-=======================================================================================================================================
-main                                                                                                                                  =
-=======================================================================================================================================
-*/
-void main()
-{
-	//===================================================================================================================================
-	// Paralax Mapping Calculations                                                                                                     =
-	// The code below reads the height map, makes some calculations and returns a new tex_coords                                        =
-	//===================================================================================================================================
-	#if defined( _PARALLAX_MAPPING_ )
-		const float _scale = 0.04;
-		const float _bias = scale * 0.4;
-
-		vec3 _norm_eye = normalize( eye );
-
-		float _h = texture2D( height_map, tex_coords_v2f ).r;
-		float _height = _scale * _h - _bias;
-
-		vec2 _super_tex_coords_v2f = _height * _norm_eye.xy + tex_coords_v2f;
-	#else
-		#define _super_tex_coords tex_coords_v2f
-	#endif
-
-
-	//===================================================================================================================================
-	// Diffuse Calculations (Part I)                                                                                                    =
-	// Get the color from the diffuse map and discard if grass                                                                          =
-	//===================================================================================================================================
-	vec3 _diff_color;
-	#if defined( _HAS_DIFFUSE_MAP_ )
-
-		#if defined( _GRASS_LIKE_ )
-			vec4 _diff_color4 = texture2D( diffuse_map, _super_tex_coords );
-			if( _diff_color4.a == 0.0 ) discard;
-			_diff_color = _diff_color4.rgb;
-		#else
-			_diff_color = texture2D( diffuse_map, _super_tex_coords ).rgb;
-		#endif
-
-		_diff_color *= gl_FrontMaterial.diffuse.rgb;
-	#else
-		_diff_color = gl_FrontMaterial.diffuse.rgb;
-	#endif
-
-
-	//===================================================================================================================================
-	// Normal Calculations                                                                                                              =
-	// Either use a normap map and make some calculations or use the vertex normal                                                      =
-	//===================================================================================================================================
-	#if defined( _HAS_NORMAL_MAP_ )
-		vec3 _n = normalize( normal );
-		vec3 _t = normalize( tangent_v2f );
-		vec3 _b = cross(_n, _t) * w_v2f;
-
-		mat3 _tbn_mat = mat3(_t,_b,_n);
-
-		vec3 _n_at_tangentspace = ( texture2D( normal_map, _super_tex_coords ).rgb - 0.5 ) * 2.0;
-
-		vec3 _new_normal = normalize( _tbn_mat * _n_at_tangentspace );
-	#else
-		vec3 _new_normal = normalize(normal);
-	#endif
-
-
-	//===================================================================================================================================
-	// Diffuse Calculations (Part II)                                                                                                   =
-	// If SEM is enabled make some calculations and combine colors of SEM and the _diff_color                                           =
-	//===================================================================================================================================
-
-	// if SEM enabled make some aditional calculations using the vert_pos_eye_space_v2f, environment_map and the _new_normal
-	#if defined( _ENVIRONMENT_MAPPING_ )
-		vec3 _u = normalize( vert_pos_eye_space_v2f );
-		vec3 _r = reflect( _u, _new_normal ); // In case of normal mapping I could play with vertex's normal but this gives better...
-		                                      // ...results and its allready computed
-		_r.z += 1.0;
-		float _m = 2.0 * length(_r);
-		vec2 _sem_tex_coords = _r.xy/_m + 0.5;
-
-		vec3 _sem_col = texture2D( environment_map, _sem_tex_coords ).rgb;
-		_diff_color = _diff_color + _sem_col; // blend existing color with the SEM texture map
-	#endif
-
-
-	//===================================================================================================================================
-	// Specular Calculations                                                                                                            =
-	//===================================================================================================================================
-
-	// has specular map
-	#if defined( _HAS_SPECULAR_MAP_ )
-		vec4 _specular = vec4(texture2D( specular_map, _super_tex_coords ).rgb * gl_FrontMaterial.specular.rgb, gl_FrontMaterial.shininess);
-	// no specular map
-	#else
-		vec4 _specular = vec4(gl_FrontMaterial.specular.rgb, gl_FrontMaterial.shininess);
-	#endif
-
-
-	//===================================================================================================================================
-	// Final Stage. Write all data                                                                                                      =
-	//===================================================================================================================================
-	//gl_FragData[0].rgb = _new_normal;
-	gl_FragData[0].rg = PackNormal( _new_normal );
-	gl_FragData[1].rgb = _diff_color;
-	gl_FragData[2] = _specular;
-
-	/*#if defined( _HARDWARE_SKINNING_ )
-		gl_FragData[1] = gl_Color;
-	#endif*/
-}
-
-
-

+ 0 - 52
ms_mp_skybox.glsl

@@ -1,52 +0,0 @@
-#pragma anki vert_shader_begins
-
-varying vec2 txtr_coords;
-
-void main()
-{
-	txtr_coords = gl_MultiTexCoord0.xy;
-	gl_Position = ftransform();
-}
-
-#pragma anki frag_shader_begins
-
-#pragma anki uniform colormap 0
-uniform sampler2D colormap;
-#pragma anki uniform noisemap 1
-uniform sampler2D noisemap;
-#pragma anki uniform timer 2
-uniform float timer;
-#pragma anki uniform scene_ambient_color 3
-uniform vec3 scene_ambient_color;
-varying vec2 txtr_coords;
-
-#define PI 3.14159265358979323846
-
-
-void main()
-{
-	vec3 _noise_vec;
-	vec2 displacement;
-	float scaled_timer;
-
-	displacement = txtr_coords;
-
-	scaled_timer = timer*0.4;
-
-	displacement.x -= scaled_timer;
-	displacement.y -= scaled_timer;
-
-	_noise_vec = normalize( texture2D(noisemap, displacement).xyz );
-	_noise_vec = (_noise_vec * 2.0 - 1.0);
-
-	// edge_factor is a value that varies from 1.0 to 0.0 and then again to 1.0. Its zero in the edge of the skybox quad
-	// and white in the middle of the quad. We use it in order to reduse the distortion at the edges because of artefacts
-	float _edge_factor = sin( txtr_coords.s * PI ) * sin( txtr_coords.t * PI );
-
-	const float _strength_factor = 0.015;
-
-	_noise_vec = _noise_vec * _strength_factor * _edge_factor;
-
-	gl_FragData[1].rgb = texture2D(colormap, txtr_coords + _noise_vec.xy).rgb * scene_ambient_color; // write to the diffuse buffer
-}
-

+ 0 - 34
pack.glsl

@@ -1,34 +0,0 @@
-vec2 PackNormal( in vec3 _normal )
-{
-    /*original code:
-    const float _scale = 1.7777;
-    vec2 _enc = _normal.xy / (_normal.z+1.0);
-    _enc /= _scale;
-    _enc = _enc*0.5 + 0.5;
-    return _enc;*/
-
-    const float _scale = 1.7777;
-    float scalar1 = (_normal.z+1.0)*(_scale*2.0);
-    return _normal.xy / scalar1 + 0.5;
-}
-
-
-vec3 UnpackNormal( in vec2 _enc )
-{
-	/*original code:
-	float _scale = 1.7777;
-	vec3 _nn = vec3( _enc*vec2(2.0*_scale, 2.0*_scale) + vec2(-_scale, -_scale), 1.0 );
-	float _g = 2.0 / dot(_nn.xyz, _nn.xyz);
-	vec3 _normal;
-	_normal.xy = _g * _nn.xy;
-	_normal.z = _g - 1.0;
-	return _normal;*/
-
-	const float _scale = 1.7777;
-	vec2 _nn = _enc*(2.0*_scale) - _scale;
-	float _g = 2.0 / (dot(_nn.xy, _nn.xy) + 1.0);
-	vec3 _normal;
-	_normal.xy = _g * _nn.xy;
-	_normal.z = _g - 1.0;
-	return _normal;
-}

+ 0 - 245
photoshop_filters.glsl

@@ -1,245 +0,0 @@
-/*
-** Photoshop & misc math
-** Blending modes, RGB/HSL/Contrast/Desaturate, levels control
-**
-** Romain Dura | Romz
-** Blog: http://blog.mouaif.org
-** Post: http://blog.mouaif.org/?p=94
-*/
-
-
-/*
-** Desaturation
-*/
-
-vec4 Desaturate(vec3 color, float Desaturation)
-{
-	vec3 grayXfer = vec3(0.3, 0.59, 0.11);
-	vec3 gray = vec3(dot(grayXfer, color));
-	return vec4(mix(color, gray, Desaturation), 1.0);
-}
-
-
-/*
-** Hue, saturation, luminance
-*/
-
-vec3 RGBToHSL(vec3 color)
-{
-	vec3 hsl; // init to 0 to avoid warnings ? (and reverse if + remove first part)
-
-	float fmin = min(min(color.r, color.g), color.b);    //Min. value of RGB
-	float fmax = max(max(color.r, color.g), color.b);    //Max. value of RGB
-	float delta = fmax - fmin;             //Delta RGB value
-
-	hsl.z = (fmax + fmin) / 2.0; // Luminance
-
-	if (delta == 0.0)		//This is a gray, no chroma...
-	{
-		hsl.x = 0.0;	// Hue
-		hsl.y = 0.0;	// Saturation
-	}
-	else                                    //Chromatic data...
-	{
-		if (hsl.z < 0.5)
-			hsl.y = delta / (fmax + fmin); // Saturation
-		else
-			hsl.y = delta / (2.0 - fmax - fmin); // Saturation
-
-		float deltaR = (((fmax - color.r) / 6.0) + (delta / 2.0)) / delta;
-		float deltaG = (((fmax - color.g) / 6.0) + (delta / 2.0)) / delta;
-		float deltaB = (((fmax - color.b) / 6.0) + (delta / 2.0)) / delta;
-
-		if (color.r == fmax )
-			hsl.x = deltaB - deltaG; // Hue
-		else if (color.g == fmax)
-			hsl.x = (1.0 / 3.0) + deltaR - deltaB; // Hue
-		else if (color.b == fmax)
-			hsl.x = (2.0 / 3.0) + deltaG - deltaR; // Hue
-
-		if (hsl.x < 0.0)
-			hsl.x += 1.0; // Hue
-		else if (hsl.x > 1.0)
-			hsl.x -= 1.0; // Hue
-	}
-
-	return hsl;
-}
-
-float HueToRGB(float f1, float f2, float hue)
-{
-	if (hue < 0.0)
-		hue += 1.0;
-	else if (hue > 1.0)
-		hue -= 1.0;
-	float res;
-	if ((6.0 * hue) < 1.0)
-		res = f1 + (f2 - f1) * 6.0 * hue;
-	else if ((2.0 * hue) < 1.0)
-		res = f2;
-	else if ((3.0 * hue) < 2.0)
-		res = f1 + (f2 - f1) * ((2.0 / 3.0) - hue) * 6.0;
-	else
-		res = f1;
-	return res;
-}
-
-vec3 HSLToRGB(vec3 hsl)
-{
-	vec3 rgb;
-
-	if (hsl.y == 0.0)
-		rgb = vec3(hsl.z); // Luminance
-	else
-	{
-		float f2;
-
-		if (hsl.z < 0.5)
-			f2 = hsl.z * (1.0 + hsl.y);
-		else
-			f2 = (hsl.z + hsl.y) - (hsl.y * hsl.z);
-
-		float f1 = 2.0 * hsl.z - f2;
-
-		rgb.r = HueToRGB(f1, f2, hsl.x + (1.0/3.0));
-		rgb.g = HueToRGB(f1, f2, hsl.x);
-		rgb.b= HueToRGB(f1, f2, hsl.x - (1.0/3.0));
-	}
-
-	return rgb;
-}
-
-
-/*
-** Contrast, saturation, brightness
-** Code of this function is from TGM's shader pack
-** http://irrlicht.sourceforge.net/phpBB2/viewtopic.php?t=21057
-*/
-
-// For all settings: 1.0 = 100% 0.5=50% 1.5 = 150%
-vec3 ContrastSaturationBrightness(vec3 color, float brt, float sat, float con)
-{
-	// Increase or decrease theese values to adjust r, g and b color channels seperately
-	const float AvgLumR = 0.5;
-	const float AvgLumG = 0.5;
-	const float AvgLumB = 0.5;
-
-	const vec3 LumCoeff = vec3(0.2125, 0.7154, 0.0721);
-
-	vec3 AvgLumin = vec3(AvgLumR, AvgLumG, AvgLumB);
-	vec3 brtColor = color * brt;
-	vec3 intensity = vec3(dot(brtColor, LumCoeff));
-	vec3 satColor = mix(intensity, brtColor, sat);
-	vec3 conColor = mix(AvgLumin, satColor, con);
-	return conColor;
-}
-
-
-/*
-** Float blending modes
-** Adapted from here: http://www.nathanm.com/photoshop-blending-math/
-** But I modified the HardMix (wrong condition), Overlay, SoftLight, ColorDodge, ColorBurn, VividLight, PinLight (inverted layers) ones to have correct results
-*/
-
-#define BlendLinearDodgef 			BlendAddf
-#define BlendLinearBurnf 			BlendSubstractf
-#define BlendAddf(base, blend) 		min(base + blend, 1.0)
-#define BlendSubstractf(base, blend) 	max(base + blend - 1.0, 0.0)
-#define BlendLightenf(base, blend) 		max(blend, base)
-#define BlendDarkenf(base, blend) 		min(blend, base)
-#define BlendLinearLightf(base, blend) 	(blend < 0.5 ? BlendLinearBurnf(base, (2.0 * blend)) : BlendLinearDodgef(base, (2.0 * (blend - 0.5))))
-#define BlendScreenf(base, blend) 		(1.0 - ((1.0 - base) * (1.0 - blend)))
-#define BlendOverlayf(base, blend) 	(base < 0.5 ? (2.0 * base * blend) : (1.0 - 2.0 * (1.0 - base) * (1.0 - blend)))
-#define BlendSoftLightf(base, blend) 	((blend < 0.5) ? (2.0 * base * blend + base * base * (1.0 - 2.0 * blend)) : (sqrt(base) * (2.0 * blend - 1.0) + 2.0 * base * (1.0 - blend)))
-#define BlendColorDodgef(base, blend) 	((blend == 1.0) ? blend : min(base / (1.0 - blend), 1.0))
-#define BlendColorBurnf(base, blend) 	((blend == 0.0) ? blend : max((1.0 - ((1.0 - base) / blend)), 0.0))
-#define BlendVividLightf(base, blend) 	((blend < 0.5) ? BlendColorBurnf(base, (2.0 * blend)) : BlendColorDodgef(base, (2.0 * (blend - 0.5))))
-#define BlendPinLightf(base, blend) 	((blend < 0.5) ? BlendDarkenf(base, (2.0 * blend)) : BlendLightenf(base, (2.0 *(blend - 0.5))))
-#define BlendHardMixf(base, blend) 	((BlendVividLightf(base, blend) < 0.5) ? 0.0 : 1.0)
-#define BlendReflectf(base, blend) 		((blend == 1.0) ? blend : min(base * base / (1.0 - blend), 1.0))
-
-
-/*
-** Vector3 blending modes
-*/
-
-// Component wise blending
-#define Blend(base, blend, funcf) 		vec3(funcf(base.r, blend.r), funcf(base.g, blend.g), funcf(base.b, blend.b))
-
-#define BlendNormal(base, blend) 		(blend)
-#define BlendLighten				BlendLightenf
-#define BlendDarken				BlendDarkenf
-#define BlendMultiply(base, blend) 		(base * blend)
-#define BlendAverage(base, blend) 		((base + blend) / 2.0)
-#define BlendAdd(base, blend) 		min(base + blend, vec3(1.0))
-#define BlendSubstract(base, blend) 	max(base + blend - vec3(1.0), vec3(0.0))
-#define BlendDifference(base, blend) 	abs(base - blend)
-#define BlendNegation(base, blend) 	(vec3(1.0) - abs(vec3(1.0) - base - blend))
-#define BlendExclusion(base, blend) 	(base + blend - 2.0 * base * blend)
-#define BlendScreen(base, blend) 		Blend(base, blend, BlendScreenf)
-#define BlendOverlay(base, blend) 		Blend(base, blend, BlendOverlayf)
-#define BlendSoftLight(base, blend) 	Blend(base, blend, BlendSoftLightf)
-#define BlendHardLight(base, blend) 	BlendOverlay(blend, base)
-#define BlendColorDodge(base, blend) 	Blend(base, blend, BlendColorDodgef)
-#define BlendColorBurn(base, blend) 	Blend(base, blend, BlendColorBurnf)
-#define BlendLinearDodge			BlendAdd
-#define BlendLinearBurn			BlendSubstract
-// Linear Light is another contrast-increasing mode
-// If the blend color is darker than midgray, Linear Light darkens the image by decreasing the brightness. If the blend color is lighter than midgray, the result is a brighter image due to increased brightness.
-#define BlendLinearLight(base, blend) 	Blend(base, blend, BlendLinearLightf)
-#define BlendVividLight(base, blend) 	Blend(base, blend, BlendVividLightf)
-#define BlendPinLight(base, blend) 		Blend(base, blend, BlendPinLightf)
-#define BlendHardMix(base, blend) 		Blend(base, blend, BlendHardMixf)
-#define BlendReflect(base, blend) 		Blend(base, blend, BlendReflectf)
-#define BlendGlow(base, blend) 		BlendReflect(blend, base)
-#define BlendPhoenix(base, blend) 		(min(base, blend) - max(base, blend) + vec3(1.0))
-#define BlendOpacity(base, blend, F, O) 	(F(base, blend) * O + blend * (1.0 - O))
-
-
-// Hue Blend mode creates the result color by combining the luminance and saturation of the base color with the hue of the blend color.
-vec3 BlendHue(vec3 base, vec3 blend)
-{
-	vec3 baseHSL = RGBToHSL(base);
-	return HSLToRGB(vec3(RGBToHSL(blend).r, baseHSL.g, baseHSL.b));
-}
-
-// Saturation Blend mode creates the result color by combining the luminance and hue of the base color with the saturation of the blend color.
-vec3 BlendSaturation(vec3 base, vec3 blend)
-{
-	vec3 baseHSL = RGBToHSL(base);
-	return HSLToRGB(vec3(baseHSL.r, RGBToHSL(blend).g, baseHSL.b));
-}
-
-// Color Mode keeps the brightness of the base color and applies both the hue and saturation of the blend color.
-vec3 BlendColor(vec3 base, vec3 blend)
-{
-	vec3 blendHSL = RGBToHSL(blend);
-	return HSLToRGB(vec3(blendHSL.r, blendHSL.g, RGBToHSL(base).b));
-}
-
-// Luminosity Blend mode creates the result color by combining the hue and saturation of the base color with the luminance of the blend color.
-vec3 BlendLuminosity(vec3 base, vec3 blend)
-{
-	vec3 baseHSL = RGBToHSL(base);
-	return HSLToRGB(vec3(baseHSL.r, baseHSL.g, RGBToHSL(blend).b));
-}
-
-
-/*
-** Gamma correction
-** Details: http://blog.mouaif.org/2009/01/22/photoshop-gamma-correction-shader/
-*/
-
-#define GammaCorrection(color, gamma)								pow(color, 1.0 / gamma)
-
-/*
-** Levels control (input (+gamma), output)
-** Details: http://blog.mouaif.org/2009/01/28/levels-control-shader/
-*/
-
-#define LevelsControlInputRange(color, minInput, maxInput)				min(max(color - vec3(minInput), vec3(0.0)) / (vec3(maxInput) - vec3(minInput)), vec3(1.0))
-#define LevelsControlInput(color, minInput, gamma, maxInput)				GammaCorrection(LevelsControlInputRange(color, minInput, maxInput), gamma)
-#define LevelsControlOutputRange(color, minOutput, maxOutput) 			mix(vec3(minOutput), vec3(maxOutput), color)
-#define LevelsControl(color, minInput, gamma, maxInput, minOutput, maxOutput) 	LevelsControlOutputRange(LevelsControlInput(color, minInput, gamma, maxInput), minOutput, maxOutput)
-
-

+ 0 - 202
pps.glsl

@@ -1,202 +0,0 @@
-#pragma anki vert_shader_begins
-
-#pragma anki include "shaders/simple.glsl"
-
-#pragma anki frag_shader_begins
-
-#pragma anki include "shaders/photoshop_filters.glsl"
-
-uniform sampler2D is_fai;
-uniform sampler2D pps_ssao_fai;
-uniform sampler2D ms_normal_fai;
-uniform sampler2D pps_boom_fai;
-uniform sampler2D pps_lscatt_fai;
-
-varying vec2 tex_coords;
-
-
-/*
-=======================================================================================================================================
-GrayScale                                                                                                                             =
-=======================================================================================================================================
-*/
-vec3 GrayScale( in vec3 _col )
-{
-	float _grey = (_col.r + _col.g + _col.b) * 0.333333333; // aka: / 3.0
-	return vec3(_grey);
-}
-
-
-/*
-=======================================================================================================================================
-Saturation                                                                                                                            =
-=======================================================================================================================================
-*/
-vec3 Saturation( in vec3 _col, in float _satur_factor )
-{
-	const vec3 lumCoeff = vec3 ( 0.2125, 0.7154, 0.0721);
-
-	vec3 intensity = vec3( dot(_col, lumCoeff) );
-	return mix( intensity, _col, _satur_factor );
-}
-
-
-/*
-=======================================================================================================================================
-EdgeAA                                                                                                                                =
-=======================================================================================================================================
-*/
-#if defined(_EDGEAA_)
-
-//float LinearizeDepth( in float _depth )
-//{
-//	return (2.0 * camerarange.x) / (camerarange.y + camerarange.x - _depth * (camerarange.y - camerarange.x));
-//}
-//
-//float ReadLinearDepth( in vec2 coord )
-//{
-//	return LinearizeDepth( texture2D( depth_map, coord ).r );
-//}
-
-vec3 EdgeAA()
-{
-	vec2 kernel[8];
-	kernel[0] = vec2(-1,1);
-	kernel[1] = vec2(1,-1);
-	kernel[2] = vec2(-1,-1);
-	kernel[3] = vec2(1,1);
-	kernel[4] = vec2(-1,0);
-	kernel[5] = vec2(1,0);
-	kernel[6] = vec2(0,-1);
-	kernel[7] = vec2(0,1);
-
-	vec2 pixelsize = vec2( 1.0/(R_W*R_Q), 1.0/(R_H*R_Q) );
-	const float weight = 1.0;
-
-	vec3 tex = texture2D( ms_normal_fai, tex_coords ).rgb;
-	float factor = -0.5;
-
-	for( int i=0; i<4; i++ )
-	{
-		vec3 t = texture2D( ms_normal_fai, tex_coords + kernel[i]*pixelsize ).rgb;
-		t -= tex;
-		factor += dot(t, t);
-	}
-
-	factor = min(1.0, factor) * weight;
-
-	//return vec3(factor);
-	//if( factor < 0.01 ) return texture2D( is_fai, tex_coords ).rgb;
-
-	vec3 color = vec3(0.0);
-
-	for( int i=0; i<8; i++ )
-	{
-		color += texture2D( is_fai, tex_coords + kernel[i]*pixelsize*factor ).rgb;
-	}
-
-	color += 2.0 * texture2D( is_fai, tex_coords ).rgb;
-
-	return color*(1.0/9.0);
-
-//	const float aob = 1.0; // area of blur
-//
-//	vec2 kernel[8];
-//	kernel[0] = vec2(-aob,aob);
-//	kernel[1] = vec2(aob,-aob);
-//	kernel[2] = vec2(-aob,-aob);
-//	kernel[3] = vec2(aob,aob);
-//	kernel[4] = vec2(-aob,0);
-//	kernel[5] = vec2(aob,0);
-//	kernel[6] = vec2(0,-aob);
-//	kernel[7] = vec2(0,aob);
-//
-//	vec2 pixelsize = vec2( 1.0/R_W, 1.0/R_H );
-//
-//	float d = ReadLinearDepth( tex_coords );
-//	float factor = 0.0;
-//
-//	const float weight = 8.0;
-//
-//	for( int i=0; i<4; i++ )
-//	{
-//		float ds = ReadLinearDepth( tex_coords + kernel[i]*pixelsize );
-//
-//		factor += abs(d - ds);
-//	}
-//
-//	factor = (factor / 4)*weight;
-//
-//	//return vec3(factor);
-//
-//	/*if( factor < 0.001 )
-//	{
-//		return texture2D( is_fai, tex_coords ).rgb;
-//	}*/
-//
-//	vec3 color = vec3(0.0);
-//
-//	for( int i=0; i<8; i++ )
-//	{
-//		color += texture2D( is_fai, tex_coords + kernel[i]*pixelsize*factor ).rgb;
-//	}
-//
-//	color += 2.0 * texture2D( is_fai, tex_coords ).rgb;
-//
-//	return color*(1.0/10.0);
-}
-#endif
-
-
-/*
-=======================================================================================================================================
-main                                                                                                                                  =
-=======================================================================================================================================
-*/
-void main (void)
-{
-	vec3 color;
-
-	#if defined(_EDGEAA_)
-		color = EdgeAA();
-	#else
-		color = texture2D( is_fai, tex_coords ).rgb;
-	#endif
-
-	/*const float gamma = 0.7;
-	color.r = pow(color.r, 1.0 / gamma);
-	color.g = pow(color.g, 1.0 / gamma);
-	color.b = pow(color.b, 1.0 / gamma);*/
-
-	#if defined(_SSAO_)
-		float ssao_factor = texture2D( pps_ssao_fai, tex_coords ).a;
-		color *= ssao_factor;
-	#endif
-
-	#if defined(_LSCATT_)
-		vec3 lscatt = texture2D( pps_lscatt_fai, tex_coords ).rgb;
-		color += lscatt;
-	#endif
-
-	#if defined(_BLOOM_)
-		//float bloom_factor = texture2D( pps_boom_fai, tex_coords ).r; // ORIGINAL BLOOM CODE
-		vec3 bloom = texture2D( pps_boom_fai, tex_coords ).rgb;
-		color += bloom;
-	#endif
-
-	color = BlendHardLight( vec3(0.6, 0.62, 0.4), color );
-
-	gl_FragData[0].rgb = color;
-
-	//gl_FragColor = vec4( color, 1.0 );
-	//gl_FragColor = vec4( GrayScale(gl_FragColor.rgb), 1.0 );
-	//gl_FragData[0] = vec4( ssao_factor );
-	//gl_FragData[0] = vec4( lscatt, 1.0 );
-	//gl_FragData[0] = vec4( bloom_factor );
-	//gl_FragColor = vec4( EdgeAA(), 1.0 );
-	//gl_FragColor = texture2D( pps_boom_fai, tex_coords );
-	//gl_FragColor = texture2D( is_fai, tex_coords );
-	//gl_FragData[0].rgb = UnpackNormal( texture2D( ms_normal_fai, tex_coords ).rg );
-	//gl_FragData[0] = vec4( bloom*2, 1.0 );
-}
-

+ 0 - 3
pps_bloom_final.glsl

@@ -1,3 +0,0 @@
-#define _BLOOM_FINAL_
-#pragma anki uniform bloom_final_fai 0
-#pragma anki include "shaders/pps_bloom_generic.glsl"

+ 0 - 78
pps_bloom_generic.glsl

@@ -1,78 +0,0 @@
-#pragma anki vert_shader_begins
-
-#pragma anki include "shaders/simple_vert.glsl"
-
-#pragma anki frag_shader_begins
-
-// the first pass is for horizontal blur and the second for vertical
-
-varying vec2 tex_coords;
-
-#if defined( _BLOOM_VBLUR_ )
-	uniform sampler2D is_fai;
-#elif defined ( _BLOOM_FINAL_ )
-	uniform sampler2D bloom_final_fai; // ToDo: rename
-#else
-	#error "something is wrong"
-#endif
-
-
-
-/*
-=======================================================================================================================================
-main                                                                                                                                  =
-=======================================================================================================================================
-*/
-void main (void)
-{
-	const float super_offset = 1.;
-	#if defined( _BLOOM_VBLUR_ )
-		const float offset = 1.0 / (R_W*R_Q*BLOOM_RENDERING_QUALITY) * super_offset; // 1 / width_of_the_IS_FAI     !!!!!!!!!!!!!!!!!!!!!!!
-	#else
-		const float offset = 1.0 / (R_H*R_Q*BLOOM_RENDERING_QUALITY) * super_offset; // 1 / height_of_the_BLOOM_FAI
-	#endif
-
-	const int kernel_size = 7;
-	float kernel[kernel_size];
-	kernel[0] = -3.0 * offset;
-	kernel[1] = -2.0 * offset;
-	kernel[2] = -1.0 * offset;
-	kernel[3] = 0.0 * offset;
-	kernel[4] = 1.0 * offset;
-	kernel[5] = 2.0 * offset;
-	kernel[6] = 3.0 * offset;
-	/*kernel[7] = -4.0 * offset;
-	kernel[8] = 4.0 * offset;
-	kernel[9] = -5.0 * offset;
-	kernel[10] = 5.0 * offset;*/
-
-	//float bloom_factor = 0.0; // ORIGINAL BLOOM CODE
-	vec3 bloom = vec3(0.0);
-
-	for( int i=0; i<kernel_size; i++ )
-	{
-		#if defined( _BLOOM_VBLUR_ )
-			vec3 color = texture2D( is_fai, tex_coords + vec2(kernel[i], 0.0) ).rgb;
-
-			float Y = dot(vec3(0.30, 0.59, 0.11), color);
-			const float exposure = 4.0;
-			const float brightMax = 4.0;
-			float YD = exposure * (exposure/brightMax + 1.0) / (exposure + 1.0) * Y;
-			color *= YD;
-
-			bloom += color;
-			//vec3 color = texture2D( is_fai, tex_coords + vec2(kernel[i], 0.0) ).rgb; // ORIGINAL BLOOM CODE
-			//bloom_factor += dot(tex,tex); // ORIGINAL BLOOM CODE
-		#else
-			vec3 color = texture2D( bloom_final_fai, tex_coords + vec2(0.0, kernel[i]) ).rgb;
-			bloom += color;
-
-			//float factor = texture2D( bloom_final_fai, tex_coords + vec2(0.0, kernel[i]) ).r; // ORIGINAL BLOOM CODE
-			//bloom_factor += factor; // ORIGINAL BLOOM CODE
-		#endif
-	}
-
-	gl_FragColor.rgb = bloom * (1.0/kernel_size);
-	//gl_FragColor.r = bloom_factor * (1.0/7.0); // ORIGINAL BLOOM CODE
-}
-

+ 0 - 3
pps_bloom_vblur.glsl

@@ -1,3 +0,0 @@
-#define _BLOOM_VBLUR_
-#pragma anki uniform is_fai 0
-#pragma anki include "shaders/pps_bloom_generic.glsl"

+ 0 - 54
pps_lscatt.glsl

@@ -1,54 +0,0 @@
-#pragma anki vert_shader_begins
-
-#pragma anki include "shaders/simple_vert.glsl"
-
-#pragma anki frag_shader_begins
-
-const int SAMPLES_NUM = 100;
-
-float exposure = 2.0;
-float decay = 0.8;
-float density = 1.0;
-float weight = 0.3;
-vec2 light_pos_screen_space = vec2(0.5, 0.5);
-
-#pragma anki uniform ms_depth_fai 0
-uniform sampler2D ms_depth_fai;
-#pragma anki uniform is_fai 1
-uniform sampler2D is_fai;
-
-varying vec2 tex_coords;
-
-
-
-void main()
-{
-	vec2 delta_tex_coord = tex_coords - light_pos_screen_space;
-	vec2 tex_coords2 = tex_coords;
-	delta_tex_coord *= 1.0 / float(SAMPLES_NUM) * density;
-	float illumination_decay = 1.0;
-
-	gl_FragData[0].rgb = vec3(0.0);
-
-	for( int i=0; i<SAMPLES_NUM; i++ )
-	{
-		tex_coords2 -= delta_tex_coord;
-
-		float depth = texture2D( ms_depth_fai, tex_coords2 ).r;
-		if( depth != 1.0 ) // if the fragment is not part of the skybox dont bother continuing
-		{
-			illumination_decay *= decay;
-			continue;
-		}
-
-		vec3 sample = texture2D( is_fai, tex_coords2 ).rgb;			
-		sample *= illumination_decay * weight;
-		gl_FragData[0].rgb += sample;
-		illumination_decay *= decay;
-	}
-
-	gl_FragData[0].rgb *= exposure;
-	
-	//gl_FragData[0].rgb = texture2D( is_fai, tex_coords ).rgb;
-	//gl_FragData[0].rgb = vec3(1, 1, 0);
-}

+ 0 - 32
simple_texturing.glsl

@@ -1,32 +0,0 @@
-#pragma anki vert_shader_begins
-
-varying vec2 tex_coords;
-varying vec3 normal;
-
-void main()
-{
-	tex_coords = gl_MultiTexCoord0.xy;
-	normal = gl_NormalMatrix * gl_Normal;
-	gl_Position = ftransform();
-}
-
-#pragma anki frag_shader_begins
-
-#pragma anki include "pack.glsl"
-
-uniform sampler2D diffuse_map, noise_map;
-varying vec2 tex_coords;
-varying vec3 normal;
-
-void main()
-{
-	/*vec3 _noise = DecodeNormal( texture2D( noise_map, gl_FragCoord.xy*vec2( 1.0/R_W, 1.0/R_H ) ).rg ).rgb;
-	_noise = _noise * 2 - 1;
-	_noise *= 7.0;*/
-	vec4 _texel = texture2D( diffuse_map, (gl_FragCoord.xy+(normal.xy*2))*vec2( 1.0/R_W, 1.0/R_H ) );
-
-
-	//vec4 _texel = texture2D( diffuse_map, tex_coords );
-
-	gl_FragColor = _texel;
-}

+ 0 - 18
simple_vert.glsl

@@ -1,18 +0,0 @@
-/** 
- * Simple vertex shader for IS and PPS stages. It is used for rendering a quad in the 
- * screen. Notice that it does not use ftransform(). We dont need it because we can
- * get the Normalized Display Coordinates ([-1,1]) simply by looking in the vertex
- * position. The vertex positions of the quad are from 0.0 to 1.0 for both axis.
- */
-
-varying vec2 tex_coords;
-
-void main()
-{
-	vec2 vert_pos = gl_Vertex.xy; // the vert coords are {1.0,1.0}, {0.0,1.0}, {0.0,0.0}, {1.0,0.0}
-	tex_coords = vert_pos;
-	vec2 vert_pos_ndc = vert_pos*2.0 - 1.0;
-	gl_Position = vec4( vert_pos_ndc, 0.0, 1.0 );
-}
-
-

+ 0 - 24
txt.glsl

@@ -1,24 +0,0 @@
-#pragma anki vert_shader_begins
-
-varying vec2 tex_coords;
-
-void main(void)
-{
-	tex_coords = gl_MultiTexCoord0.xy;
-	gl_FrontColor = gl_Color;
-	gl_Position = ftransform();
-}
-
-#pragma anki frag_shader_begins
-
-uniform sampler2D font_map;
-varying vec2 tex_coords;
-
-void main()
-{
-	vec2 tex_col = texture2D( font_map, tex_coords ).ra; // get only one value and the alpha
-
-	if( tex_col.y == 0.0 ) discard;
-
-	gl_FragColor = vec4(tex_col.x) * gl_Color;
-}