Changeset 1691 for GTP/trunk/App/Demos/Illum/Ogre/Media
- Timestamp:
- 10/27/06 17:40:02 (18 years ago)
- Location:
- GTP/trunk/App/Demos/Illum/Ogre/Media/materials
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/GameTools_Blur.hlsl
r1257 r1691 1 #define samplesU 52 #define samplesV 51 #define samplesU 3 2 #define samplesV 3 3 3 4 4 struct VS_INPUT { … … 39 39 return tex2D(Texture, uv); 40 40 } 41 42 VS_OUTPUT BlurCubeFaceVS(VS_INPUT IN) { 43 VS_OUTPUT OUT; 44 OUT.hPosition = IN.Position; 45 OUT.Position = OUT.hPosition; 46 return OUT; 47 } 48 49 float4 BlurCubeFacePS(VS_OUTPUT IN, 50 uniform samplerCUBE Texture : register(s0), 51 uniform float width, 52 uniform float height, 53 uniform float face ) : COLOR 54 { 55 56 float2 pixel = float2(2.0 / width, 2.0 / height); 57 float2 uv = IN.Position + pixel * 0.5; 58 59 float4 sum = float4(0,0,0,0); 60 61 for(int i = 0; i < samplesU; i++) 62 for(int j = 0; j < samplesV; j++) 63 { 64 float3 dir; 65 float2 pos = uv + float2(i - samplesU * 0.5,j - samplesV * 0.5) * pixel; 66 if (face == 0) dir = float3(1, pos.y, -pos.x); 67 if (face == 1) dir = float3(-1, pos.y, pos.x); 68 if (face == 2) dir = float3(pos.x, 1, -pos.y); 69 if (face == 3) dir = float3(pos.x, -1, pos.y); 70 if (face == 4) dir = float3(pos.x, pos.y, 1); 71 if (face == 5) dir = float3(-pos.x, pos.y,-1); 72 73 sum += texCUBE(Texture, dir); 74 } 75 76 77 sum /= samplesU * samplesV; 78 79 return sum; 80 //return texCUBE(Texture, float3(uv, 1)) + face * 0.0000001; 81 } -
GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/GameTools_CauCube.hlsl
r1487 r1691 23 23 { 24 24 OUT.color = float4(0,0,0,0); 25 OUT.hPosition = float4(0, 0, 1000000, 1);25 OUT.hPosition = float4(0, 0, -1000000, 1); 26 26 } 27 27 else … … 43 43 sumdist += dist; 44 44 valids++; 45 } 45 } 46 46 47 47 float4 pos2 = tex2Dlod(PhotonHitMap, float4(uv + float2(-pixel, pixel),0,0)); … … 68 68 valids++; 69 69 } 70 71 float avrdist = sumdist / 4;//valids;72 float maxdist = 1;73 intensity = max(maxdist - avrdist, 0.0) / maxdist;74 70 //if(valids == 0) sumdist = 100000; 71 float avrdist = sumdist / valids; 72 //float maxdist = 10; 73 //intensity = max(maxdist - avrdist, 0.0) / maxdist; 74 intensity = 60.0 / (avrdist * avrdist * 3.14); 75 75 //intensity = valids / 4.0;//avrdist; 76 76 -
GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/GameTools_DepthShadow.hlsl
r1671 r1691 80 80 float bias = 0.001; 81 81 float4 light = float4(1,1,1,1); 82 float4 shadow = float4(0. 85,0.85,0.85,1);82 float4 shadow = float4(0.25,0.25,0.25,1); 83 83 //float4 shadow = float4(0,0,0,1); 84 84 -
GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/GameTools_Localized_EnvMap.hlsl
r1525 r1691 47 47 }*/ 48 48 49 50 51 49 #define LIN_ITERATIONCOUNT 8 50 #define SECANT_ITERATIONCOUNT 3 51 52 float3 Hit(float3 x, float3 R, samplerCUBE mp) 53 { 54 R = normalize(R); 55 float3 xNorm = normalize(x); 56 float3 dt = (R - xNorm) / (float) LIN_ITERATIONCOUNT; 57 //float3 pN = normalize(cross(R, xNorm)); 58 //float3 N = normalize(cross(pN,R)); 59 //float d = dot(x, N); 60 61 float3 under = x; 62 float3 over = R; 63 float dUnder = readDistanceCubeMap( mp, x); 64 float dOver = readDistanceCubeMap( mp, R); 65 66 for(int i = 0; i < LIN_ITERATIONCOUNT; i++) 67 { 68 float3 dir = normalize(x + dt * i); 69 float dist = readDistanceCubeMap( mp, dir); 70 float3 point = dir * dist; 71 72 float t = length(x) / dot(dir,xNorm); 73 74 if(dist > t) //undershooting 75 { 76 under = normalize(point); 77 dUnder = dist; 78 } 79 else //overshooting 80 { 81 over = normalize(point); 82 dOver = dist; 83 i = LIN_ITERATIONCOUNT; 84 } 85 86 /* 87 88 if( dot(N, point) > d)//undershooting 89 under = normalize(point); 90 else //overshooting 91 { 92 over = normalize(point); 93 i = LIN_ITERATIONCOUNT; 94 } 95 */ 96 } 97 98 float r1 = length(x) * ctan(acos(dot(under, xNorm))); 99 float r2 = length(x) * ctan(acos(dot(over, xNorm))); 100 float rl = dUnder; 101 102 float ppp = dOver / readDistanceCubeMap( mp, x); // |p|/|p| 103 float dun = 0, pun = ppp, dov = 0, pov = 0; 104 float dl = rl * ( 1 - ppp ); // eq. 2 105 float3 l = x + R * dl; // ray equation 106 107 for( int i = 0; i < SECANT_ITERATIONCOUNT; i++ ) 108 { 109 float llp = length( l ) / readDistanceCubeMap( mp, l); // |l|/|l| 110 if ( llp < 0.999f ) // undershooting 111 { 112 dun = dl; pun = llp; // last undershooting 113 dl += ( dov == 0 ) ? rl * ( 1 - llp ) : // eq. 2 114 ( dl - dov ) * ( 1 - llp ) / ( llp - pov ); // eq. 3 115 } else if ( llp > 1.001f ) // overshooting 116 { 117 dov = dl; pov = llp; // last overshooting 118 dl += ( dl -dun ) * ( 1 - llp ) / ( llp - pun );// eq. 3 119 } 120 l = x + R * dl; // ray equation 121 } 122 123 return (under + over)/2.0; 124 } 125 126 /* 52 127 // This function is called several times. 53 128 float3 Hit( float3 x, float3 R, samplerCUBE mp ) … … 78 153 return l; // computed hit point 79 154 } 155 */ 80 156 81 157 void LocalizedVS(float4 position : POSITION, … … 163 239 newTexCoord = R; 164 240 165 //newTexCoord = Hit(mPos, R, DistanceMap);166 167 Color = readCubeMap(CubeMap, newTexCoord ) + lastCenter.x*0.000001;241 newTexCoord = Hit(mPos, R, DistanceMap); 242 243 Color = readCubeMap(CubeMap, newTexCoord ) /*+ lastCenter.x*0.000001*/; 168 244 169 245 float ctheta_in = dot(mNormal,R); … … 235 311 newTexCoord = Hit(mPos, R, DistanceMap); 236 312 237 Color = float4(n ormalize(newTexCoord),1);313 Color = float4(newTexCoord, 1); 238 314 239 315 //Color = 0.0001 * Color + float4(0,0,1,1); -
GTP/trunk/App/Demos/Illum/Ogre/Media/materials/scripts/GameTools.material
r1683 r1691 116 116 pass 117 117 { 118 ambient 0.3 0.3 0.4 119 diffuse 0.9 0.9 1.0 118 ambient 0.8 0.8 0.8 119 diffuse 0.0 0.0 0.0 120 specular 0.0 0.0 0.0 120 121 //lighting off 121 122 IllumTechniques 122 123 { 123 //RenderTechnique CausticReciever 124 RenderTechnique CausticReciever 125 { 126 max_caster_count 10 127 } 128 //RenderTechnique DepthShadowReciever 124 129 //{ 125 // max_caster_count 10 126 //} 127 RenderTechnique DepthShadowReciever 128 { 129 } 130 } 130 131 //} 132 } 133 texture_unit 134 { 135 texture rockWall.tga 136 } 137 131 138 } 132 139 } … … 302 309 } 303 310 311 material GameTools/BlurCubeFace 312 { 313 314 technique 315 { 316 317 pass 318 { 319 vertex_program_ref GameTools/BlurCubeFaceVS 320 { 321 322 } 323 fragment_program_ref GameTools/BlurCubeFacePS 324 { 325 param_named_auto width viewport_width 326 param_named_auto height viewport_height 327 param_named face float 0 328 } 329 texture_unit 330 { 331 filtering bilinear 332 } 333 334 } 335 } 336 } 337 304 338 vertex_program PhaseVS hlsl 305 339 { -
GTP/trunk/App/Demos/Illum/Ogre/Media/materials/scripts/GameTools.program
r1671 r1691 10 10 source GameTools_Blur.hlsl 11 11 entry_point BlurPS 12 target ps_3_0 13 } 14 15 vertex_program GameTools/BlurCubeFaceVS hlsl 16 { 17 source GameTools_Blur.hlsl 18 entry_point BlurCubeFaceVS 19 target vs_2_0 20 } 21 22 fragment_program GameTools/BlurCubeFacePS hlsl 23 { 24 source GameTools_Blur.hlsl 25 entry_point BlurCubeFacePS 12 26 target ps_3_0 13 27 } -
GTP/trunk/App/Demos/Illum/Ogre/Media/materials/scripts/GlassHead.material
r1638 r1691 50 50 param_named_auto resolution viewport_width 51 51 //param_named CauSpriteSize float 10.0 52 param_named CauSpriteSize float 70.052 param_named CauSpriteSize float 20.0 53 53 } 54 54 fragment_program_ref GameTools/CauPS … … 131 131 RenderTechnique ColorCubeMap 132 132 { 133 update_interval 1133 update_interval 0 134 134 update_all_face true 135 135 distance_calc true 3.5 … … 137 137 RenderTechnique DistanceCubeMap 138 138 { 139 update_interval 1139 update_interval 0 140 140 update_all_face true 141 141 distance_calc true 3.5 … … 144 144 { 145 145 attenuation 0 146 photonmap_resolution 32 147 caustic_cubemap_resolution 512 148 //caustic_map_material GameTools/CauTri 149 //use_triangles true 146 photonmap_resolution 128 147 caustic_cubemap_resolution 256 148 caustic_map_material GameTools/CauTri 149 use_triangles true 150 blur_caustic_cubemap true 150 151 } 151 152 -
GTP/trunk/App/Demos/Illum/Ogre/Media/materials/scripts/kupola.material
r1683 r1691 15 15 // max_caster_count 10 16 16 //} 17 RenderTechnique DepthShadowReciever18 {19 20 }17 //RenderTechnique DepthShadowReciever 18 //{ 19 // 20 //} 21 21 } 22 22 … … 69 69 // max_caster_count 10 70 70 //} 71 RenderTechnique DepthShadowReciever72 {73 74 }71 //RenderTechnique DepthShadowReciever 72 //{ 73 // 74 //} 75 75 } 76 76
Note: See TracChangeset
for help on using the changeset viewer.