27.10.2013 Aufrufe

Weitere Projekt-Dokumentation - von Johannes Singler

Weitere Projekt-Dokumentation - von Johannes Singler

Weitere Projekt-Dokumentation - von Johannes Singler

MEHR ANZEIGEN
WENIGER ANZEIGEN

Erfolgreiche ePaper selbst erstellen

Machen Sie aus Ihren PDF Publikationen ein blätterbares Flipbook mit unserer einzigartigen Google optimierten e-Paper Software.

Abbildung 11: Ein Beispiellauf <strong>von</strong> WaveFront zur Simulation eines Doppelspalts.<br />

Zur Speicherung der Werte haben sich 8-Bit-Ganzzahlen als zu grobkörnig erwiesen. Es<br />

ergeben sich keine kreisrunden Wellen mehr und es kommt zum Überlauf. Eine Genauigkeit <strong>von</strong><br />

16-Bit-Fließkomma (da<strong>von</strong> 10 Bit Mantisse) ist mindestens notwendig, doch hier ” zerfließt“die<br />

Welle sehr schnell und hat außerdem eine größere Wellenlänge als die der 32-Bit-Fließkomma-<br />

Version. Letztere ist dafür noch ein Stück langsamer. Zur Demonstration dieses Sachverhalts<br />

sind alle diese Versionen auswählbar.<br />

3.6.1 Der Pixel Shader zu WaveFront<br />

//WaveFront.psh<br />

//<br />

//Pixel shader for modelling travelling waves<br />

//<br />

//r: 0 wall<br />

// (0,1) exciter with T ~ 1/r or wall (r = 0)<br />

// 1 non-exciter<br />

//g: f(t-T) amplitude last step or current phase (exciter)<br />

//b: f(t) amplitude<br />

//Declare pixel shader version<br />

ps.2.0<br />

dcl_2d s0 //cell state, point sampling<br />

dcl_2d s1 //cell state, bilinear filtering<br />

dcl_2d s5<br />

dcl t0.xy //current cell<br />

dcl t1.xy //4 texture coordinates to sample 8 neighbors<br />

dcl t2.xy //by means of bilinear filtering<br />

dcl t3.xy<br />

dcl t4.xy<br />

//def c0, -1.0, 0.25, 0.1, 0.0159 //-1.0, 0.25, dFactor * deltat^2, T / 2*pi<br />

def c1, 0.5, 2.0, 0.0, 0.0 //0.5, 2.0, 0.0, 0.0<br />

22

Hurra! Ihre Datei wurde hochgeladen und ist bereit für die Veröffentlichung.

Erfolgreich gespeichert!

Leider ist etwas schief gelaufen!