Utilizator:
Parola:
Am uitat parola... | Cont nou!


Articole Resurse Echipe Competiții Proiecte Forum DevBlogs Locuri de muncă GDROMag Issue#1 GDROCon 2007

 
Forum » Programare » Matematică » Matrice cu probleme




Pagina 1 din 1 [ 1 ]

Mesaj Info autor
    Postat la 04 May 2007 19:34:51    Subiect: Matrice cu probleme
Rimio info:

Rimio:

In incercarea de a scrie un mic software renderer (ca un experiment) am dat peste o belea care se pare ca m-a cam rapus pana acum. Se pare ca dupa ce inmultesc vectorii cu matricea de proiectie imi da niste rezultate ciudate (de genul (-1, 1, 0.8siceva) pentru (0, 0, -1)) cand de fapt ar trebui sa-mi dea in pixeli. Uite si cum calculez matricea:

Cod sursă:
  ProjMatrix := DS_IDENTITY;

  ProjMatrix[0, 0] := 2 * n / (r - l);
  ProjMatrix[1, 1] := 2 * n / (t - b);
  ProjMatrix[2, 2] := -(f + n) / (f - n);
  ProjMatrix[3, 3] := 0;
  ProjMatrix[3, 2] := -1;
  ProjMatrix[0, 2] := (r + l) / (r - l);
  ProjMatrix[1, 2] := (t + b) / (t - b);
  ProjMatrix[2, 3] := -2 * f * n / (f - n);

 


unde l, r, u si d sunt left, right, up si down iar n si f sunt clipping plane-urile. Am gasit modelul asta in mai multe locuri, deci tind sa cred ca e corect. Poate gresesc eu undeva. Any ideea ?

If at first you don't succeed, you fail.



Status:
Înregistrat pe:
24 Mar 2007 21:50:44
Vârsta: 23 ani
Mesaje: 800
Locatie: Pitesti, Arges
Programator

 
    Postat la 05 May 2007 13:18:45    Subiect: < fara subiect >
raicuandi info:

raicuandi:

Compilator Delphi dependent de droguri?

Method 2: Move Your Mouse Pointer
If you move your mouse pointer continuously while the data is being returned to Microsoft Excel, the query may not fail. Do not stop moving the mouse until all the data has been returned to Microsoft Excel.


Status:
Înregistrat pe:
24 Mar 2007 21:02:40
Vârsta: 22 ani
Mesaje: 514
Locatie: Adelaide, Australia
Programator

 
    Postat la 05 May 2007 23:13:05    Subiect: < fara subiect >
Rimio info:

Rimio:

Nu de data asta Razz. Cu o matrice de-a lu' OpenGL merge perfect ...

If at first you don't succeed, you fail.



Status:
Înregistrat pe:
24 Mar 2007 21:50:44
Vârsta: 23 ani
Mesaje: 800
Locatie: Pitesti, Arges
Programator

 
    Postat la 05 May 2007 23:28:43    Subiect: < fara subiect >
Rimio info:

Rimio:

Tot cautand pe net am gasit un model nou:
Cod sursă:

  ProjMatrix := DS_IDENTITY;

  fd := 1 / tan(fov/2);
  asp := (r-l) / (b-t);

  ProjMatrix[0, 0] := fd / asp;
  ProjMatrix[1, 1] := fd;
  ProjMatrix[2, 2] := (f + n) / (f - n);
  ProjMatrix[3, 3] := 0;
  ProjMatrix[2, 3] := 2 * f * n / (f - n);
  ProjMatrix[3, 2] := -1;


Se pare ca asta merge bine (adica imi mapeaza corect pe ecran) chiar daca z-ul e putin ciudat (e real, nu scalat cum il are OpenGL) ceea ce nu e neaparat o problema.

If at first you don't succeed, you fail.



Status:
Înregistrat pe:
24 Mar 2007 21:50:44
Vârsta: 23 ani
Mesaje: 800
Locatie: Pitesti, Arges
Programator

 

Pagina 1 din 1 [ 1 ]


Server time: 03:03:14 23.05.2012



[ Termeni si conditii | Contact | F.A.Q. | Funny Pictures ]

© 2006 - 2012 Copyright 7thFACTOR Entertainment - All rights reserved