2022-01-26 06:41 EST


View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0002727FSSCPgraphicspublic2012-12-03 15:17
ReporterFUBAR-BDHR 
Assigned ToValathil 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionfixed 
Product Version3.6.15 
Target VersionFixed in Version 
Summary0002727: Ship Lab - Debris rendered in wrong location if model has non-zero center of mass
DescriptionFound this in TBP when adding debris to a fighter that had both center of mass and pivot that were not at 0,0,0. While it's common for center of mass to not be 0,0,0 the values are usually very small so this is hard to notice. I did mange to find a good retail model that has the issue though. The good old Colossus.
Steps To ReproduceOpen up ship lab and select the Colossus and hit one of the LODs. When the ship appears rotate it so you are facing a side. Select debris. Watch the debris jump out in front of where the ship was.
TagsNo tags attached.
Attached Files
  • patch file icon modelinterp.cpp.patch (1,667 bytes) 2012-11-18 15:46 -
    Index: code/model/modelinterp.cpp
    ===================================================================
    --- code/model/modelinterp.cpp	(revision 9354)
    +++ code/model/modelinterp.cpp	(working copy)
    @@ -3201,7 +3201,27 @@
     
     	//set to true since D3d and OGL need the api matrices set
     	g3_start_instance_matrix(pos, orient, true);
    +	bool set_autocen = false;
    +	vec3d auto_back = ZERO_VECTOR;
    +	if (Interp_flags & MR_AUTOCENTER) {
    +		// standard autocenter using data in model
    +		if (pm->flags & PM_FLAG_AUTOCEN) {
    +			auto_back = pm->autocenter;
    +			vm_vec_scale(&auto_back, -1.0f);
    +			set_autocen = true;
    +		}
    +		// fake autocenter if we are a missile and don't already have autocen info
    +		else if (Interp_flags & MR_IS_MISSILE) {
    +            auto_back.xyz.x = -( (pm->submodel[pm->detail[Interp_detail_level]].max.xyz.x + pm->submodel[pm->detail[Interp_detail_level]].min.xyz.x) / 2.0f );
    +            auto_back.xyz.y = -( (pm->submodel[pm->detail[Interp_detail_level]].max.xyz.y + pm->submodel[pm->detail[Interp_detail_level]].min.xyz.y) / 2.0f );
    +			auto_back.xyz.z = -( (pm->submodel[pm->detail[Interp_detail_level]].max.xyz.z + pm->submodel[pm->detail[Interp_detail_level]].min.xyz.z) / 2.0f );
    +			set_autocen = true;
    +		}
     
    +		if (set_autocen)
    +			g3_start_instance_matrix(&auto_back, NULL, true);
    +	}
    +
     	if (is_outlines_only_htl) {
     		gr_set_fill_mode( GR_FILL_MODE_WIRE );
     
    @@ -3322,7 +3342,8 @@
     	if ( !(Interp_flags & MR_NO_LIGHTING ) )	{
     		light_filter_pop();	
     	}
    -
    +	if (set_autocen)
    +		g3_done_instance(true);
     	g3_done_instance(true);
     
     	// turn off fog after each model renders, RT This fixes HUD being fogged when debris is in target box
    
    patch file icon modelinterp.cpp.patch (1,667 bytes) 2012-11-18 15:46 +

-Relationships
+Relationships

-Notes

~0014054

Valathil (developer)

Attached patch that fixes; Test for side effects.

~0014268

The_E (administrator)

Have been running with this patch for some time, no side effects were noticeable.

~0014272

Valathil (developer)

Want one more comment about TBP ships still having this issue. I think it's an asset problem but without specifics i cant investigate.

~0014276

FUBAR-BDHR (developer)

Did you get the model/table I linked for you to test?

~0014277

Valathil (developer)

Fix for retail committed to Trunk @ 9391

TBP was confirmed asset issue.
+Notes

-Issue History
Date Modified Username Field Change
2012-11-13 13:46 FUBAR-BDHR New Issue
2012-11-18 15:46 Valathil File Added: modelinterp.cpp.patch
2012-11-18 15:47 Valathil Assigned To => Valathil
2012-11-18 15:47 Valathil Status new => assigned
2012-11-18 15:47 Valathil Note Added: 0014054
2012-11-18 15:47 Valathil Status assigned => code review
2012-12-03 04:23 The_E Note Added: 0014268
2012-12-03 11:01 Valathil Note Added: 0014272
2012-12-03 14:04 FUBAR-BDHR Note Added: 0014276
2012-12-03 15:17 Valathil Note Added: 0014277
2012-12-03 15:17 Valathil Status code review => resolved
2012-12-03 15:17 Valathil Resolution open => fixed
+Issue History