Files |  Tutorials |  Articles |  Links |  Home |  Team |  Forum |  Wiki |  Impressum

Aktuelle Zeit: So Nov 10, 2024 20:41

Foren-Übersicht » English » English Programming Forum
Unbeantwortete Themen | Aktive Themen



Ein neues Thema erstellen Auf das Thema antworten  [ 48 Beiträge ]  Gehe zu Seite Vorherige  1, 2, 3, 4
Autor Nachricht
 Betreff des Beitrags:
BeitragVerfasst: Do Sep 16, 2004 10:42 
Offline
DGL Member
Benutzeravatar

Registriert: Mo Sep 23, 2002 19:27
Beiträge: 5812
Programmiersprache: C++
Hm, seems you misunterstood that function. It takes your current vertices list and creates a NEW list out of that, where there are no duplicate vertices anymore. Anyway, since I have stencil shadows implemented using 3DS (via a separate unit and class) and this thread is getting messy, I'd be willing to give you my unit, but since I don't want (for now) it to be released to the public, please use it only for learning purposes and don't give it away. If you're interested, please pm me.

_________________
www.SaschaWillems.de | GitHub | Twitter | GPU Datenbanken (Vulkan, GL, GLES)


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Fr Okt 08, 2004 16:43 
Offline
DGL Member
Benutzeravatar

Registriert: Di Jul 01, 2003 18:59
Beiträge: 887
Wohnort: (The Netherlands)
Programmiersprache: fpc/delphi/java/c#
I need some feedback on the following screenshot (what am i doing wrong?)

I think i need to refine my edge detection routine as it misses one edge, but finds another one?
And it now also looks my stencil is set up wrong again.

Could someone provide some clean feedback as to where is should look?

This is my connectivity routine:

Code:
  1.  
  2. procedure T3DSMesh.SetConnectivity;
  3. var
  4.   A1, A2, B1, B2: GLuint;
  5.   ifaceA, ifaceB, edgeA, edgeB: GLuint;
  6. begin
  7.   for ifaceA := 0 to (FNumIndices div 3)-1 do
  8.       for edgeA := 0 to 2 do
  9.        begin
  10.         Ffaces[ifaceA].neighbour[edgeA] := -1;
  11.        end;
  12.  
  13.   for ifaceA := 0 to (FNumIndices div 3) -1  do
  14.     for ifaceB := ifaceA + 1 to (FNumIndices div 3) - 1 do
  15.       for edgeA := 0 to 2 do
  16.         if FFaces[ifaceA].neighbour[edgeA] <> 0 then
  17.           for edgeB := 0 to 2 do
  18.             begin
  19.             a1 := Ffaces[ifaceA].vertex[edgeA];
  20.             a2 := Ffaces[ifaceB].vertex[(edgeA+1) mod 3];
  21.             b1 := Ffaces[ifaceA].vertex[edgeB];
  22.             b2 := Ffaces[ifaceB].vertex[(edgeB+1) mod 3];
  23.             if ((a1 = b1) and (a2 = b2)) or ((a1 = b2) and (a2 = b1)) then
  24.               begin
  25.                 Ffaces[ifaceA].neighbour[edgeA] := ifaceB;
  26.                 Ffaces[ifaceB].neighbour[edgeB] := ifaceA;
  27.               end;
  28.             end;
  29. end;
  30.  


This is my visibility checking routine:
Code:
  1.  
  2. procedure T3DSMesh.PrepareShadows(lp: T3dPoint);
  3. var
  4.   i: gluint;
  5.   side: glfloat;
  6. begin
  7.     if FNumIndices > 0 then
  8.     begin
  9.   //determine if an face is lit by the light or not
  10.   for i := 0 to (fnumIndices DIV 3) -1 do
  11.     begin
  12.     side := FFaces[i].Plane.a*lp.x
  13.            +FFaces[i].Plane.b*lp.y
  14.            +FFaces[i].Plane.c*lp.z;
  15.     if (side > 0) then //hmmm why
  16.       Ffaces[i].visible := true
  17.     else
  18.       Ffaces[i].visible := false;
  19.     end;
  20.   end;
  21. end;
  22.  


On rendering the shadow i use:
Code:
  1.  
  2.   //use lit faces to render the shadow volume
  3.   for i := 0 to (FNumIndices DIV 3) -1 do
  4.     if Ffaces[i].visible then //go through all visible faces...
  5.      begin
  6.       for j := 0 to 1 do
  7.         begin
  8.          k := Ffaces[i].neighbour[j];
  9.          //an edge occurs when the other face is not visible...
  10.          if (k=-1) or (not Ffaces[k].visible) then
  11.           begin
  12.  


I am sorry to make this thread longer, but i need the public feedback :)


Dateianhänge:
fbp.jpg
fbp.jpg [ 15.29 KiB | 2063-mal betrachtet ]

_________________
http://3das.noeska.com - create adventure games without programming
Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Fr Okt 08, 2004 21:25 
Offline
DGL Member
Benutzeravatar

Registriert: Mo Sep 23, 2002 19:27
Beiträge: 5812
Programmiersprache: C++
Just one quick thought : Have you checked of all normals are correct? If you for example have two coplanar triangles (i.e. every side of the cube), one of the normals may be flipped and that'll cause your shilhouette-detection to think that there is an edge were none should be.

_________________
www.SaschaWillems.de | GitHub | Twitter | GPU Datenbanken (Vulkan, GL, GLES)


Nach oben
 Profil  
Mit Zitat antworten  
Beiträge der letzten Zeit anzeigen:  Sortiere nach  
Ein neues Thema erstellen Auf das Thema antworten  [ 48 Beiträge ]  Gehe zu Seite Vorherige  1, 2, 3, 4
Foren-Übersicht » English » English Programming Forum


Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 5 Gäste


Du darfst keine neuen Themen in diesem Forum erstellen.
Du darfst keine Antworten zu Themen in diesem Forum erstellen.
Du darfst deine Beiträge in diesem Forum nicht ändern.
Du darfst deine Beiträge in diesem Forum nicht löschen.
Du darfst keine Dateianhänge in diesem Forum erstellen.

Suche nach:
Gehe zu:  
cron
  Powered by phpBB® Forum Software © phpBB Group
Deutsche Übersetzung durch phpBB.de
[ Time : 0.028s | 17 Queries | GZIP : On ]