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

Aktuelle Zeit: So Jul 20, 2025 00:16

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



Ein neues Thema erstellen Auf das Thema antworten  [ 5 Beiträge ] 
Autor Nachricht
 Betreff des Beitrags: Ripples
BeitragVerfasst: Fr Jul 30, 2004 17:18 
Offline
DGL Member
Benutzeravatar

Registriert: Mi Jul 21, 2004 22:39
Beiträge: 360
Wohnort: UK, Scotland
I tryed to implement the ripple effect from Vereshagin Roman Vladimirovich's Q3 BSP Loader, eventualy i got it working, but there is a odd sideeffect from the blending. Fig 1 shows how it should look(strangly it works fine when looking at it from one direction) and Fig 2 shows the screwup. If im correct 2 parts of the "water" are being added together to make a less transparent area. My question is does anyone know a way to stop this. (without resorting to no transparency).

Render Code:
Code:
  1.  
  2.   glColor4f(1, 1, 1,1);
  3.   glEnable(GL_BLEND);
  4.   glBlendFunc(GL_SRC_COLOR, GL_ONE);
  5. //  glDepthMask(false);
  6.   glActiveTextureARB(GL_TEXTURE0_ARB);
  7. {  glEnable(GL_TEXTURE_GEN_S);
  8.   glEnable(GL_TEXTURE_GEN_T);}
  9.   glEnable(GL_TEXTURE_2D);                // Turn on texture mapping and bind the face's texture map
  10.   glBindTexture(GL_TEXTURE_2D, 4{WaterTexture});
  11.  
  12.   glActiveTextureARB(GL_TEXTURE1_ARB);
  13.   glEnable(GL_TEXTURE_2D);
  14.   glBindTexture(GL_TEXTURE_2D, 0);
  15.   For J :=0 to GridSize-1 do
  16.   begin
  17.     glBegin(GL_QUAD_STRIP);
  18.       for I :=0 to GridSize do
  19.       begin
  20.         glNormal3fv(@RealWater[NWater].Normals[I, J+1]);
  21.         glTexCoord2f((I/GridSize), ((J+1)/GridSize));
  22.         glVertex3fv(@RealWater[NWater].Vertex[I, J+1]);
  23.         glNormal3fv(@RealWater[NWater].Normals[I, J]);
  24.         glTexCoord2f((I/GridSize), (J/GridSize));
  25.         glVertex3fv(@RealWater[NWater].Vertex[I, J]);
  26.       end;
  27.     glEnd;
  28.   end;
  29.  // RealWater[NWater].ElapsedTime2 := ElapsedTime;
  30.  
  31.   glColor4f(1, 1, 1, 1);
  32.   glDisable(GL_BLEND);
  33. //  glDepthMask(true);
  34.   glActiveTextureARB(GL_TEXTURE0_ARB);
  35. {  glDisable(GL_TEXTURE_GEN_S);
  36.   glDisable(GL_TEXTURE_GEN_T);  }
  37.  


Dateianhänge:
Dateikommentar: Fig2
Ripples2.jpg [126.69 KiB]
57-mal heruntergeladen
Dateikommentar: Fig1
Ripples1.jpg [131.52 KiB]
57-mal heruntergeladen

_________________
Free Map Editor - Game Requirements - Stucuk.Net
-Stu
Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Fr Jul 30, 2004 20:07 
Offline
DGL Member
Benutzeravatar

Registriert: Mi Jul 21, 2004 22:39
Beiträge: 360
Wohnort: UK, Scotland
Iv managed to make it so particles can create ripples on the water, but i still can't figure out a solution to the blending bug.


Dateianhänge:
Ripples3.jpg [164.2 KiB]
48-mal heruntergeladen

_________________
Free Map Editor - Game Requirements - Stucuk.Net
-Stu
Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Sa Jul 31, 2004 01:12 
Offline
DGL Member
Benutzeravatar

Registriert: Mi Jul 21, 2004 22:39
Beiträge: 360
Wohnort: UK, Scotland
Well i "fixed" it, rearly its more of a "trick".

Code:
  1.  
  2.   glDisable(GL_CULL_FACE);
  3.   glEnable(GL_ALPHA_TEST);
  4.   glEnable(GL_BLEND);
  5.   glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
  6.   glColor4f(1, 1, 1, 0.9);
  7.   glActiveTextureARB(GL_TEXTURE0_ARB);
  8.  
  9.   glEnable(GL_TEXTURE_2D);                // Turn on texture mapping and bind the face's texture map
  10.   glBindTexture(GL_TEXTURE_2D, 6{WaterTexture});
  11.  
  12.   glActiveTextureARB(GL_TEXTURE1_ARB);
  13.   glEnable(GL_TEXTURE_2D);
  14.   glBindTexture(GL_TEXTURE_2D, 0);
  15.   For J :=0 to GridSize-1 do
  16.   begin
  17.     glBegin(GL_QUAD_STRIP);
  18.       for I :=0 to GridSize do
  19.       begin
  20.         glNormal3fv(@RealWater[NWater].Normals[I, J+1]);
  21.         glTexCoord2f((I/GridSize), ((J+1)/GridSize));
  22.         glVertex3fv(@RealWater[NWater].Vertex[I, J+1]);
  23.         glNormal3fv(@RealWater[NWater].Normals[I, J]);
  24.         glTexCoord2f((I/GridSize), (J/GridSize));
  25.         glVertex3fv(@RealWater[NWater].Vertex[I, J]);
  26.       end;
  27.     glEnd;
  28.   end;
  29.  
  30.   glColor4f(1, 1, 1, 1);
  31.   glDisable(GL_BLEND);
  32.   glActiveTextureARB(GL_TEXTURE0_ARB);
  33.  


With blend set to Alpha the colours alpha comes into effect. With a value of 0.9 there is no noticable "addition" between transparent parts of the water(because its hardly transparent but transparent enough to see objects through it)

_________________
Free Map Editor - Game Requirements - Stucuk.Net
-Stu


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Sa Jul 31, 2004 09:53 
Offline
DGL Member
Benutzeravatar

Registriert: Mo Sep 23, 2002 19:27
Beiträge: 5812
Programmiersprache: C++
You said that two parts of the water are drawn over each other. If that's the case, can't you use multitexturing? That would eliminate all the problems that occure if you use blending and multipass.

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


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Sa Jul 31, 2004 10:39 
Offline
DGL Member
Benutzeravatar

Registriert: Mi Jul 21, 2004 22:39
Beiträge: 360
Wohnort: UK, Scotland
well 2 parts arn't drawn exactly over each other but sometimes depending on view parts become under other parts depth wise(due to ripples) and blending seems to make the parts colour "add" when the alpha is low.

_________________
Free Map Editor - Game Requirements - Stucuk.Net
-Stu


Nach oben
 Profil  
Mit Zitat antworten  
Beiträge der letzten Zeit anzeigen:  Sortiere nach  
Ein neues Thema erstellen Auf das Thema antworten  [ 5 Beiträge ] 
Foren-Übersicht » English » English Programming Forum


Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 3 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:  
  Powered by phpBB® Forum Software © phpBB Group
Deutsche Übersetzung durch phpBB.de
[ Time : 0.012s | 16 Queries | GZIP : On ]