Author Topic: Thrusters and explosions  (Read 15935 times)

0 Members and 1 Guest are viewing this topic.

Offline Valathil

  • ...And I would have had a custom title if it wasn't for you meddling kids!
  • 29
  • Custom Title? Wizards need no Custom Title!
Thrusters and explosions
To avoid another Disco incident Im gonna put a test build here. Look at it and tell me if theres anything wrong. I cant make a patch cuz tortoise svn only tell me the changes to my last commit not to the repository any help there would also be appreciated

http://www.mediafire.com/?2eb0q2gb2j629b4
┏┓╋┏┓╋╋╋╋╋╋╋╋╋┏┓
┃┃╋┃┃╋╋╋╋╋╋╋╋╋┃┃
┃┃┏┫┃┏┳━━┓┏━━┓┃┗━┳━━┳━━┳━━┓
┃┃┣┫┗┛┫┃━┫┃┏┓┃┃┏┓┃┏┓┃━━┫━━┫
┃┗┫┃┏┓┫┃━┫┃┏┓┃┃┗┛┃┗┛┣━━┣━━┃
┗━┻┻┛┗┻━━┛┗┛┗┛┗━━┻━━┻━━┻━━┛

 

Offline Commander Zane

  • 212
  • Spoot Knight of Anvils
Re: Thrusters and explosions
It says the address isn't valid when I click the link to download it.
Works now, I'll take a look at it. :D
« Last Edit: August 21, 2011, 11:31:29 am by Commander Zane »

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
Re: Thrusters and explosions
right click on directory->click on show log->right click on revision you want a diff against->show as unified diff

IIRC
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3


DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together

 

Offline Commander Zane

  • 212
  • Spoot Knight of Anvils
Re: Thrusters and explosions
Woo gAyTI strikes again with royally disgusting visual ****ups.


Here what's supposed to be thruster distortion is putting holes all over my Perseus, and covering up that Orion and the Hecate behind said Orion in a giant black box.


And here, instead of a heat wave, the entire Massive Battle area is engulfed in a black circle of nothing. At least almost anyway, that last bit of the Hatshesput can still be seen but as the shockwave expanded it eventually was covered as well.

I'd log it but only an r.exe was provided.

 

Offline Valathil

  • ...And I would have had a custom title if it wasn't for you meddling kids!
  • 29
  • Custom Title? Wizards need no Custom Title!
┏┓╋┏┓╋╋╋╋╋╋╋╋╋┏┓
┃┃╋┃┃╋╋╋╋╋╋╋╋╋┃┃
┃┃┏┫┃┏┳━━┓┏━━┓┃┗━┳━━┳━━┳━━┓
┃┃┣┫┗┛┫┃━┫┃┏┓┃┃┏┓┃┏┓┃━━┫━━┫
┃┗┫┃┏┓┫┃━┫┃┏┓┃┃┗┛┃┗┛┣━━┣━━┃
┗━┻┻┛┗┻━━┛┗┛┗┛┗━━┻━━┻━━┻━━┛

 

Offline Commander Zane

  • 212
  • Spoot Knight of Anvils
Re: Thrusters and explosions
Unfortunately that had no effect. :(

 

Offline Valathil

  • ...And I would have had a custom title if it wasn't for you meddling kids!
  • 29
  • Custom Title? Wizards need no Custom Title!
Re: Thrusters and explosions
Unfortunately that had no effect. :(

Did it at least remove the artifacts on the perseus
┏┓╋┏┓╋╋╋╋╋╋╋╋╋┏┓
┃┃╋┃┃╋╋╋╋╋╋╋╋╋┃┃
┃┃┏┫┃┏┳━━┓┏━━┓┃┗━┳━━┳━━┳━━┓
┃┃┣┫┗┛┫┃━┫┃┏┓┃┃┏┓┃┏┓┃━━┫━━┫
┃┗┫┃┏┓┫┃━┫┃┏┓┃┃┗┛┃┗┛┣━━┣━━┃
┗━┻┻┛┗┻━━┛┗┛┗┛┗━━┻━━┻━━┻━━┛

 

Offline Commander Zane

  • 212
  • Spoot Knight of Anvils
Re: Thrusters and explosions
Artifacts are still present.

 

Offline Some14U

  • 23
Re: Thrusters and explosions
What AMD card and driver you are running on?

 

Offline Commander Zane

  • 212
  • Spoot Knight of Anvils
Re: Thrusters and explosions
5870 on 11.4, I read 11.5 had other issues and using 11.6 gave me transparency issues. I haven't tried 11.7 or 11.8 yet though I'm sceptical as all hell to even touching them.

 

Offline The E

  • He's Ebeneezer Goode
  • Moderator
  • 213
  • Nothing personal, just tech support.
    • Steam
    • Twitter
Re: Thrusters and explosions
11.8 at least is pretty good so far.
If I'm just aching this can't go on
I came from chasing dreams to feel alone
There must be changes, miss to feel strong
I really need lifе to touch me
--Evergrey, Where August Mourns

 

Offline Commander Zane

  • 212
  • Spoot Knight of Anvils
Re: Thrusters and explosions
I'll give it a try then.

 

Offline Valathil

  • ...And I would have had a custom title if it wasn't for you meddling kids!
  • 29
  • Custom Title? Wizards need no Custom Title!
Re: Thrusters and explosions
how about now fixed a shader issue: http://www.mediafire.com/?q0c5vexyfxkmpgw

and got a patch
Code: [Select]
Index: code/cmdline/cmdline.cpp
===================================================================
--- code/cmdline/cmdline.cpp (revision 7508)
+++ code/cmdline/cmdline.cpp (working copy)
@@ -172,6 +172,7 @@
 
  { "-ingame_join", "Allow in-game joining", true, 0, EASY_DEFAULT, "Experimental", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-ingame_join", },
  { "-voicer", "Enable voice recognition", true, 0, EASY_DEFAULT, "Experimental", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-voicer", },
+ { "-fb_explosions", "Enable Framebuffer Shockwaves", true, 0, EASY_DEFAULT, "Experimental", "", },
 
  { "-fps", "Show frames per second on HUD", false, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-fps", },
  { "-pos", "Show position of camera", false, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-pos", },
@@ -267,6 +268,7 @@
 cmdline_parm bloom_intensity_arg("-bloom_intensity", NULL);
 cmdline_parm fxaa_arg("-fxaa", NULL);
 cmdline_parm fxaa_preset_arg("-fxaa_preset", NULL);
+cmdline_parm fb_explosions_arg("-fb_explosions", NULL);
 
 float Cmdline_clip_dist = Default_min_draw_distance;
 float Cmdline_fov = 0.75f;
@@ -289,6 +291,7 @@
 bool Cmdline_fxaa = false;
 int Cmdline_fxaa_preset = 6;
 extern int Fxaa_preset_last_frame;
+bool Cmdline_fb_explosions = 0;
 
 // Game Speed related
 cmdline_parm cache_bitmaps_arg("-cache_bitmaps", NULL); // Cmdline_cache_bitmaps
@@ -1429,6 +1432,11 @@
  Cmdline_softparticles = 1;
  }
 
+ if ( fb_explosions_arg.found() )
+ {
+ Cmdline_fb_explosions = 1;
+ }
+
  if ( postprocess_arg.found() )
  {
  Cmdline_postprocess = 1;
Index: code/cmdline/cmdline.h
===================================================================
--- code/cmdline/cmdline.h (revision 7508)
+++ code/cmdline/cmdline.h (working copy)
@@ -76,6 +76,7 @@
 extern int Cmdline_bloom_intensity;
 extern bool Cmdline_fxaa;
 extern int Cmdline_fxaa_preset;
+extern bool Cmdline_fb_explosions;
 
 // Game Speed related
 extern int Cmdline_cache_bitmaps;
Index: code/globalincs/def_files.cpp
===================================================================
--- code/globalincs/def_files.cpp (revision 7508)
+++ code/globalincs/def_files.cpp (working copy)
@@ -2194,10 +2194,16 @@
 uniform float nearZ; \n\
 uniform float farZ; \n\
  \n\
-varying float radius; \n\
+varying float radius; \n\
+ \n\
+#ifdef FLAG_DISTORTION \n\
+uniform sampler2D distMap; \n\
+uniform sampler2D frameBuffer; \n\
+#endif \n\
  \n\
 void main() \n\
 { \n\
+ #ifndef FLAG_DISTORTION \n\
  vec2 offset = vec2( \n\
  radius * abs(0.5 - gl_TexCoord[0].x) * 2.0, \n\
  radius * abs(0.5 - gl_TexCoord[0].y) * 2.0 \n\
@@ -2236,5 +2242,17 @@
  fragmentColor = fragmentColor * ( ds / (depthOffset*2.0) ); \n\
  \n\
  gl_FragColor = fragmentColor; \n\
+ #else \n\
+ vec2 depthCoord = vec2( \n\
+ gl_FragCoord.x / window_width, \n\
+ gl_FragCoord.y / window_height \n\
+ ); \n\
+ vec4 fragmentColor = texture2D(baseMap, gl_TexCoord[0].xy)*gl_Color.a; \n\
+ vec2 distortion = texture2D(distMap, gl_TexCoord[0].xy).rg; \n\
+ float alpha = clamp(dot(fragmentColor.rgb,vec3(0.3333))*5.0,0.0,1.0); \n\
+ distortion = ((distortion - 0.5) * 0.01) * alpha; \n\
+ gl_FragColor = texture2D(frameBuffer,depthCoord+distortion); \n\
+ gl_FragColor.a = alpha; \n\
+ #endif \n\
 } \n\
 ";
\ No newline at end of file
Index: code/graphics/grbatch.cpp
===================================================================
--- code/graphics/grbatch.cpp (revision 7508)
+++ code/graphics/grbatch.cpp (working copy)
@@ -405,6 +405,7 @@
 {
  vec3d p[4];
  vertex *P = &vert[n_to_render * 3];
+ float *R = &radius_list[n_to_render * 3];
 
  vec3d fvec, uvecs, uvece, evec;
 
@@ -456,10 +457,11 @@
 
  for(int i = 0; i < 6; i++){
  P[i].r = P[i].g = P[i].b = P[i].a = _color;
+ R[i] = width;
  }
 
  n_to_render += 2;
- use_radius = false;
+ use_radius = true;
 }
 
 float geometry_batcher::draw_laser(vec3d *p0, float width1, vec3d *p1, float width2, int r, int g, int b)
@@ -559,10 +561,8 @@
 void geometry_batcher::render(int flags, float radius)
 {
  if (n_to_render) {
- if ( (flags & TMAP_FLAG_SOFT_QUAD) && Cmdline_softparticles && use_radius ) {
- int zbuff = gr_zbuffer_set(GR_ZBUFF_NONE);
+ if ( (((flags & TMAP_FLAG_SOFT_QUAD) && Cmdline_softparticles)) || (flags & TMAP_FLAG_DISTORTION) || (flags & TMAP_FLAG_DISTORTION_THRUSTER) && use_radius ) {
  gr_render_effect(n_to_render * 3, vert, radius_list, flags | TMAP_FLAG_TRILIST);
- gr_zbuffer_set(zbuff);
  } else {
  gr_render(n_to_render * 3, vert, flags | TMAP_FLAG_TRILIST);
  }
@@ -714,7 +714,14 @@
  continue;
 
  Assert( bi->texture >= 0 );
- gr_set_bitmap(bi->texture, GR_ALPHABLEND_FILTER, GR_BITBLT_MODE_NORMAL, bi->alpha);
+ if(bi->tmap_flags & TMAP_FLAG_DISTORTION)
+ {
+ gr_set_bitmap(bi->texture, GR_ALPHABLEND_NONE, GR_BITBLT_MODE_NORMAL, bi->alpha);
+ }
+ else
+ {
+ gr_set_bitmap(bi->texture, GR_ALPHABLEND_FILTER, GR_BITBLT_MODE_NORMAL, bi->alpha);
+ }
  bi->batch.render( bi->tmap_flags);
  }
 }
Index: code/graphics/gropengldraw.cpp
===================================================================
--- code/graphics/gropengldraw.cpp (revision 7508)
+++ code/graphics/gropengldraw.cpp (working copy)
@@ -32,12 +32,17 @@
 #include "nebula/neb.h"
 #include "graphics/gropenglshader.h"
 #include "graphics/gropenglpostprocessing.h"
+#include "freespace2/freespace.h"
 
 GLuint Scene_framebuffer;
 GLuint Scene_color_texture;
 GLuint Scene_effect_texture;
 GLuint Scene_depth_texture;
 
+GLuint Distortion_framebuffer;
+GLuint Distortion_texture[2];
+int Distortion_switch = 0;
+
 int Scene_texture_initialized;
 bool Scene_framebuffer_in_frame;
 
@@ -1269,7 +1274,7 @@
  float u_scale = 1.0f, v_scale = 1.0f;
  GLenum gl_mode = GL_TRIANGLE_FAN;
  int attrib_index = -1;
-
+ int zbuff,zbuffsaved=0;
  GL_CHECK_FOR_ERRORS("start of render3d()");
 
  Assert(Scene_depth_texture != 0);
@@ -1278,8 +1283,38 @@
 
  if ( flags & TMAP_FLAG_TEXTURED ) {
  if ( flags & TMAP_FLAG_SOFT_QUAD ) {
- int sdr_index = opengl_shader_get_index(SDR_FLAG_SOFT_QUAD);
- opengl_shader_set_current(&GL_shader[sdr_index]);
+ int sdr_index;
+ if( (flags & TMAP_FLAG_DISTORTION) || (flags & TMAP_FLAG_DISTORTION_THRUSTER) )
+ {
+ glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
+ sdr_index = opengl_shader_get_index(SDR_FLAG_SOFT_QUAD|SDR_FLAG_DISTORTION);
+ opengl_shader_set_current(&GL_shader[sdr_index]);
+
+ vglUniform1iARB(opengl_shader_get_uniform("frameBuffer"), 2);
+
+ GL_state.Texture.SetActiveUnit(2);
+ GL_state.Texture.SetTarget(GL_TEXTURE_2D);
+ GL_state.Texture.Enable(Scene_effect_texture);
+ GL_state.Texture.SetActiveUnit(3);
+ GL_state.Texture.SetTarget(GL_TEXTURE_2D);
+ if(flags & TMAP_FLAG_DISTORTION_THRUSTER)
+ {
+ vglUniform1iARB(opengl_shader_get_uniform("distMap"), 3);
+ GL_state.Texture.Enable(Distortion_texture[!Distortion_switch]);
+ }
+ else
+ {
+ vglUniform1iARB(opengl_shader_get_uniform("distMap"), 0);
+ GL_state.Texture.Disable();
+ }
+ }
+ else
+ {
+ sdr_index = opengl_shader_get_index(SDR_FLAG_SOFT_QUAD);
+ opengl_shader_set_current(&GL_shader[sdr_index]);
+ zbuff = gr_zbuffer_set(GR_ZBUFF_NONE);
+ zbuffsaved = 1;
+ }
 
  vglUniform1iARB(opengl_shader_get_uniform("baseMap"), 0);
  vglUniform1iARB(opengl_shader_get_uniform("depthMap"), 1);
@@ -1308,6 +1343,7 @@
 
  GLboolean cull_face = GL_state.CullFace(GL_FALSE);
  GLboolean lighting = GL_state.Lighting(GL_FALSE);
+ GLboolean mask = GL_state.DepthMask(GL_FALSE);
 
  if (flags & TMAP_FLAG_TRILIST) {
  gl_mode = GL_TRIANGLES;
@@ -1338,6 +1374,12 @@
  GL_state.Texture.SetActiveUnit(1);
  GL_state.Texture.Disable();
 
+ GL_state.Texture.SetActiveUnit(2);
+ GL_state.Texture.Disable();
+
+ GL_state.Texture.SetActiveUnit(3);
+ GL_state.Texture.Disable();
+
  glDisableClientState(GL_TEXTURE_COORD_ARRAY);
  glDisableClientState(GL_VERTEX_ARRAY);
  glDisableClientState(GL_COLOR_ARRAY);
@@ -1348,7 +1390,13 @@
 
  GL_state.CullFace(cull_face);
  GL_state.Lighting(lighting);
+ GL_state.DepthMask(mask);
+ if(zbuffsaved)
+ gr_zbuffer_set(zbuff);
 
+ GLenum buffers[] = { GL_COLOR_ATTACHMENT0_EXT, GL_COLOR_ATTACHMENT1_EXT };
+ vglDrawBuffers(2, buffers);
+
  GL_CHECK_FOR_ERRORS("end of render3d()");
 }
 
@@ -1924,13 +1972,6 @@
 {
  Scene_texture_initialized = 0;
 
- if ( !Cmdline_postprocess && !Cmdline_softparticles ) {
- Scene_color_texture = 0;
- Scene_effect_texture = 0;
- Scene_depth_texture = 0;
- return;
- }
-
  if ( !Use_GLSL || Cmdline_no_fbo || !Is_Extension_Enabled(OGL_EXT_FRAMEBUFFER_OBJECT) ) {
  Cmdline_postprocess = 0;
  Cmdline_softparticles = 0;
@@ -2045,6 +2086,50 @@
  return;
  }
 
+ //Setup thruster distortion framebuffer
+ vglGenFramebuffersEXT(1, &Distortion_framebuffer);
+ vglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, Distortion_framebuffer);
+
+ glGenTextures(2, Distortion_texture);
+
+ GL_state.Texture.SetActiveUnit(0);
+ GL_state.Texture.SetTarget(GL_TEXTURE_2D);
+ GL_state.Texture.Enable(Distortion_texture[0]);
+
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_R, GL_REPEAT);
+
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 32, 32, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, NULL);
+
+ GL_state.Texture.Enable(Distortion_texture[1]);
+
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_R, GL_REPEAT);
+
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 32, 32, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, NULL);
+
+ vglFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, Distortion_texture[0], 0);
+
+
+
+ if ( opengl_check_framebuffer() ) {
+ vglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+ vglDeleteFramebuffersEXT(1, &Distortion_framebuffer);
+ Distortion_framebuffer = 0;
+
+ GL_state.Texture.Disable();
+
+ glDeleteTextures(2, Distortion_texture);
+ Scene_color_texture = 0;
+ return;
+ }
+
  if ( opengl_check_for_errors("post_init_framebuffer()") ) {
  Scene_color_texture = 0;
  Scene_depth_texture = 0;
@@ -2086,6 +2171,17 @@
  Scene_framebuffer = 0;
  }
 
+ if ( Distortion_texture ) {
+ glDeleteTextures(2, Distortion_texture);
+ Distortion_texture[0] = 0;
+ Distortion_texture[1] = 0;
+ }
+
+ if ( Distortion_framebuffer ) {
+ vglDeleteFramebuffersEXT(1, &Distortion_framebuffer);
+ Distortion_framebuffer = 0;
+ }
+
  Scene_texture_initialized = 0;
  Scene_framebuffer_in_frame = false;
 }
@@ -2111,12 +2207,20 @@
  Scene_framebuffer_in_frame = true;
 }
 
+float time_buffer = 0.0f;
 void gr_opengl_scene_texture_end()
 {
  if ( !Scene_framebuffer_in_frame ) {
  return;
  }
-
+
+ time_buffer+=flFrametime;
+ if(time_buffer>0.03f)
+ {
+ gr_opengl_update_distortion();
+ time_buffer = 0.0f;
+ }
+
  if ( Cmdline_postprocess && !PostProcessing_override ) {
  gr_post_process_end();
  } else {
@@ -2163,3 +2267,62 @@
 
  Scene_framebuffer_in_frame = false;
 }
+
+void gr_opengl_update_distortion()
+{
+ GLboolean depth = GL_state.DepthTest(GL_FALSE);
+ GLboolean depth_mask = GL_state.DepthMask(GL_FALSE);
+ GLboolean light = GL_state.Lighting(GL_FALSE);
+ GLboolean blend = GL_state.Blend(GL_FALSE);
+ GLboolean cull = GL_state.CullFace(GL_FALSE);
+
+ opengl_shader_set_current();
+ vglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, Distortion_framebuffer);
+ vglFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, Distortion_texture[!Distortion_switch], 0);
+ glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
+
+ glViewport(0,0,32,32);
+ GL_state.Texture.SetActiveUnit(0);
+ GL_state.Texture.SetTarget(GL_TEXTURE_2D);
+ GL_state.Texture.Enable(Distortion_texture[Distortion_switch]);
+ glClearColor(0.5f, 0.5f, 0.0f, 1.0f);
+ glClear(GL_COLOR_BUFFER_BIT);
+ glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
+
+ glBegin(GL_QUADS);
+ glTexCoord2f(0.0f, 0.0f);
+ glVertex2f(0.03f*(float)gr_screen.max_w,(float)gr_screen.max_h);
+
+ glTexCoord2f(0.96875f, 0.0f);
+ glVertex2f((float)gr_screen.max_w, (float)gr_screen.max_h);
+
+ glTexCoord2f(0.96875f, 1.0f);
+ glVertex2f((float)gr_screen.max_w, 0.0f);
+
+ glTexCoord2f(0.0f, 1.0f);
+ glVertex2f(0.03f*(float)gr_screen.max_w, 0.0f);
+ glEnd();
+ GL_state.Texture.Disable();
+ glBegin(GL_POINTS);
+ for(int i = 0; i < 33; i++)
+ {
+ glColor4ub(rand()%256, rand()%256 ,255, 255);
+ glVertex2f(0.04f, (float)gr_screen.max_h*0.03125f*i);
+ }
+ glEnd();
+ Distortion_switch = !Distortion_switch;
+
+ // reset state
+ vglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, Scene_framebuffer);
+
+ glViewport(0,0,gr_screen.max_w,gr_screen.max_h);
+
+ GLenum buffers[] = { GL_COLOR_ATTACHMENT0_EXT, GL_COLOR_ATTACHMENT1_EXT };
+ vglDrawBuffers(2, buffers);
+
+ GL_state.DepthTest(depth);
+ GL_state.DepthMask(depth_mask);
+ GL_state.Lighting(light);
+ GL_state.Blend(blend);
+ GL_state.CullFace(cull);
+}
Index: code/graphics/gropengldraw.h
===================================================================
--- code/graphics/gropengldraw.h (revision 7508)
+++ code/graphics/gropengldraw.h (working copy)
@@ -32,6 +32,7 @@
 void gr_opengl_render(int nverts, vertex *verts, uint flags);
 void gr_opengl_render_effect(int nverts, vertex *verts, float *radius_list, uint flags);
 void gr_opengl_bitmap_ex(int x, int y, int w, int h, int sx, int sy, bool resize);
+void gr_opengl_update_distortion();
 
 void opengl_render_timer_bar(int colour, float x, float y, float w, float h);
 void opengl_set_spec_mapping(int tmap_type, float *u_scale, float *v_scale, int stage = 0);
Index: code/graphics/gropenglshader.cpp
===================================================================
--- code/graphics/gropenglshader.cpp (revision 7508)
+++ code/graphics/gropenglshader.cpp (working copy)
@@ -305,7 +305,10 @@
  4, { "sSpecmap", "sNormalmap", "sHeightmap", "n_lights" }, 0, { NULL } }*/
 
  { "soft-v.sdr", "soft-f.sdr", (SDR_FLAG_SOFT_QUAD),
- 6, {"baseMap", "depthMap", "window_width", "window_height", "nearZ", "farZ"}, 1, { "radius_in" } }
+ 6, {"baseMap", "depthMap", "window_width", "window_height", "nearZ", "farZ"}, 1, { "radius_in" } },
+
+ { "soft-v.sdr", "soft-f.sdr", (SDR_FLAG_SOFT_QUAD | SDR_FLAG_DISTORTION),
+ 8, {"baseMap", "depthMap", "window_width", "window_height", "nearZ", "farZ", "distMap", "frameBuffer"}, 1, { "radius_in" } }
 };
 
 static const int Num_shader_files = sizeof(GL_shader_file) / sizeof(opengl_shader_file_t);
@@ -440,6 +443,10 @@
  if (flags & SDR_FLAG_ANIMATED) {
  sflags += "#define FLAG_ANIMATED\n";
  }
+
+ if (flags & SDR_FLAG_DISTORTION) {
+ sflags += "#define FLAG_DISTORTION\n";
+ }
  }
 
 
Index: code/graphics/gropenglshader.h
===================================================================
--- code/graphics/gropenglshader.h (revision 7508)
+++ code/graphics/gropenglshader.h (working copy)
@@ -36,6 +36,7 @@
 #define SDR_FLAG_ENV_MAP (1<<15)
 #define SDR_FLAG_ANIMATED (1<<16)
 #define SDR_FLAG_SOFT_QUAD (1<<17)
+#define SDR_FLAG_DISTORTION (1<<18)
 
 #define MAX_SHADER_UNIFORMS 15
 
Index: code/graphics/tmapper.h
===================================================================
--- code/graphics/tmapper.h (revision 7508)
+++ code/graphics/tmapper.h (working copy)
@@ -78,6 +78,12 @@
 // use soft particle shader - Swifty
 #define TMAP_FLAG_SOFT_QUAD (1<<20)
 
+// use framebuffer distortion mapping with generated distortion map - Valathil
+#define TMAP_FLAG_DISTORTION_THRUSTER (1<<21)
+
+// use framebuffer distortion mapping  - Valathil
+#define TMAP_FLAG_DISTORTION (1<<22)
+
 #define TMAP_ADDRESS_WRAP 1
 #define TMAP_ADDRESS_MIRROR 2
 #define TMAP_ADDRESS_CLAMP 3
Index: code/model/modelinterp.cpp
===================================================================
--- code/model/modelinterp.cpp (revision 7508)
+++ code/model/modelinterp.cpp (working copy)
@@ -2527,8 +2527,8 @@
 // Int3();
 }
 
-geometry_batcher primary_thruster_batcher, secondary_thruster_batcher, tertiary_thruster_batcher;
-
+geometry_batcher primary_thruster_batcher, secondary_thruster_batcher, tertiary_thruster_batcher, distortion_thruster_batcher;
+extern bool Scene_framebuffer_in_frame;
 // maybe draw mode thruster glows
 void model_render_thrusters(polymodel *pm, int objnum, ship *shipp, matrix *orient, vec3d *pos)
 {
@@ -2566,6 +2566,7 @@
 
  if (Interp_secondary_thrust_glow_bitmap >= 0) {
  secondary_thruster_batcher.allocate(n_q);
+ distortion_thruster_batcher.allocate(n_q);
  do_render = true;
  }
 
@@ -2758,6 +2759,11 @@
  }
 
  secondary_thruster_batcher.draw_beam(&pnt, &norm2, wVal*Interp_secondary_thrust_glow_rad_factor*0.5f, d);
+ if(Scene_framebuffer_in_frame)
+ {
+ vm_vec_scale_add(&norm2, &pnt, &fvec, wVal * 4 * Interp_thrust_glow_len_factor);
+ distortion_thruster_batcher.draw_beam(&pnt, &norm2, wVal*Interp_secondary_thrust_glow_rad_factor, 1.0f);
+ }
  }
  }
  // end secondary glows
@@ -2818,7 +2824,9 @@
  }*/
 
  if (Interp_secondary_thrust_glow_bitmap >= 0) {
- gr_set_bitmap(Interp_secondary_thrust_glow_bitmap, GR_ALPHABLEND_FILTER, GR_BITBLT_MODE_NORMAL, 1.0f);
+ gr_set_bitmap(Interp_secondary_thrust_glow_bitmap, GR_ALPHABLEND_NONE, GR_BITBLT_MODE_NORMAL, 1.0f);
+ distortion_thruster_batcher.render(TMAP_FLAG_GOURAUD | TMAP_FLAG_RGB | TMAP_FLAG_TEXTURED | TMAP_FLAG_CORRECT | TMAP_HTL_3D_UNLIT | TMAP_FLAG_DISTORTION_THRUSTER | TMAP_FLAG_SOFT_QUAD);
+ gr_set_bitmap(Interp_secondary_thrust_glow_bitmap, GR_ALPHABLEND_FILTER, GR_BITBLT_MODE_NORMAL, 1.0f);
  secondary_thruster_batcher.render(TMAP_FLAG_GOURAUD | TMAP_FLAG_RGB | TMAP_FLAG_TEXTURED | TMAP_FLAG_CORRECT | TMAP_HTL_3D_UNLIT);
  }
 
Index: code/weapon/shockwave.cpp
===================================================================
--- code/weapon/shockwave.cpp (revision 7508)
+++ code/weapon/shockwave.cpp (working copy)
@@ -92,6 +92,7 @@
 extern int Show_area_effect;
 extern int Cmdline_nohtl;
 extern int Cmdline_enable_3d_shockwave;
+extern bool Cmdline_fb_explosions;
 
 
 // ------------------------------------------------------------------------------------
@@ -464,20 +465,46 @@
  model_render( sw->model_id, &Objects[sw->objnum].orient, &sw->pos, MR_NO_LIGHTING | MR_NO_FOGGING | MR_NORMAL | MR_CENTER_ALPHA | MR_NO_CULL, sw->objnum);
 
  model_set_warp_globals();
+ if(Cmdline_fb_explosions)
+ {
+ g3_transfer_vertex(&p, &sw->pos);
+
+ batch_add_bitmap_rotated(
+ Shockwave_info[1].bitmap_id+shockwave_get_framenum(objp->instance, 94),
+ TMAP_FLAG_TEXTURED | TMAP_HTL_3D_UNLIT | TMAP_FLAG_SOFT_QUAD | TMAP_FLAG_DISTORTION,
+ &p,
+ fl_radians(sw->rot_angles.p),
+ sw->radius,
+ ((sw->time_elapsed/sw->total_time)>0.9f)?(1.0f-(sw->time_elapsed/sw->total_time))*10.0f:1.0f
+ );
+ }
  }else{
  if (!Cmdline_nohtl) {
  g3_transfer_vertex(&p, &sw->pos);
  } else {
  g3_rotate_vertex(&p, &sw->pos);
  }
-
- batch_add_bitmap_rotated(
- sw->current_bitmap,
- TMAP_FLAG_TEXTURED | TMAP_HTL_3D_UNLIT | TMAP_FLAG_SOFT_QUAD,
- &p,
- fl_radians(sw->rot_angles.p),
- sw->radius
- );
+ if(Cmdline_fb_explosions)
+ {
+ batch_add_bitmap_rotated(
+ sw->current_bitmap,
+ TMAP_FLAG_TEXTURED | TMAP_HTL_3D_UNLIT | TMAP_FLAG_SOFT_QUAD | TMAP_FLAG_DISTORTION,
+ &p,
+ fl_radians(sw->rot_angles.p),
+ sw->radius,
+ ((sw->time_elapsed/sw->total_time)>0.9f)?(1.0f-(sw->time_elapsed/sw->total_time))*10.0f:1.0f
+ );
+ }
+ else
+ {
+ batch_add_bitmap_rotated(
+ sw->current_bitmap,
+ TMAP_FLAG_TEXTURED | TMAP_HTL_3D_UNLIT | TMAP_FLAG_SOFT_QUAD,
+ &p,
+ fl_radians(sw->rot_angles.p),
+ sw->radius
+ );
+ }
  }
 }
 
« Last Edit: August 21, 2011, 01:29:00 pm by Valathil »
┏┓╋┏┓╋╋╋╋╋╋╋╋╋┏┓
┃┃╋┃┃╋╋╋╋╋╋╋╋╋┃┃
┃┃┏┫┃┏┳━━┓┏━━┓┃┗━┳━━┳━━┳━━┓
┃┃┣┫┗┛┫┃━┫┃┏┓┃┃┏┓┃┏┓┃━━┫━━┫
┃┗┫┃┏┓┫┃━┫┃┏┓┃┃┗┛┃┗┛┣━━┣━━┃
┗━┻┻┛┗┻━━┛┗┛┗┛┗━━┻━━┻━━┻━━┛

 

Offline Commander Zane

  • 212
  • Spoot Knight of Anvils
Re: Thrusters and explosions
So far 11.8 didn't do anything positive, but at least it did nothing negative. I'm downloading the new .exe now and...I forgot what to do with the cmdline if anything is to be done with it.

Okay, I've got some progress now! The black boxes are gone so the effects are now showing, however I still get the artifacts.
« Last Edit: August 21, 2011, 01:41:01 pm by Commander Zane »

 

Offline Valathil

  • ...And I would have had a custom title if it wasn't for you meddling kids!
  • 29
  • Custom Title? Wizards need no Custom Title!
Re: Thrusters and explosions
could you post some screenies of the artifacts please. specifically on two angles. when the ship is covering the thrusters and a good angle where the thruster distorts something with a good contrast like a planet with a hires texture or something
┏┓╋┏┓╋╋╋╋╋╋╋╋╋┏┓
┃┃╋┃┃╋╋╋╋╋╋╋╋╋┃┃
┃┃┏┫┃┏┳━━┓┏━━┓┃┗━┳━━┳━━┳━━┓
┃┃┣┫┗┛┫┃━┫┃┏┓┃┃┏┓┃┏┓┃━━┫━━┫
┃┗┫┃┏┓┫┃━┫┃┏┓┃┃┗┛┃┗┛┣━━┣━━┃
┗━┻┻┛┗┻━━┛┗┛┗┛┗━━┻━━┻━━┻━━┛

 

Offline Commander Zane

  • 212
  • Spoot Knight of Anvils
Re: Thrusters and explosions
Okay, give me a moment I'll get some done.

 

Offline Valathil

  • ...And I would have had a custom title if it wasn't for you meddling kids!
  • 29
  • Custom Title? Wizards need no Custom Title!
Re: Thrusters and explosions
great debug log doesnt help me anyway i need to see this
┏┓╋┏┓╋╋╋╋╋╋╋╋╋┏┓
┃┃╋┃┃╋╋╋╋╋╋╋╋╋┃┃
┃┃┏┫┃┏┳━━┓┏━━┓┃┗━┳━━┳━━┳━━┓
┃┃┣┫┗┛┫┃━┫┃┏┓┃┃┏┓┃┏┓┃━━┫━━┫
┃┗┫┃┏┓┫┃━┫┃┏┓┃┃┗┛┃┗┛┣━━┣━━┃
┗━┻┻┛┗┻━━┛┗┛┗┛┗━━┻━━┻━━┻━━┛

 

Offline Commander Zane

  • 212
  • Spoot Knight of Anvils
Re: Thrusters and explosions
Three different scenarios.


Along with the artifacts that show around the engines of ships artifacts from distant explosions are shown through the hull of other ships closer to you. Those specs on the Hatshesput's hull are from an engagement with a Ravana in front of it.


And then the artifacts on the engines that I showed on the earlier post, although this time as you can see the effect itself is working, from the glows above the Orion's hangarbay bending.


And artifacts from the exploding Cyclops I launched, would be easier to see with some sort of background but on the Ravana's tubes you can see where the shockwave is.

 

Offline Valathil

  • ...And I would have had a custom title if it wasn't for you meddling kids!
  • 29
  • Custom Title? Wizards need no Custom Title!
Re: Thrusters and explosions
One question Zane, did you try the test build of swiftys soft particles. If not please do and tell me if you get the same artifacts. it kinda seems to me that this is a soft particle issue
┏┓╋┏┓╋╋╋╋╋╋╋╋╋┏┓
┃┃╋┃┃╋╋╋╋╋╋╋╋╋┃┃
┃┃┏┫┃┏┳━━┓┏━━┓┃┗━┳━━┳━━┳━━┓
┃┃┣┫┗┛┫┃━┫┃┏┓┃┃┏┓┃┏┓┃━━┫━━┫
┃┗┫┃┏┓┫┃━┫┃┏┓┃┃┗┛┃┗┛┣━━┣━━┃
┗━┻┻┛┗┻━━┛┗┛┗┛┗━━┻━━┻━━┻━━┛

 

Offline Commander Zane

  • 212
  • Spoot Knight of Anvils
Re: Thrusters and explosions
I have but I believe I didn't get the issue then. I'll have to try it again to double check.
Okay that isn't entirely true, the first release of that build had effects rendered as white squares, but after updating that problem went away. Doesn't mean I'm not going to try it again though.