View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0000184 | FSSCP | HT&L | public | 2004-05-11 20:20 | 2012-12-09 21:20 |
Reporter | JarC | Assigned To | Valathil | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Summary | 0000184: HTL: Engine/Thruster Ani's not scaled properly | ||||
Description | This is a very old one I believe, I vaguely remember this being discussed before either on HLP or the FDL... Anyways, here goes, screenies still the best to show what I mean so they're attached too. 1 for each throttle preset... The thruster ani's are not always properly scaled for the various thruster presets (0, 1/3rd, 2/3rd, full). They are scaled relative to a point within the thruster cone, this makes the base of the ani rise as much from the engine plane as the length of the thruster shortens with respect to the chosen preset... | ||||
Additional Information | From Goober5000: The description may be a little unclear, so perhaps this will help: just take a look at the gap between the thruster flame and the body of the fighter, and compare the gap across all pictures. | ||||
Tags | No tags attached. | ||||
2004-05-11 20:20
|
|
2004-05-11 20:22
|
|
2004-05-11 20:22
|
|
2004-05-11 20:22
|
|
|
shoot, completely forgot to select the correct dropdown values, this is ofcourse not a directx feature req, but a minor graphics bug... |
|
I've noticed that, too. |
|
You have logged this as a DX bug. Does this mean it doesnt happen in OGL? |
|
it's a generic HT&L bug, we have no way of doing this the way V did untill we get vertex shaders. once we get that we should be able to fix this problem easily. |
|
Updated category. |
|
Changing category to HT&L and un-assigning from Bobboau since he's not likely to ever fix this. |
|
Guess I might as well put this one on me as well. ;( |
|
Not going to work on this. |
|
*bump* So this is still open? Obvious question, does it need to be? |
|
Yes, this is still a problem. Test mission attached. |
|
|
|
MjnMixael confirmed this is still an issue. Assigning to Valathil to see what can be done about it. |
|
Attached patch with fix please review and test |
|
Tested fixed. Note: the Pegasus still has a small bit of space between the thrusters and the hull. I checked the retail model and that is a model problem which was likely present in retail. The thruster cone mesh is not flush against the hull mesh. |
|
184.patch (7,640 bytes)
Index: code/globalincs/def_files.cpp =================================================================== --- code/globalincs/def_files.cpp (revision 9414) +++ code/globalincs/def_files.cpp (working copy) @@ -1302,16 +1302,25 @@ "#ifdef FLAG_FOG\n" "varying float fogDist;\n" "#endif\n" +"#ifdef FLAG_THRUSTER\n" +"uniform float thruster_scale;\n" +"#endif\n" "varying vec4 position;\n" "varying vec3 lNormal;\n" "void main()\n" "{\n" " gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;\n" -" gl_Position = gl_ProjectionMatrix * gl_ModelViewMatrix * gl_Vertex;\n" +" vec4 vertex = gl_Vertex;\n" +" #ifdef FLAG_THRUSTER\n" +" if(vertex.z < -1.5) {\n" +" vertex.z *= thruster_scale;\n" +" }\n" +" #endif\n" +" gl_Position = gl_ProjectionMatrix * gl_ModelViewMatrix * vertex;\n" " gl_FrontColor = gl_Color;\n" " gl_FrontSecondaryColor = vec4(0.0, 0.0, 0.0, 1.0);\n" " // Transform the normal into eye space and normalize the result.\n" -" position = gl_ModelViewMatrix * gl_Vertex;\n" +" position = gl_ModelViewMatrix * vertex;\n" " vec3 normal = normalize(gl_NormalMatrix * gl_Normal);\n" " lNormal = normal;\n" " #ifdef FLAG_NORMAL_MAP\n" @@ -1329,7 +1338,7 @@ " #ifdef FLAG_FOG\n" " fogDist = clamp((gl_Position.z - gl_Fog.start) * 0.75 * gl_Fog.scale, 0.0, 1.0);\n" " #endif\n" -" gl_ClipVertex = (gl_ModelViewMatrix * gl_Vertex);\n" +" gl_ClipVertex = (gl_ModelViewMatrix * vertex);\n" "}"; char *Default_main_fragment_shader = Index: code/graphics/2d.h =================================================================== --- code/graphics/2d.h (revision 9414) +++ code/graphics/2d.h (working copy) @@ -41,6 +41,7 @@ #define SDR_FLAG_DISTORTION (1<<10) #define SDR_FLAG_MISC_MAP (1<<11) #define SDR_FLAG_TEAMCOLOR (1<<12) +#define SDR_FLAG_THRUSTER (1<<13) // stencil buffering stuff extern int gr_stencil_mode; Index: code/graphics/gropengldraw.cpp =================================================================== --- code/graphics/gropengldraw.cpp (revision 9414) +++ code/graphics/gropengldraw.cpp (working copy) @@ -1195,6 +1195,8 @@ } } + opengl_shader_set_current(); + GLboolean cull_face = GL_state.CullFace(GL_FALSE); if (flags & TMAP_FLAG_TRILIST) { Index: code/graphics/gropenglshader.cpp =================================================================== --- code/graphics/gropenglshader.cpp (revision 9414) +++ code/graphics/gropenglshader.cpp (working copy) @@ -55,7 +55,8 @@ { SDR_FLAG_ENV_MAP, 3, {"sEnvmap", "alpha_spec", "envMatrix"}, 0, { NULL }, "Environment Mapping" }, { SDR_FLAG_ANIMATED, 5, {"sFramebuffer", "effect_num", "anim_timer", "vpwidth", "vpheight"}, 0, { NULL }, "Animated Effects" }, { SDR_FLAG_MISC_MAP, 1, {"sMiscmap"}, 0, { NULL }, "Utility mapping" }, - { SDR_FLAG_TEAMCOLOR, 2, {"stripe_color", "base_color"}, 0, { NULL }, "Team Colors" } + { SDR_FLAG_TEAMCOLOR, 2, {"stripe_color", "base_color"}, 0, { NULL }, "Team Colors" }, + { SDR_FLAG_THRUSTER, 1, {"thruster_scale"}, 0, { NULL }, "Thruster scaling" } }; static const int Main_shader_flag_references = sizeof(GL_Uniform_Reference_Main) / sizeof(opengl_shader_uniform_reference_t); @@ -81,32 +82,34 @@ */ void opengl_shader_set_current(opengl_shader_t *shader_obj) { - Current_shader = shader_obj; + if (shader_obj != NULL) { + if(!Current_shader || (Current_shader->program_id != shader_obj->program_id)) { + Current_shader = shader_obj; + vglUseProgramObjectARB(Current_shader->program_id); - if (Current_shader != NULL) { - vglUseProgramObjectARB(Current_shader->program_id); - #ifndef NDEBUG - if ( opengl_check_for_errors("shader_set_current()") ) { - vglValidateProgramARB(Current_shader->program_id); + if ( opengl_check_for_errors("shader_set_current()") ) { + vglValidateProgramARB(Current_shader->program_id); - GLint obj_status = 0; - vglGetObjectParameterivARB(Current_shader->program_id, GL_OBJECT_VALIDATE_STATUS_ARB, &obj_status); + GLint obj_status = 0; + vglGetObjectParameterivARB(Current_shader->program_id, GL_OBJECT_VALIDATE_STATUS_ARB, &obj_status); - if ( !obj_status ) { - opengl_shader_check_info_log(Current_shader->program_id); + if ( !obj_status ) { + opengl_shader_check_info_log(Current_shader->program_id); - mprintf(("VALIDATE INFO-LOG:\n")); + mprintf(("VALIDATE INFO-LOG:\n")); - if (strlen(GLshader_info_log) > 5) { - mprintf(("%s\n", GLshader_info_log)); - } else { - mprintf(("<EMPTY>\n")); + if (strlen(GLshader_info_log) > 5) { + mprintf(("%s\n", GLshader_info_log)); + } else { + mprintf(("<EMPTY>\n")); + } } } } #endif } else { + Current_shader = NULL; vglUseProgramObjectARB(0); } } @@ -237,6 +240,10 @@ sflags += "#define FLAG_TEAMCOLOR\n"; } + if (flags & SDR_FLAG_THRUSTER) { + sflags += "#define FLAG_THRUSTER\n"; + } + const char *shader_flags = sflags.c_str(); int flags_len = strlen(shader_flags); Index: code/graphics/gropengltnl.cpp =================================================================== --- code/graphics/gropengltnl.cpp (revision 9414) +++ code/graphics/gropengltnl.cpp (working copy) @@ -68,8 +68,6 @@ GLint GL_max_elements_vertices = 4096; GLint GL_max_elements_indices = 4096; -int Buffer_sdr = -1; - team_color* Current_team_color; team_color Current_temp_color; bool Using_Team_Color = false; @@ -418,7 +416,6 @@ if ( (Use_GLSL > 1) && !GLSL_override ) { opengl_shader_set_current(); - Buffer_sdr = -1; } return; @@ -583,6 +580,8 @@ extern bool Scene_framebuffer_in_frame; extern GLuint Framebuffer_fallback_texture_id; +extern int Interp_thrust_scale_subobj; +extern float Interp_thrust_scale; static void opengl_render_pipeline_program(int start, const vertex_buffer *bufferp, const buffer_data *datap, int flags) { float u_scale, v_scale; @@ -650,6 +649,10 @@ } } + if ( Interp_thrust_scale_subobj ) { + shader_flags |= SDR_FLAG_THRUSTER; + } + // find proper shader if (shader_flags == GL_last_shader_flags) { sdr_index = GL_last_shader_index; @@ -667,10 +670,7 @@ Assert( sdr_index >= 0 ); - if ( sdr_index != Buffer_sdr ) { - Buffer_sdr = sdr_index; - opengl_shader_set_current( &GL_shader[sdr_index] ); - } + opengl_shader_set_current( &GL_shader[sdr_index] ); opengl_default_light_settings( !GL_center_alpha, (Interp_light > 0.25f) ); gr_opengl_set_center_alpha(GL_center_alpha); @@ -800,6 +800,10 @@ vglUniform3fARB( opengl_shader_get_uniform("base_color"), Current_team_color->base.r, Current_team_color->base.g, Current_team_color->base.b); } + if (shader_flags & SDR_FLAG_THRUSTER) { + vglUniform1fARB( opengl_shader_get_uniform("thruster_scale"), Interp_thrust_scale); + } + // DRAW IT!! //DO_RENDER(); Index: code/model/modelinterp.cpp =================================================================== --- code/model/modelinterp.cpp (revision 9414) +++ code/model/modelinterp.cpp (working copy) @@ -113,8 +113,8 @@ bool Interp_desaturate = false; // If non-zero, then the subobject gets scaled by Interp_thrust_scale. -static int Interp_thrust_scale_subobj = 0; -static float Interp_thrust_scale = 0.1f; +int Interp_thrust_scale_subobj = 0; +float Interp_thrust_scale = 0.1f; static float Interp_thrust_scale_x = 0.0f;//added -bobboau static float Interp_thrust_scale_y = 0.0f;//added -bobboau @@ -4602,7 +4602,9 @@ forced_blend_filter = GR_ALPHABLEND_FILTER; } - gr_push_scale_matrix(&scale); + if (!Interp_thrust_scale_subobj) { + gr_push_scale_matrix(&scale); + } size_t buffer_size = model->buffer.tex_buf.size(); |
|
Reuploaded patch with a crash fix for a hackish shader state buffering. |
|
Fix committed to trunk@9416. |
fs2open: trunk r9416 2012-12-09 16:51 Ported: N/A Details Diff |
Fix for Mantis 184: Use Vertex shader to replicate nohtl rendering of thruster cones. Also make shader state handling a bit less hackish. |
Affected Issues 0000184 |
|
mod - /trunk/fs2_open/code/globalincs/def_files.cpp | Diff File | ||
mod - /trunk/fs2_open/code/graphics/2d.h | Diff File | ||
mod - /trunk/fs2_open/code/graphics/gropengldraw.cpp | Diff File | ||
mod - /trunk/fs2_open/code/graphics/gropenglshader.cpp | Diff File | ||
mod - /trunk/fs2_open/code/graphics/gropengltnl.cpp | Diff File | ||
mod - /trunk/fs2_open/code/model/modelinterp.cpp | Diff File |
Date Modified | Username | Field | Change |
---|---|---|---|
2004-05-11 20:20 | JarC | New Issue | |
2004-05-11 20:20 | JarC | File Added: thrust0.jpg | |
2004-05-11 20:22 | JarC | File Added: thrust1.jpg | |
2004-05-11 20:22 | JarC | File Added: thrust2.jpg | |
2004-05-11 20:22 | JarC | File Added: thrust3.jpg | |
2004-05-11 20:23 | JarC | Note Added: 0000936 | |
2004-05-11 22:17 | Lightspeed | Note Added: 0000937 | |
2004-05-13 19:48 | RandomTiger | Note Added: 0000938 | |
2004-05-13 19:48 | RandomTiger | Severity | feature => major |
2004-05-13 19:48 | RandomTiger | Status | new => acknowledged |
2004-05-13 19:48 | RandomTiger | Summary | Engine/Thruster Ani's not scaled properly => HTL: Engine/Thruster Ani's not scaled properly |
2005-03-14 13:38 | administrator | Assigned To | => Bobboau |
2005-03-14 22:42 | Bobboau | Note Added: 0001909 | |
2005-03-15 16:58 | kasperl | Note Added: 0001964 | |
2005-03-15 16:58 | kasperl | Severity | major => minor |
2005-03-15 16:58 | kasperl | Category | DirectX => graphics |
2006-05-13 20:44 | taylor | Note Added: 0005518 | |
2006-05-13 20:44 | taylor | Assigned To | Bobboau => |
2006-05-13 20:44 | taylor | Category | graphics => HT&L |
2006-10-28 23:30 | taylor | Note Added: 0007036 | |
2006-10-28 23:30 | taylor | Assigned To | => taylor |
2006-10-28 23:30 | taylor | Status | acknowledged => confirmed |
2008-07-17 16:25 | taylor | Note Added: 0009450 | |
2008-07-17 16:25 | taylor | Assigned To | taylor => |
2009-11-10 16:54 | Zacam | Status | confirmed => assigned |
2009-11-10 16:54 | Zacam | Assigned To | => Zacam |
2012-12-07 14:45 | The_E | Note Added: 0014345 | |
2012-12-07 18:05 | MjnMixael | Note Added: 0014349 | |
2012-12-07 18:06 | MjnMixael | File Added: thrustertest.fs2 | |
2012-12-07 18:06 | Goober5000 | Note Added: 0014350 | |
2012-12-07 18:06 | Goober5000 | Assigned To | Zacam => Valathil |
2012-12-07 18:08 | Goober5000 | Additional Information Updated | |
2012-12-09 18:37 | Valathil | Note Added: 0014385 | |
2012-12-09 18:37 | Valathil | Status | assigned => code review |
2012-12-09 18:37 | Valathil | File Added: 184.patch | |
2012-12-09 18:54 | MjnMixael | Note Added: 0014386 | |
2012-12-09 20:19 | Valathil | File Deleted: 184.patch | |
2012-12-09 20:19 | Valathil | File Added: 184.patch | |
2012-12-09 20:20 | Valathil | Note Added: 0014387 | |
2012-12-09 21:20 | Valathil | Changeset attached | => fs2open trunk r9416 |
2012-12-09 21:20 | Valathil | Note Added: 0014390 | |
2012-12-09 21:20 | Valathil | Status | code review => resolved |
2012-12-09 21:20 | Valathil | Resolution | open => fixed |