Changeset 2451 for GTP/trunk/App/Games/CarDriving_BME
- Timestamp:
- 06/13/07 16:07:30 (18 years ago)
- Location:
- GTP/trunk/App/Games/CarDriving_BME/Media/materials
- Files:
-
- 9 added
- 3 deleted
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Games/CarDriving_BME/Media/materials/programs/CarReflections.hlsl
r1049 r2451 1 //#define EFFECTS 2 //#define LOCALIZATION 3 1 4 float3 F0; 2 5 … … 52 55 uniform float4x4 worldViewProj, 53 56 uniform float4x4 world, 54 uniform float4x4 worldI T)57 uniform float4x4 worldI) 55 58 { 56 59 57 60 hPos = mul(worldViewProj, position); 58 61 wPos = mul(world, position).xyz; 59 mNormal = mul(normal, worldI T);62 mNormal = mul(normal, worldI); 60 63 //mNormal *=-1; 61 64 //mNormal = normal; … … 84 87 float3 mPos = wPos - lastCenter; 85 88 float3 V = normalize(wPos - cameraPos); 89 90 #ifdef EFFECTS 86 91 float3 R = normalize(reflect( V, mNormal)); 87 92 88 93 newTexCoord = R; 89 94 #ifdef LOCALIZATION 90 95 newTexCoord = Hit(mPos, R, DistanceMap); 96 #endif 91 97 Color = readCubeMap(CubeMap, newTexCoord ); 92 98 … … 107 113 Color = Color * float4(F,1); 108 114 109 115 #endif 110 116 //phong 111 117 … … 135 141 Color = float4(1,1,1,1); 136 142 143 #ifdef EFFECTS 137 144 //metallic reflection 138 145 mNormal = normalize(mNormal); … … 144 151 145 152 newTexCoord = R; 146 153 #ifdef LOCALIZATION 147 154 newTexCoord = Hit(mPos, R, DistanceMap); 155 #endif 148 156 Color = readCubeMap(CubeMap, newTexCoord ); 157 #endif 149 158 150 159 } … … 163 172 Color = float4(1,1,1,1); 164 173 174 #ifdef EFFECTS 165 175 //metallic reflection 166 176 mNormal = normalize(mNormal); … … 172 182 173 183 newTexCoord = R; 174 184 #ifdef LOCALIZATION 175 185 newTexCoord = Hit(mPos, R, DistanceMap); 186 #endif 176 187 Color = readCubeMap(CubeMap, newTexCoord ); 177 188 Color.a = 1; 189 #endif 178 190 Color *= glasColor; 179 191 -
GTP/trunk/App/Games/CarDriving_BME/Media/materials/programs/DiffuseBump.hlsl
r1049 r2451 1 float4x4 world_IT; 1 //#define EFFECTS 2 3 float4x4 world_I; 2 4 int REDUCED_CUBEMAP_SIZE = 8; 3 5 … … 105 107 hPos = mul(worldViewProj, position); 106 108 wPos = mul(world, position).xyz; 107 //mNormal = mul(normal, world_IT); 108 mNormal = normal; 109 mNormal = normalize(mul(normal, world_I)); 109 110 otexCoord = texCoord; 110 Tangent = tangent;111 Tangent = normalize(mul(tangent, world_I)); 111 112 Binormal = cross(tangent, normal); 112 113 } … … 119 120 uniform float3 cameraPos, 120 121 uniform float3 lastCenter, 121 uniform half 3lightPosition,122 uniform half4 lightPosition, 122 123 uniform samplerCUBE SmallEnvMapSampler : register(s0), 123 124 uniform samplerCUBE DistanceEnvMapSampler : register(s1), … … 128 129 REDUCED_CUBEMAP_SIZE = 4; 129 130 131 Tangent = normalize(Tangent); 132 N = normalize(N); 133 Binormal = normalize(Binormal); 130 134 //V = /*-*/normalize( V ); 131 135 float3 V = normalize(pos - cameraPos); // … … 134 138 half3 tNormal = tex2D(NormalMap, Tex).rgb; 135 139 136 N =mul(tNormal, ModelToTangent ); 137 N = mul( N, world_IT ); 138 N = normalize(N); 140 N = normalize(mul(tNormal, ModelToTangent )); 139 141 140 142 float3 R = reflect(V, N); … … 143 145 float4 intens = 0; 144 146 145 147 #ifdef EFFECTS 146 148 for (int x = 0; x < REDUCED_CUBEMAP_SIZE; x++) // az envmap minden texelére 147 149 for (int y = 0; y < REDUCED_CUBEMAP_SIZE; y++) … … 178 180 intens += GetContibution( L, pos, N, V, SmallEnvMapSampler, DistanceEnvMapSampler); 179 181 } 180 181 half3 light = lightPosition; 182 183 #endif 184 half3 light = lightPosition.xyz; 182 185 half3 L = normalize(light); 183 half3 H = normalize(L +V);186 half3 H = normalize(L - V); 184 187 half4 lighting = lit(dot(N, L),dot(N, H), 20); 185 188 186 189 float4 retColor = intens; 187 190 float4 texColor = tex2D(ColorTexture, Tex); 188 retColor = intens * texColor * 1.5 191 #ifdef EFFECTS 192 193 retColor = intens * texColor * 1.5 189 194 + lighting.y * texColor * 0.15 190 195 + lighting.z * 0.15 191 196 ; 197 #else 198 retColor =lighting.y * texColor 199 + lighting.z; 200 #endif 192 201 return retColor; 193 202 } -
GTP/trunk/App/Games/CarDriving_BME/Media/materials/programs/GameTools_Localized_EnvMap.hlsl
r1049 r2451 1 //#define EFFECTS 2 //#define LOCALIZATION 3 1 4 //metal: 2 5 float3 n, k; // R 700 nm, G 550 nm, B 435 nm … … 160 163 float3 mPos = wPos - lastCenter; 161 164 float3 V = normalize(wPos - cameraPos); 165 162 166 float3 R = normalize(reflect( V, mNormal)); 163 167 168 #ifdef EFFECTS 164 169 newTexCoord = R; 165 170 #ifdef LOCALIZATION 166 171 newTexCoord = Hit(mPos, R, DistanceMap); 172 #endif 167 173 Color = readCubeMap(CubeMap, newTexCoord ); 168 174 #else 175 Color = 1; 176 #endif 177 169 178 //Color = float4(mNormal + lastCenter.x*0.0000001, 1); 170 179 … … 185 194 } 186 195 187 Color = Color * float4(F,1); 188 196 Color = Color * float4(F,1); 189 197 //Color = length(lastCenter.xyz) * 0.1; 190 198 } -
GTP/trunk/App/Games/CarDriving_BME/Media/materials/programs/bottle.hlsl
r1049 r2451 1 //#define EFFECT 2 //#define LOCALIZATION 3 1 4 float4 readCubeMap(samplerCUBE cm, float3 coord) 2 5 { … … 50 53 uniform float4x4 worldViewProj, 51 54 uniform float4x4 world, 52 uniform float4x4 worldI T)55 uniform float4x4 worldI) 53 56 { 54 57 55 58 hPos = mul(worldViewProj, position); 56 59 wPos = mul(world, position).xyz; 57 mNormal = mul(normal, worldI T);60 mNormal = mul(normal, worldI); 58 61 // mNormal = normal; 59 62 otexCoord = texCoord; … … 81 84 float3 mPos = wPos - lastCenter; 82 85 float3 V = normalize(wPos - cameraPos); 83 float3 R = normalize(reflect( V, mNormal)); 86 87 #ifdef EFFECT 88 float3 R = normalize(reflect( V, mNormal)); 84 89 85 90 float3 T = normalize(refract(V, mNormal, 0.9)); … … 87 92 RR = R; TT = T; 88 93 94 #ifdef LOCALIZATION 89 95 RR = Hit(mPos, R, DistanceMap); 90 96 TT = Hit(mPos, T, DistanceMap); 97 #endif 91 98 92 99 float4 reflectcolor = readCubeMap(CubeMap, RR ); … … 98 105 99 106 Color = (F * reflectcolor + (1-F) * refractcolor * float4(color,1)) ; 100 107 #else 108 Color = float4(color, 1); 109 #endif 101 110 half3 light = lightPosition; 102 111 V = -V; -
GTP/trunk/App/Games/CarDriving_BME/Media/materials/scripts/scene1.material
r1049 r2451 16 16 17 17 } 18 RenderTechnique CausticReciever19 {20 max_caster_count 1021 }18 //RenderTechnique CausticReciever 19 //{ 20 // max_caster_count 10 21 //} 22 22 } 23 23
Note: See TracChangeset
for help on using the changeset viewer.