effects.pfx 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698
  1. [HEADER]
  2. VERSION 01.00.00.00
  3. DESCRIPTION texture example
  4. COPYRIGHT Img Tec
  5. [/HEADER]
  6. // Define the textures that we'll be using
  7. [TEXTURES]
  8. FILE Balloon Balloon.pvr LINEAR-LINEAR-LINEAR
  9. FILE Balloon_pvr Balloon_pvr.pvr LINEAR-LINEAR-LINEAR
  10. FILE Noise Noise.pvr LINEAR-LINEAR-LINEAR
  11. FILE Skybox Skybox.pvr LINEAR-LINEAR-LINEAR CLAMP-CLAMP
  12. FILE SkyboxMidnight SkyboxMidnight.pvr LINEAR-LINEAR-LINEAR CLAMP-CLAMP
  13. [/TEXTURES]
  14. //Effect 0//////////////////////////////////////////////////////////////////////
  15. //
  16. // This effect is used for the skybox. The inverse of the vertex positions for
  17. // the skybox are used as texture coordinates for accessing the skybox texture.
  18. //
  19. [VERTEXSHADER]
  20. NAME skybox_vert
  21. [GLSL_CODE]
  22. attribute highp vec3 myVertex;
  23. uniform mediump mat4 myMVPMatrix;
  24. varying highp vec3 EyeDir;
  25. void main(void)
  26. {
  27. EyeDir = -myVertex;
  28. gl_Position = myMVPMatrix * vec4(myVertex,1.0);
  29. }
  30. [/GLSL_CODE]
  31. [/VERTEXSHADER]
  32. [FRAGMENTSHADER]
  33. NAME skybox_frag
  34. [GLSL_CODE]
  35. varying highp vec3 EyeDir;
  36. uniform samplerCube myCubeMap;
  37. void main (void)
  38. {
  39. gl_FragColor = textureCube(myCubeMap, EyeDir);
  40. }
  41. [/GLSL_CODE]
  42. [/FRAGMENTSHADER]
  43. [EFFECT]
  44. NAME skybox_effect
  45. // GLOBALS UNIFORMS
  46. UNIFORM myMVPMatrix WORLDVIEWPROJECTION
  47. UNIFORM myCubeMap TEXTURE0
  48. // ATTRIBUTES
  49. ATTRIBUTE myVertex POSITION
  50. VERTEXSHADER skybox_vert
  51. FRAGMENTSHADER skybox_frag
  52. TEXTURE 0 Skybox
  53. [/EFFECT]
  54. //Effect 1 /////////////////////////////////////////////////////////////////////
  55. //
  56. // This effect displays a textured balloon with some simple lighting.
  57. //
  58. [VERTEXSHADER]
  59. NAME balloon_vert1
  60. [GLSL_CODE]
  61. attribute highp vec3 myVertex;
  62. attribute mediump vec3 myNormal;
  63. attribute mediump vec2 myUV;
  64. uniform mediump mat4 myMVPMatrix;
  65. uniform mediump mat3 myModelViewIT;
  66. uniform mediump vec3 myLightDirection;
  67. uniform mediump float fAnim;
  68. varying mediump float fDot;
  69. varying lowp vec2 fTexCoord;
  70. void main(void)
  71. {
  72. gl_Position = myMVPMatrix * vec4(myVertex,1);
  73. fTexCoord = myUV;
  74. mediump vec3 fTransNormal = myModelViewIT * myNormal;
  75. fDot = 0.1 * dot(fTransNormal, myLightDirection) + 0.9;
  76. }
  77. [/GLSL_CODE]
  78. [/VERTEXSHADER]
  79. [FRAGMENTSHADER]
  80. NAME balloon_frag1
  81. [GLSL_CODE]
  82. uniform sampler2D sampler2d;
  83. varying mediump float fDot;
  84. varying lowp vec2 fTexCoord;
  85. void main (void)
  86. {
  87. gl_FragColor = texture2D(sampler2d,fTexCoord) * fDot;
  88. }
  89. [/GLSL_CODE]
  90. [/FRAGMENTSHADER]
  91. [EFFECT]
  92. NAME balloon_effect1
  93. // GLOBALS UNIFORMS
  94. UNIFORM myModelViewIT WORLDVIEWIT
  95. UNIFORM myMVPMatrix WORLDVIEWPROJECTION
  96. UNIFORM myLightDirection LIGHTDIRECTION
  97. UNIFORM sampler2d TEXTURE0
  98. // ATTRIBUTES
  99. ATTRIBUTE myVertex POSITION
  100. ATTRIBUTE myNormal NORMAL
  101. ATTRIBUTE myUV UV
  102. VERTEXSHADER balloon_vert1
  103. FRAGMENTSHADER balloon_frag1
  104. TEXTURE 0 Balloon_pvr
  105. [/EFFECT]
  106. //Effect 2 /////////////////////////////////////////////////////////////////////
  107. //
  108. // This effect creates a burning effect that burns the balloon from the basket
  109. // up. It does this by calculating whether a pixel is below at least one of
  110. // three thresholds (which rise over time). If it is not then the balloon
  111. // is textured and lit in the same way as effect 1 otherwise the burn effect is
  112. // applied according to the threshold it is below.
  113. //
  114. [VERTEXSHADER]
  115. NAME balloon_vert2
  116. [GLSL_CODE]
  117. attribute vec3 myVertex;
  118. attribute vec3 myNormal;
  119. attribute vec2 myUV;
  120. uniform mat4 myMVPMatrix;
  121. uniform mat3 myModelViewIT;
  122. uniform mediump vec3 myLightDirection;
  123. uniform highp float fAnim;
  124. varying float fDiffuse;
  125. varying lowp vec2 fTexCoord;
  126. varying lowp vec2 fTexCoord2;
  127. varying highp vec3 fPosition;
  128. varying highp float fBurn;
  129. void main(void)
  130. {
  131. gl_Position = myMVPMatrix * vec4(myVertex,1);
  132. fDiffuse = 0.1 * dot(myModelViewIT * myNormal, myLightDirection) + 0.9;
  133. fPosition = myVertex * 0.05;
  134. highp float fOffset = fract(0.999 * fAnim) * 2.1;
  135. fBurn = fOffset - 0.53 * (fPosition.y + 0.2);
  136. fBurn = clamp(fBurn, 0.0, 1.0);
  137. fTexCoord = myUV;
  138. fTexCoord2 = vec2(fPosition.x + fPosition.z * fPosition.z, fPosition.y + 0.5 * fPosition.z + 0.5 * fPosition.x * fPosition.x);
  139. }
  140. [/GLSL_CODE]
  141. [/VERTEXSHADER]
  142. [FRAGMENTSHADER]
  143. NAME balloon_frag2
  144. [GLSL_CODE]
  145. varying highp float fDiffuse;
  146. varying lowp vec2 fTexCoord;
  147. varying lowp vec2 fTexCoord2;
  148. uniform sampler2D sampler2d;
  149. uniform sampler2D Noise;
  150. varying highp float fBurn;
  151. highp vec3 reflect (void)
  152. {
  153. return texture2D(sampler2d,fTexCoord).rgb * fDiffuse;
  154. }
  155. void main (void)
  156. {
  157. highp vec4 noisevec;
  158. highp vec3 color;
  159. highp float intensity;
  160. noisevec = texture2D(Noise, fTexCoord2);
  161. intensity = 0.6 * (noisevec.x + noisevec.y + noisevec.z + noisevec.w);
  162. intensity = abs(intensity - 1.0);
  163. intensity = clamp(intensity, 0.0, 1.0);
  164. if (intensity < fBurn)
  165. color = vec3(0.0);
  166. else if(intensity < 1.5 * fBurn)
  167. color = vec3(0.1);
  168. else if(intensity < 1.7 * fBurn)
  169. color = vec3(1.0, 10.0 * (-intensity + 1.7 * fBurn) ,0.0);
  170. else
  171. color = reflect();
  172. gl_FragColor = vec4(color, 1);
  173. }
  174. [/GLSL_CODE]
  175. [/FRAGMENTSHADER]
  176. [EFFECT]
  177. NAME balloon_effect2
  178. // GLOBALS UNIFORMS
  179. UNIFORM myModelViewIT WORLDVIEWIT
  180. UNIFORM myMVPMatrix WORLDVIEWPROJECTION
  181. UNIFORM myLightDirection LIGHTDIRECTION
  182. UNIFORM sampler2d TEXTURE0
  183. UNIFORM Noise TEXTURE1
  184. // ATTRIBUTES
  185. ATTRIBUTE myVertex POSITION
  186. ATTRIBUTE myNormal NORMAL
  187. ATTRIBUTE myUV UV
  188. VERTEXSHADER balloon_vert2
  189. FRAGMENTSHADER balloon_frag2
  190. TEXTURE 0 Balloon_pvr
  191. TEXTURE 1 Noise
  192. [/EFFECT]
  193. //Effect 3 /////////////////////////////////////////////////////////////////////
  194. //
  195. // Effect 3 is very similar to effect 1 in that it displays a textured
  196. // balloon with diffuse lighting. However, it applies two textures to the
  197. // balloon. The second texture is the skybox cube map which is applied using a
  198. // reflection vector as texture coordinates. This makes it look like the balloon
  199. // is reflecting the skybox.
  200. //
  201. [VERTEXSHADER]
  202. NAME balloon_vert3
  203. [GLSL_CODE]
  204. attribute vec3 myVertex;
  205. attribute vec3 myNormal;
  206. attribute vec2 myUV;
  207. uniform mat4 myMVPMatrix;
  208. uniform mat3 myModelViewIT;
  209. uniform mat4 myModelView;
  210. uniform mat3 myViewIT;
  211. uniform mediump vec3 myLightDirection;
  212. varying highp float fDiffuse;
  213. varying lowp vec2 fTexCoord;
  214. uniform mediump float myFrame;
  215. uniform mediump float fAnim;
  216. varying lowp vec3 fReflectVec;
  217. void main(void)
  218. {
  219. mediump vec4 myVertex4 = vec4(myVertex, 1);
  220. gl_Position = myMVPMatrix * myVertex4;
  221. mediump vec3 fTransNormal = myModelViewIT * myNormal;
  222. fDiffuse = (0.05 * dot(fTransNormal, myLightDirection) + 0.95) * fAnim * 0.5;
  223. mediump vec3 EyeDir = vec3(0.0,-1.0,0.0) - vec3(myModelView * myVertex4);
  224. fReflectVec = myViewIT * reflect(EyeDir, normalize(fTransNormal) );
  225. fTexCoord = myUV.st;
  226. }
  227. [/GLSL_CODE]
  228. [/VERTEXSHADER]
  229. [FRAGMENTSHADER]
  230. NAME balloon_frag3
  231. [GLSL_CODE]
  232. varying highp float fDiffuse;
  233. varying lowp vec2 fTexCoord;
  234. varying lowp vec3 fReflectVec;
  235. uniform sampler2D sampler2d;
  236. uniform samplerCube myCubeMap;
  237. void main (void)
  238. {
  239. gl_FragColor = textureCube(myCubeMap, fReflectVec) + texture2D(sampler2d, fTexCoord);
  240. gl_FragColor *= fDiffuse;
  241. }
  242. [/GLSL_CODE]
  243. [/FRAGMENTSHADER]
  244. [EFFECT]
  245. NAME balloon_effect3
  246. // GLOBALS UNIFORMS
  247. UNIFORM myModelViewIT WORLDVIEWIT
  248. UNIFORM myMVPMatrix WORLDVIEWPROJECTION
  249. UNIFORM myModelView WORLDVIEW
  250. UNIFORM myViewIT VIEWIT
  251. UNIFORM myLightDirection LIGHTDIRECTION
  252. UNIFORM sampler2d TEXTURE0
  253. UNIFORM myCubeMap TEXTURE1
  254. // ATTRIBUTES
  255. ATTRIBUTE myVertex POSITION
  256. ATTRIBUTE myNormal NORMAL
  257. ATTRIBUTE myUV UV
  258. VERTEXSHADER balloon_vert3
  259. FRAGMENTSHADER balloon_frag3
  260. TEXTURE 0 Balloon
  261. TEXTURE 1 Skybox
  262. [/EFFECT]
  263. //Effect 4 /////////////////////////////////////////////////////////////////////
  264. //
  265. // This effect alters the transparency of the balloon based on an external
  266. // variable calculated in the app. The basket isn't affected as much as the
  267. // balloon as pixels over the height of 0.1 are given a lower alpha value.
  268. //
  269. [VERTEXSHADER]
  270. NAME balloon_vert4
  271. [GLSL_CODE]
  272. attribute vec3 myVertex;
  273. attribute vec3 myNormal;
  274. attribute vec2 myUV;
  275. uniform mat4 myMVPMatrix;
  276. uniform mat3 myModelViewIT;
  277. uniform mediump vec3 myLightDirection;
  278. uniform mediump float fAnim;
  279. varying float fDiffuse;
  280. varying lowp vec2 fTexCoord;
  281. varying mediump float fHeight;
  282. varying mediump float fAlteredAnim;
  283. void main(void)
  284. {
  285. gl_Position = myMVPMatrix * vec4(myVertex, 1);
  286. mediump vec3 fTransNormal = myModelViewIT * myNormal;
  287. fDiffuse = (0.05 * dot(fTransNormal, myLightDirection) + 0.95) * 0.5;
  288. fTexCoord = myUV;
  289. fHeight = myVertex.y;
  290. fAlteredAnim = (1.0 - fAnim) + fAnim;
  291. }
  292. [/GLSL_CODE]
  293. [/VERTEXSHADER]
  294. [FRAGMENTSHADER]
  295. NAME balloon_frag4
  296. [GLSL_CODE]
  297. varying highp float fDiffuse;
  298. varying lowp vec2 fTexCoord;
  299. varying mediump float fHeight;
  300. varying mediump float fAlteredAnim;
  301. uniform sampler2D sampler2d;
  302. uniform bool bBackFace;
  303. void main (void)
  304. {
  305. gl_FragColor.rgb = texture2D(sampler2d, fTexCoord).rgb * fDiffuse;
  306. if(fHeight > -0.1)
  307. {
  308. if(bBackFace)
  309. gl_FragColor.a = fAlteredAnim * 0.3;
  310. else
  311. gl_FragColor.a = 0.0;
  312. }
  313. else
  314. {
  315. gl_FragColor.a = fAlteredAnim;
  316. }
  317. }
  318. [/GLSL_CODE]
  319. [/FRAGMENTSHADER]
  320. [EFFECT]
  321. NAME balloon_effect4
  322. // GLOBALS UNIFORMS
  323. UNIFORM myModelViewIT WORLDVIEWIT
  324. UNIFORM myMVPMatrix WORLDVIEWPROJECTION
  325. UNIFORM myLightDirection LIGHTDIRECTION
  326. UNIFORM sampler2d TEXTURE0
  327. // ATTRIBUTES
  328. ATTRIBUTE myVertex POSITION
  329. ATTRIBUTE myNormal NORMAL
  330. ATTRIBUTE myUV UV
  331. VERTEXSHADER balloon_vert4
  332. FRAGMENTSHADER balloon_frag4
  333. TEXTURE 0 Balloon
  334. [/EFFECT]
  335. //Effect 5 /////////////////////////////////////////////////////////////////////
  336. //
  337. // This effect gives a sort of liquid metal effect by only using the skybox
  338. // cubemap as the source for texturing and manipulating the vertex position in
  339. // the vertex shader.
  340. //
  341. [VERTEXSHADER]
  342. NAME balloon_vert5
  343. [GLSL_CODE]
  344. attribute vec3 myVertex;
  345. attribute vec3 myNormal;
  346. uniform mat4 myMVPMatrix;
  347. uniform mat3 myModelViewIT;
  348. uniform mat4 myModelView;
  349. uniform mediump mat3 myViewIT;
  350. varying mediump vec3 Normal;
  351. varying mediump vec3 EyeDir;
  352. varying highp vec3 CubeUVs;
  353. uniform mediump float myFrame;
  354. uniform mediump float fAnim;
  355. void main(void)
  356. {
  357. highp vec3 tVertex = myVertex;
  358. highp float fValue = 3.0 * myFrame * radians(360.0/500.0) - 0.1 * myVertex.y;
  359. if(myVertex.y > -0.1)
  360. {
  361. mediump float fValue2 = fAnim * (1.0 + 0.3 * cos(fValue));
  362. tVertex.x *= fValue2;
  363. tVertex.z *= fValue2;
  364. tVertex.y *= fAnim * fAnim;
  365. }
  366. mediump vec4 tVertex4 = vec4(tVertex,1);
  367. EyeDir = vec3(0.0,-1.0,0.0) - vec3(myModelView * tVertex4);
  368. if(myVertex.y > -0.1)
  369. Normal = normalize(myModelViewIT * (myNormal+ sin(fValue))) ;
  370. else
  371. Normal = normalize(myModelViewIT * myNormal) ;
  372. mediump vec3 n;
  373. n = 0.7 * (dot(EyeDir , Normal) * Normal - EyeDir);
  374. CubeUVs = myViewIT * normalize(-1.0 * (EyeDir + n));
  375. gl_Position = myMVPMatrix * tVertex4;
  376. }
  377. [/GLSL_CODE]
  378. [/VERTEXSHADER]
  379. [FRAGMENTSHADER]
  380. NAME balloon_frag5
  381. [GLSL_CODE]
  382. uniform samplerCube myCubeMap;
  383. varying highp vec3 CubeUVs;
  384. void main (void)
  385. {
  386. gl_FragColor = textureCube(myCubeMap, CubeUVs);
  387. }
  388. [/GLSL_CODE]
  389. [/FRAGMENTSHADER]
  390. [EFFECT]
  391. NAME balloon_effect5
  392. // GLOBALS UNIFORMS
  393. UNIFORM myModelViewIT WORLDVIEWIT
  394. UNIFORM myMVPMatrix WORLDVIEWPROJECTION
  395. UNIFORM myModelView WORLDVIEW
  396. UNIFORM myViewIT VIEWIT
  397. UNIFORM myCubeMap TEXTURE0
  398. // ATTRIBUTES
  399. ATTRIBUTE myVertex POSITION
  400. ATTRIBUTE myNormal NORMAL
  401. VERTEXSHADER balloon_vert5
  402. FRAGMENTSHADER balloon_frag5
  403. TEXTURE 0 Skybox
  404. [/EFFECT]
  405. //Effect 6 /////////////////////////////////////////////////////////////////////
  406. //
  407. // Effect 6 is a sort of bouncy cartoon shaded balloon. Once again the vertex
  408. // positions are manipulated to make the balloon bounce. The cartoon effect is
  409. // done by altering the lighting so it can only have 3 possible values. This
  410. // gives it the banded style of shading.
  411. //
  412. [VERTEXSHADER]
  413. NAME balloon_vert6
  414. [GLSL_CODE]
  415. attribute vec3 myVertex;
  416. attribute vec3 myNormal;
  417. attribute vec2 myUV;
  418. uniform mat4 myMVPMatrix;
  419. uniform mat3 myModelViewIT;
  420. uniform mediump vec3 myLightDirection;
  421. uniform mediump float fAnim;
  422. uniform mediump float myFrame;
  423. varying float fDiffuse;
  424. varying lowp vec2 fTexCoord;
  425. void main(void)
  426. {
  427. mediump float anim2 = sin(3.0*myFrame * radians(360.0/500.0))*0.5 + 0.5;
  428. anim2 *= 0.5;
  429. mediump vec3 center = vec3(0.0,30.0,0.0);
  430. mediump vec3 tVertex =((30.0*normalize(myVertex-center)*anim2 + myVertex)*(1.0-anim2)) * fAnim ;
  431. tVertex += 30.0*normalize(myVertex) * (1.0-fAnim);
  432. mediump vec3 fTransNormal = normalize( myModelViewIT * myNormal );
  433. gl_Position = myMVPMatrix * vec4(tVertex,1.0);
  434. fDiffuse = dot(fTransNormal, myLightDirection);
  435. fTexCoord= myUV;
  436. }
  437. [/GLSL_CODE]
  438. [/VERTEXSHADER]
  439. [FRAGMENTSHADER]
  440. NAME balloon_frag6
  441. [GLSL_CODE]
  442. varying highp float fDiffuse;
  443. varying lowp vec2 fTexCoord;
  444. uniform sampler2D sampler2d;
  445. void main (void)
  446. {
  447. lowp vec4 texColor = texture2D(sampler2d,fTexCoord);
  448. mediump float intensity;
  449. if(fDiffuse > 0.67)
  450. intensity = 1.0;
  451. else if(fDiffuse > 0.33)
  452. intensity = 0.67;
  453. else
  454. intensity = 0.33;
  455. gl_FragColor = texColor * intensity;;
  456. }
  457. [/GLSL_CODE]
  458. [/FRAGMENTSHADER]
  459. [EFFECT]
  460. NAME balloon_effect6
  461. // GLOBALS UNIFORMS
  462. UNIFORM myModelViewIT WORLDVIEWIT
  463. UNIFORM myMVPMatrix WORLDVIEWPROJECTION
  464. UNIFORM myLightDirection LIGHTDIRECTION
  465. UNIFORM sampler2d TEXTURE0
  466. // ATTRIBUTES
  467. ATTRIBUTE myVertex POSITION
  468. ATTRIBUTE myNormal NORMAL
  469. ATTRIBUTE myUV UV
  470. VERTEXSHADER balloon_vert6
  471. FRAGMENTSHADER balloon_frag6
  472. TEXTURE 0 Balloon
  473. [/EFFECT]
  474. //Effect 7 /////////////////////////////////////////////////////////////////////
  475. //
  476. // This effect gives impression that the balloon is slightly transparent and
  477. // being affected by wind. This is done by using a noise texture to alter the
  478. // alpha and texture coordinates in the fragment shader.
  479. //
  480. [VERTEXSHADER]
  481. NAME balloon_vert7
  482. [GLSL_CODE]
  483. attribute vec3 myVertex;
  484. attribute vec3 myNormal;
  485. attribute vec2 myUV;
  486. uniform mat4 myMVPMatrix;
  487. uniform mat3 myModelViewIT;
  488. uniform mediump vec3 myLightDirection;
  489. uniform mediump float fAnim;
  490. uniform mediump float myFrame;
  491. varying float fDiffuse;
  492. varying lowp vec2 fTexCoord;
  493. varying highp float fAlpha;
  494. varying mediump float frame;
  495. void main(void)
  496. {
  497. gl_Position = myMVPMatrix * vec4(myVertex,1);
  498. mediump vec3 fTransNormal = myModelViewIT * myNormal;
  499. fDiffuse = 0.1 * dot(fTransNormal, myLightDirection) + 0.9;
  500. fTexCoord = 0.7 * myUV;
  501. fAlpha = fAnim * dot(normalize(fTransNormal), vec3(0.0,0.0,0.5)) * 2.0;
  502. frame = myFrame * 0.02;
  503. }
  504. [/GLSL_CODE]
  505. [/VERTEXSHADER]
  506. [FRAGMENTSHADER]
  507. NAME balloon_frag7
  508. [GLSL_CODE]
  509. varying highp float fDiffuse;
  510. varying lowp vec2 fTexCoord;
  511. varying highp float fAlpha;
  512. varying mediump float frame;
  513. uniform sampler2D sampler2d;
  514. uniform sampler2D Noise;
  515. void main (void)
  516. {
  517. mediump vec2 noisevec = texture2D(Noise, fTexCoord + frame).xy;
  518. mediump vec2 coord2D = fTexCoord + 0.3 * noisevec;
  519. gl_FragColor.rgb = texture2D(sampler2d, coord2D).rgb * fDiffuse;
  520. gl_FragColor.a = fAlpha * noisevec.x;
  521. }
  522. [/GLSL_CODE]
  523. [/FRAGMENTSHADER]
  524. [EFFECT]
  525. NAME balloon_effect7
  526. // GLOBALS UNIFORMS
  527. UNIFORM myModelViewIT WORLDVIEWIT
  528. UNIFORM myMVPMatrix WORLDVIEWPROJECTION
  529. UNIFORM myLightDirection LIGHTDIRECTION
  530. UNIFORM sampler2d TEXTURE0
  531. UNIFORM Noise TEXTURE1
  532. // ATTRIBUTES
  533. ATTRIBUTE myVertex POSITION
  534. ATTRIBUTE myNormal NORMAL
  535. ATTRIBUTE myUV UV
  536. VERTEXSHADER balloon_vert7
  537. FRAGMENTSHADER balloon_frag7
  538. TEXTURE 0 Balloon_pvr
  539. TEXTURE 1 Noise
  540. [/EFFECT]