Hallo Liebes Forum,
ich habe bezüglich einem 3D Effekt und zwar dem Motion Blurring. Ich wollte einfach mal in meinem neuen Spiel als Versuch ein Intro machen indem man ein Bild oder ein Logo sozusagen als Maus hat und dieses frei bewegen kann, dies war kein vorerst kein Problem. Jedoch wollte ich weiter gehen und beim bewegen soll ein Motion Blurring entstehen, was ich auch noch hinbekommen habe. Jedoch will ich es so ausschauen lassen wie bei dem Spiel Echoes. Das Spiel ist super und daher habe ich auch die Idee mit dem Intro (Wer das Spiel nicht kennt
http://binaryzoo.com/games/echoes/ Einfach mal Intro selbst austesten). Im Anhang habe ich ein Bild von dem Intro.
Ich habe bis jetzt ein Intro Bild welches ich in zwei Dreiecke render. Und dann habe ich wie in dem Spiel Breakanoid den Motion Blurring Effekt verwendet:
// Vertexformat und Titelbildtextur setzen, Z-Buffer aus
D3D.SetFVF(STitleVertex::dwFVF);
D3D.SetTexture(0, m_pTitle);
// Die vier Vertizes des Titelbilds erstellen (Rechteck)
// Links unten
aVertex[0].vPosition = tbVector3(static_cast<float>(m_CursorPos.x), static_cast<float>(m_CursorPos.y) + 400, 0.5f);
aVertex[0].fRHW = 1.0f;
aVertex[0].Color = tbColor(1.0f, 0.8f, 0.8f);
aVertex[0].vTex0 = tbVector2(0.0f, 1.0f);
// Links oben
aVertex[1].vPosition = tbVector3(static_cast<float>(m_CursorPos.x), static_cast<float>(m_CursorPos.y), 0.0f);
aVertex[1].fRHW = 1.0f;
aVertex[1].Color = tbColor(0.8f, 1.0f, 0.8f);
aVertex[1].vTex0 = tbVector2(0.0f, 0.0f);
// Rechts unten
aVertex[2].vPosition = tbVector3(static_cast<float>(m_CursorPos.x) + 400, static_cast<float>(m_CursorPos.y) + 400, 0.5f);
aVertex[2].fRHW = 1.0f;
aVertex[2].Color = tbColor(0.8f, 0.8f, 1.0f);
aVertex[2].vTex0 = tbVector2(1.0f, 1.0f);
// Rechts oben
aVertex[3].vPosition = tbVector3(static_cast<float>(m_CursorPos.x) + 400, static_cast<float>(m_CursorPos.y), 0.5f);
aVertex[3].fRHW = 1.0f;
aVertex[3].Color = tbColor(1.0f, 1.0f, 0.8f);
aVertex[3].vTex0 = tbVector2(1.0f, 0.0f);
// Als Dreiecksfolge zeichnen
D3D->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, aVertex, sizeof(STitleVertex));
// Motion-Blurring
if(D3D.GetCaps().SrcBlendCaps & D3DPBLENDCAPS_BLENDFACTOR)
{
// Alpha-Blending aktivieren und verhindern, dass in den Z-Buffer geschrieben wird
D3D.SetRS(D3DRS_ZWRITEENABLE, FALSE);
D3D.SetRS(D3DRS_ALPHABLENDENABLE, TRUE);
D3D.SetRS(D3DRS_SRCBLEND, D3DBLEND_BLENDFACTOR);
D3D.SetRS(D3DRS_DESTBLEND, D3DBLEND_INVBLENDFACTOR);
// 9 Samples
for(float f = 0.1f; f <= 1.0f; f += 0.1f)
{
// Blendfaktor (Opazität) dieses Samples bestimmen
DWORD dwFactor = (DWORD)((1.0f - f) * 63.0f);
D3D.SetRS(D3DRS_BLENDFACTOR, 0xFF000000 | dwFactor | (dwFactor <<
| (dwFactor << 16));
//for(DWORD dwVertex = 0; dwVertex < 4; dwVertex++)
//{
// /*aVertex[dwVertex].vTex0.x += sinf(g_pRedemption->m_fTime + (float)(dwVertex)) * CursorPos.x / 100 * 0.01f;
// aVertex[dwVertex].vTex0.y += cosf(g_pRedemption->m_fTime + (float)(dwVertex)) * CursorPos.y / 100 * 0.01f;*/
// aVertex[dwVertex].vTex0.y += cosf(f + (float)(dwVertex)) * m_CursorPos.y / 100 * 0.01f;
// aVertex[dwVertex].vTex0.x += cosf(f + (float)(dwVertex)) * m_CursorPos.y / 100 * 0.01f;
//}
aVertex[0].vTex0.y += cosf(f + (float)(0)) * m_CursorPos.y / 100 * 0.01f;
aVertex[0].vTex0.x += cosf(f + (float)(0)) * m_CursorPos.x / 100 * 0.01f;
aVertex[1].vTex0.y += sinf(f + (float)(1)) * m_CursorPos.y / 100 * 0.01f;
aVertex[1].vTex0.x += sinf(f + (float)(1)) * m_CursorPos.y / 100 * 0.01f;
aVertex[2].vTex0.y += cosf(f + (float)(2)) * m_CursorPos.y / 100 * 0.01f;
aVertex[2].vTex0.x += cosf(f + (float)(2)) * m_CursorPos.x / 100 * 0.01f;
aVertex[3].vTex0.y += cosf(f + (float)(3)) * m_CursorPos.y / 100 * 0.01f;
aVertex[3].vTex0.x += cosf(f + (float)(3)) * m_CursorPos.y / 100 * 0.01f;
// Als Dreiecksfolge zeichnen
D3D->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, aVertex, sizeof(STitleVertex));
}
D3D.SetRS(D3DRS_ZWRITEENABLE, TRUE);
D3D.SetRS(D3DRS_ALPHABLENDENABLE, FALSE);
}
Jedoch komm ich einfach nicht drauf wie ich das so hinkrieg wie bei binary zoo. Das wabbeln wie bei dem Intro werd ich noch selbst hinbekommen. Und dann habe ich noch das Problem das ich immer ein Bild nehmen muss welches groß und schwarz ist und z.B eine Schrift in der MItte steht damit man den Motion Blurring Effekt sehen kann. Jedoch ist man dann eingeschränkt dieses im Bildschirm zu bewegen weil es so groß ist.
Ich hoffe ihr könnt mir helfen.
Grüße Betece