Changeset 2337 for GTP/trunk/App/Demos/Illum/Ogre/Media/materials
- Timestamp:
- 04/24/07 14:10:34 (18 years ago)
- Location:
- GTP/trunk/App/Demos/Illum/Ogre/Media/materials
- Files:
-
- 7 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPAdvancedEnvMap/diffuse/GTPDiffuse.hlsl
r2054 r2337 6 6 float4 readCubeMap(samplerCUBE cm, float3 coord) 7 7 { 8 float4 color = texCUBElod( cm, float4(coord.xy, -coord.z, 1) );8 float4 color = texCUBElod( cm, float4(coord.xy, -coord.z, 0) ); 9 9 color.a = 1; 10 10 return color; … … 13 13 float readDistanceCubeMap(samplerCUBE dcm, float3 coord) 14 14 { 15 float dist = texCUBElod(dcm, float4(coord.xy, - coord.z, 1)).r;15 float dist = texCUBElod(dcm, float4(coord.xy, - coord.z, 0)).r; 16 16 if(dist == 0) dist = 1000000; ///sky 17 17 return dist; … … 26 26 float4 MPos : TEXCOORD0; 27 27 }; 28 28 /* 29 29 float4 ReduceCubeMap_PS(MPos_OUT IN, 30 30 uniform int nFace, … … 54 54 return color / (RATE * RATE); 55 55 } 56 56 */ 57 58 float4 ReduceCubeMap_PS(MPos_OUT IN, 59 uniform int nFace, 60 uniform samplerCUBE EnvironmentMapSampler : register(s0) ) : COLOR 61 { 62 float4 color = 0; 63 float3 dir; 64 65 for (int i = 0; i < RATE/2; i+=1) 66 for (int j = 0; j < RATE/2; j+=1) 67 { 68 float2 pos; 69 pos.x = IN.MPos.x + (4*i + 2)/(float)CUBEMAP_SIZE; 70 pos.y = IN.MPos.y - (4*j + 2)/(float)CUBEMAP_SIZE; // y=-u 71 72 // "scrambling" 73 if (nFace == 0) dir = float3(1, pos.y, -pos.x); 74 if (nFace == 1) dir = float3(-1, pos.y, pos.x); 75 if (nFace == 2) dir = float3(pos.x, 1, -pos.y); 76 if (nFace == 3) dir = float3(pos.x, -1, pos.y); 77 if (nFace == 4) dir = float3(pos.x, pos.y, 1); 78 if (nFace == 5) dir = float3(-pos.x, pos.y,-1); 79 80 color += texCUBE( EnvironmentMapSampler, dir); 81 } 82 83 return color / (RATE * RATE / 4.0); 84 } 57 85 58 86 //////////////// -
GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPAdvancedEnvMap/diffuse/GTPDiffuse.program
r2054 r2337 4 4 entry_point Diffuse_Poly2Point_PS 5 5 target ps_3_0 6 flow_control prefer6 //flow_control prefer 7 7 } 8 8 … … 28 28 entry_point ReduceCubeMap_PS 29 29 target ps_3_0 30 flow_control prefer30 //flow_control avoid 31 31 } -
GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPBasic/GTPBasic.program
r2294 r2337 193 193 source GTPShadowMap_PS.hlsl 194 194 entry_point shadowMapDist_Variance 195 target ps_2_0 196 } 197 198 fragment_program GTP/Basic/SM/Dist_POINT_VSM_PS hlsl 199 { 200 source GTPShadowMap_PS.hlsl 201 entry_point shadowMapDist_POINT_Variance 195 202 target ps_2_0 196 203 } -
GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPBasic/GTPShadowMap_PS.hlsl
r2311 r2337 106 106 float4 pos = (IN.LightVPos / IN.LightVPos.w); 107 107 float d = length(pos.xy); 108 light = saturate((1.0 - d)/0.05);109 108 if(d <= 1.0) 110 109 { … … 126 125 } 127 126 } 128 else129 light = 0;130 127 131 128 return shadowColor + (1 - shadowColor) * light; 132 129 } 130 131 132 float4 shadowMapDist_POINT_Variance(LightCPos_OUT IN, 133 uniform float lightFarPlane, 134 uniform samplerCUBE shadowMap) : COLOR 135 { 136 float4 light = float4(1,1,1,1); 137 138 float dist = length(IN.LightCPos.xyz) / lightFarPlane; 139 float4 storedDist = texCUBE(shadowMap, float3(IN.LightCPos.xy, -IN.LightCPos.z)); 140 dist -= DIST_BIAS_VSM; 141 float lit_factor = light * (dist <= storedDist.r); 142 143 float M1 = storedDist.r; 144 float M2 = storedDist.g; 145 float v2 = min(max(M2 - M1 * M1, 0.0) + DIST_EPSILON, 1.0); 146 float m_d = M1 - dist; 147 float pmax = v2 / (v2 + m_d * m_d); 148 149 // Adjust the light color based on the shadow attenuation 150 light = max(lit_factor, pmax); 151 152 153 return (shadowColor + (1 - shadowColor) * light); 154 } -
GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPCaustic/GTPCaustic.material
r2301 r2337 117 117 use_triangles true 118 118 blur_caustic_cubemap true 119 } 120 121 } 122 vertex_program_ref GTP/Basic/Shaded_VS 123 { 124 param_named_auto WorldViewProj worldviewproj_matrix 125 param_named_auto World world_matrix 126 param_named_auto WorldInv inverse_world_matrix 127 } 128 fragment_program_ref GTP/EnvMap/Localized_Refraction_PS 129 { 130 param_named_auto cameraPos camera_position 131 param_named lastCenter float3 0 0 0 132 param_named sFresnel float 0.1 133 <<<<<<< .mine 134 param_named sRefraction float 0.85 135 ======= 136 param_named sRefraction float 0.8 137 >>>>>>> .r2314 138 } 139 //Cube map for reflections and refractions 140 texture_unit 141 { 142 143 } 144 //Cube map of distances 145 texture_unit 146 { 147 filtering none 148 } 149 } 150 } 151 } 152 153 material GTP/Caustic/Glass_PointSprite 154 { 155 technique 156 { 157 pass 158 { 159 IllumTechniques 160 { 161 RenderTechnique ColorCubeMap 162 { 163 update_interval 0 164 update_all_face true 165 } 166 RenderTechnique DistanceCubeMap 167 { 168 update_interval 0 169 update_all_face true 170 } 171 RenderTechnique CausticCaster 172 { 173 attenuation 1000 174 update_interval 1 175 update_all_face true 176 photonmap_resolution 64 177 caustic_cubemap_resolution 256 178 photon_map_material GTP/Caustic/PhotonMap_HitEnv 179 caustic_map_material GTP/Caustic/CauCube_PointSprite 180 blur_caustic_cubemap false 119 181 } 120 182 … … 146 208 } 147 209 } 148 149 material GTP/Caustic/Glass_PointSprite150 {151 technique152 {153 pass154 {155 IllumTechniques156 {157 RenderTechnique ColorCubeMap158 {159 update_interval 0160 update_all_face true161 }162 RenderTechnique DistanceCubeMap163 {164 update_interval 0165 update_all_face true166 }167 RenderTechnique CausticCaster168 {169 attenuation 1000170 update_interval 1171 update_all_face true172 photonmap_resolution 64173 caustic_cubemap_resolution 256174 photon_map_material GTP/Caustic/PhotonMap_HitEnv175 caustic_map_material GTP/Caustic/CauCube_PointSprite176 blur_caustic_cubemap false177 }178 179 }180 vertex_program_ref GTP/Basic/Shaded_VS181 {182 param_named_auto WorldViewProj worldviewproj_matrix183 param_named_auto World world_matrix184 param_named_auto WorldInv inverse_world_matrix185 }186 fragment_program_ref GTP/EnvMap/Localized_Refraction_PS187 {188 param_named_auto cameraPos camera_position189 param_named lastCenter float3 0 0 0190 param_named sFresnel float 0.1191 param_named sRefraction float 0.8192 }193 //Cube map for reflections and refractions194 texture_unit195 {196 197 }198 //Cube map of distances199 texture_unit200 {201 filtering none202 }203 }204 }205 } -
GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/GameTools_Phong.hlsl
r2294 r2337 115 115 OUT.hPos = OUT.hPosition = mul(worldViewProj, position); 116 116 OUT.wPos = mul(worldView, position).xyz; 117 OUT.mNormal = mul(normal, worldViewI).xyz;117 OUT.mNormal = normal;//mul(normal, worldViewI).xyz; 118 118 //OUT.mNormal = normal; 119 119 OUT.texCoord = texCoord; … … 165 165 166 166 float3 N = IN.mNormal; 167 //float3 N = mul(worldViewIT, IN.mNormal);168 167 N = normalize( N ); 169 168 float3 pos = IN.wPos;
Note: See TracChangeset
for help on using the changeset viewer.