2018-02-22 10:47 EST


View Issue Details Jump to Notes ] Related Changesets ]
IDProjectCategoryView StatusLast Update
0000184FSSCPHT&Lpublic2012-12-09 16:20
ReporterJarC 
Assigned ToValathil 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionfixed 
Product Version 
Target VersionFixed in Version 
Summary0000184: HTL: Engine/Thruster Ani's not scaled properly
DescriptionThis 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 InformationFrom 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.
TagsNo tags attached.
Attached Files
  • jpg file icon thrust0.jpg (16,186 bytes) 2004-05-11 16:20 -
    jpg file icon thrust0.jpg (16,186 bytes) 2004-05-11 16:20 +
  • jpg file icon thrust1.jpg (14,111 bytes) 2004-05-11 16:22 -
    jpg file icon thrust1.jpg (14,111 bytes) 2004-05-11 16:22 +
  • jpg file icon thrust2.jpg (15,296 bytes) 2004-05-11 16:22 -
    jpg file icon thrust2.jpg (15,296 bytes) 2004-05-11 16:22 +
  • jpg file icon thrust3.jpg (16,148 bytes) 2004-05-11 16:22 -
    jpg file icon thrust3.jpg (16,148 bytes) 2004-05-11 16:22 +
  • ? file icon thrustertest.fs2 (3,097 bytes) 2012-12-07 13:06
  • patch file icon 184.patch (7,640 bytes) 2012-12-09 15:19 -
    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();
     
    
    patch file icon 184.patch (7,640 bytes) 2012-12-09 15:19 +

-Relationships
+Relationships

-Notes

~0000936

JarC (reporter)

shoot, completely forgot to select the correct dropdown values, this is ofcourse not a directx feature req, but a minor graphics bug...

~0000937

Lightspeed (reporter)

I've noticed that, too.

~0000938

RandomTiger (developer)

You have logged this as a DX bug.
Does this mean it doesnt happen in OGL?

~0001909

Bobboau (developer)

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.

~0001964

kasperl (developer)

Updated category.

~0005518

taylor (administrator)

Changing category to HT&L and un-assigning from Bobboau since he's not likely to ever fix this.

~0007036

taylor (administrator)

Guess I might as well put this one on me as well. ;(

~0009450

taylor (administrator)

Not going to work on this.

~0014345

The_E (administrator)

*bump*

So this is still open?

Obvious question, does it need to be?

~0014349

MjnMixael (manager)

Yes, this is still a problem. Test mission attached.

~0014350

Goober5000 (administrator)

MjnMixael confirmed this is still an issue. Assigning to Valathil to see what can be done about it.

~0014385

Valathil (developer)

Attached patch with fix please review and test

~0014386

MjnMixael (manager)

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.

~0014387

Valathil (developer)

Reuploaded patch with a crash fix for a hackish shader state buffering.

~0014390

Valathil (developer)

Fix committed to trunk@9416.
+Notes

+Related Changesets

-Issue History
Date Modified Username Field Change
2004-05-11 16:20 JarC New Issue
2004-05-11 16:20 JarC File Added: thrust0.jpg
2004-05-11 16:22 JarC File Added: thrust1.jpg
2004-05-11 16:22 JarC File Added: thrust2.jpg
2004-05-11 16:22 JarC File Added: thrust3.jpg
2004-05-11 16:23 JarC Note Added: 0000936
2004-05-11 18:17 Lightspeed Note Added: 0000937
2004-05-13 15:48 RandomTiger Note Added: 0000938
2004-05-13 15:48 RandomTiger Severity feature => major
2004-05-13 15:48 RandomTiger Status new => acknowledged
2004-05-13 15:48 RandomTiger Summary Engine/Thruster Ani's not scaled properly => HTL: Engine/Thruster Ani's not scaled properly
2005-03-14 08:38 administrator Assigned To => Bobboau
2005-03-14 17:42 Bobboau Note Added: 0001909
2005-03-15 11:58 kasperl Note Added: 0001964
2005-03-15 11:58 kasperl Severity major => minor
2005-03-15 11:58 kasperl Category DirectX => graphics
2006-05-13 16:44 taylor Note Added: 0005518
2006-05-13 16:44 taylor Assigned To Bobboau =>
2006-05-13 16:44 taylor Category graphics => HT&L
2006-10-28 19:30 taylor Note Added: 0007036
2006-10-28 19:30 taylor Assigned To => taylor
2006-10-28 19:30 taylor Status acknowledged => confirmed
2008-07-17 12:25 taylor Note Added: 0009450
2008-07-17 12:25 taylor Assigned To taylor =>
2009-11-10 11:54 Zacam Status confirmed => assigned
2009-11-10 11:54 Zacam Assigned To => Zacam
2012-12-07 09:45 The_E Note Added: 0014345
2012-12-07 13:05 MjnMixael Note Added: 0014349
2012-12-07 13:06 MjnMixael File Added: thrustertest.fs2
2012-12-07 13:06 Goober5000 Note Added: 0014350
2012-12-07 13:06 Goober5000 Assigned To Zacam => Valathil
2012-12-07 13:08 Goober5000 Additional Information Updated View Revisions
2012-12-09 13:37 Valathil Note Added: 0014385
2012-12-09 13:37 Valathil Status assigned => code review
2012-12-09 13:37 Valathil File Added: 184.patch
2012-12-09 13:54 MjnMixael Note Added: 0014386
2012-12-09 15:19 Valathil File Deleted: 184.patch
2012-12-09 15:19 Valathil File Added: 184.patch
2012-12-09 15:20 Valathil Note Added: 0014387
2012-12-09 16:20 Valathil Changeset attached => fs2open trunk r9416
2012-12-09 16:20 Valathil Note Added: 0014390
2012-12-09 16:20 Valathil Status code review => resolved
2012-12-09 16:20 Valathil Resolution open => fixed
+Issue History