View Issue Details

IDProjectCategoryView StatusLast Update
0002642FSSCPgraphicspublic2012-05-03 10:51
Reporterm_m Assigned Tom_m  
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.6.13 
Summary0002642: Cockpits are rendered incorrectly when post-processing is disabled
DescriptionAs the scene depth texture is only saved and cleared when post-processing is available cockpits are rendered with the scene depth values still there. That causes the cockpit to be potentially occluded by geometry that should occlude it.
The patch fixes that but effectively clears the z-buffer so it isn't available after cockpits are rendered. That shouldn't be a problem as the z-buffer values are only used by post-processing effects as far as I can see.
Steps To ReproduceDisable post-processing and fly a ship with a cockpit model near some geometry.
TagsNo tags attached.

Activities

m_m

2012-04-22 12:55

developer  

cockpitZBuffer.patch (953 bytes)   
Index: code/graphics/gropenglpostprocessing.cpp
===================================================================
--- code/graphics/gropenglpostprocessing.cpp	(revision 8682)
+++ code/graphics/gropenglpostprocessing.cpp	(working copy)
@@ -733,12 +733,18 @@
 extern GLuint Cockpit_depth_texture;
 void gr_opengl_post_process_save_zbuffer()
 {
-	if ( !Post_initialized ) {
-		return;
+	if (Post_initialized)
+	{
+		vglFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_TEXTURE_2D, Cockpit_depth_texture, 0);
+		gr_zbuffer_clear(TRUE);
+		zbuffer_saved = true;
 	}
-	vglFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_TEXTURE_2D, Cockpit_depth_texture, 0);
-	gr_zbuffer_clear(TRUE);
-	zbuffer_saved = true;
+	else
+	{
+		// If we can't save the z-buffer then just clear it so cockpits are still rendered correctly when
+		// post-processing isn't available/enabled.
+		gr_zbuffer_clear(TRUE);
+	}
 }
 
 
cockpitZBuffer.patch (953 bytes)   

Echelon9

2012-04-22 13:32

developer   ~0013474

This looks fine, alongside The_E's review on IRC:

The_E: m|m: Looks good to me

Committing.

Echelon9

2012-04-22 13:33

developer   ~0013475

Fix committed to trunk@8686.

niffiwan

2012-05-02 11:37

developer   ~0013509

Fix committed to fs2_open_3_6_14@8738.

niffiwan

2012-05-03 10:51

developer   ~0013514

Fix committed to fs2_open_3_6_14@8744.

Related Changesets

fs2open: trunk r8686

2012-04-22 09:34

Echelon9


Ported: N/A

Details Diff
Fix Mantis 2642: Cockpits are rendered incorrectly when post-processing is disabled, thanks m_m Affected Issues
0002642
mod - /trunk/fs2_open/code/graphics/gropenglpostprocessing.cpp Diff File

fs2open: fs2_open_3_6_14 r8738

2012-05-02 07:38

niffiwan


Ported: N/A

Details Diff
Backport: Trunk r8686; Fix Mantis 2642: Cockpits are rendered incorrectly when post-processing is disabled, thanks m_m Affected Issues
0002642
mod - /branches/fs2_open_3_6_14/code/graphics/gropenglpostprocessing.cpp Diff File

fs2open: fs2_open_3_6_14 r8744

2012-05-03 06:52

niffiwan


Ported: N/A

Details Diff
Revert "Backport: Trunk r8686; Fix Mantis 2642: Cockpits are rendered incorrectly when post-processing is disabled, thanks m_m"
Depends on other non-backported commits

This reverts commit cdb713f15a75169ee1352aad2bae5d84951e53a6.
Affected Issues
0002642
mod - /branches/fs2_open_3_6_14/code/graphics/gropenglpostprocessing.cpp Diff File

Issue History

Date Modified Username Field Change
2012-04-22 12:55 m_m New Issue
2012-04-22 12:55 m_m Status new => assigned
2012-04-22 12:55 m_m Assigned To => m_m
2012-04-22 12:55 m_m File Added: cockpitZBuffer.patch
2012-04-22 12:55 m_m Status assigned => code review
2012-04-22 13:32 Echelon9 Note Added: 0013474
2012-04-22 13:33 Echelon9 Changeset attached => fs2open trunk r8686
2012-04-22 13:33 Echelon9 Note Added: 0013475
2012-04-22 13:33 Echelon9 Status code review => resolved
2012-04-22 13:33 Echelon9 Resolution open => fixed
2012-05-02 11:37 niffiwan Changeset attached => fs2open fs2_open_3_6_14 r8738
2012-05-02 11:37 niffiwan Note Added: 0013509
2012-05-03 10:51 niffiwan Changeset attached => fs2open fs2_open_3_6_14 r8744
2012-05-03 10:51 niffiwan Note Added: 0013514