View Issue Details

IDProjectCategoryView StatusLast Update
0003012FSSCPgraphicspublic2014-06-16 15:44
ReporterThe_E Assigned ToMageKing17  
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.7.2 
Target Version3.7.2 
Summary0003012: Rendering bugs in Nebula
DescriptionWhile in nebula (i.e. while fogging is active), certain models may not react to fogging correctly. Things to test: Correct shader behaviour in nebula, whether this happens on fixed pipe, possible driver bugs

For demonstration, see video linked in this thread: http://www.hard-light.net/forums/index.php?topic=86948.0
TagsNo tags attached.

Activities

Zacam

2014-03-02 09:13

administrator   ~0015633

It's not shader specific (fixed render, no_glsl) can replicate it, though there is an issue with the thruster distortion rendering -through- full nebula.

The issue is a combination of things: Improper '+Compl dist:' set in a -obt.tbm for a class, lack of '+Fog Near Mult:' & '+Fog Far Mult:' appropriate values in a mission, but more specific to coding ventures, eyepoint calculations for what renders will be completely different in terms of results.

Example: At the start of SM2-08 (A Monster in the Mist), if you stay in cockpit view, the Sathanas is invisible. If you go to pannable external camera, you can make it visible, or you can pop into Chase Cam view and it becomes more visible.

This belies a bug with the eyepoint consideration for focal point, because there is a blending that attributes based on how close to eyepoint/viewpoint 'center' the 'poofs' are in so there is some attendant code regarding the nebula rendering system to look at, but the only significant thing to look at shader wise is the thruster distortion and/or thrusters not rendering.

The_E

2014-05-10 11:10

administrator   ~0015737

Does anyone have a test case for this? I made one myself, with me and an Orion in a Nebula, and it doesn't seem to trigger this bug; I am using a Radeon 7850 with Catalyst 14.4.

Hellzed

2014-05-12 14:25

reporter   ~0015742

You may want to try it with a Sathanas, and get really close to it (close enough to scan its subsystems, and try to go from a subsystem to another without straying too far from the hull). You will get both the invisible thrusters issue and ship disappearance issue.
You will maybe get the third issue associated with this bug, the ship visible through the poofs, but I'm not sure it will work with a standard test case, because it usually starts after a while, when a lot of projectiles are flying around, and there are many ships in the mission (I remember seeing it on the Aquitaine after the first dogfight in "Mystery of the Trinity").

Lykurgos88

2014-06-09 07:45

reporter   ~0015823

The mission "Argonautica" in FS2 retail campaign has probably the most potential in testing the third issue (ships appearing through poofs). It starts right away with action. I have this problem like every other time I face Aquitaine.

MageKing17

2014-06-14 06:54

developer  

disappearing_ships.patch (423 bytes)   
Index: code/nebula/neb.cpp
===================================================================
--- code/nebula/neb.cpp	(revision 10814)
+++ code/nebula/neb.cpp	(working copy)
@@ -503,7 +503,7 @@
 }
 
 // should we not render this object because its obscured by the nebula?
-int neb_skip_opt = 1;
+int neb_skip_opt = 0;
 DCF(neb_skip, "Toggles culling of objects obscured by nebula")
 {
 	neb_skip_opt = !neb_skip_opt;
disappearing_ships.patch (423 bytes)   

MageKing17

2014-06-14 06:55

developer  

ship_pop-in.patch (2,432 bytes)   
Index: code/graphics/gropengl.cpp
===================================================================
--- code/graphics/gropengl.cpp	(revision 10814)
+++ code/graphics/gropengl.cpp	(working copy)
@@ -650,27 +650,25 @@
 		return;
 	}
 	
-  	if (gr_screen.current_fog_mode != fog_mode) {
-	  	if (OGL_fogmode == 3) {
-			glFogf(GL_FOG_DISTANCE_MODE_NV, GL_EYE_RADIAL_NV);
-			glFogf(GL_FOG_COORDINATE_SOURCE, GL_FRAGMENT_DEPTH);
-		}
-		// Um.. this is not the correct way to fog in software, probably doesn't matter though
-		else if ( (OGL_fogmode == 2) && Cmdline_nohtl ) {
-			glFogf(GL_FOG_COORDINATE_SOURCE_EXT, GL_FOG_COORDINATE_EXT);
-			fog_near *= fog_near;		// it's faster this way
-			fog_far *= fog_far;		
-		} else {
-			glFogf(GL_FOG_COORDINATE_SOURCE, GL_FRAGMENT_DEPTH);
-		}
+  	if (OGL_fogmode == 3) {
+		glFogf(GL_FOG_DISTANCE_MODE_NV, GL_EYE_RADIAL_NV);
+		glFogf(GL_FOG_COORDINATE_SOURCE, GL_FRAGMENT_DEPTH);
+	}
+	// Um.. this is not the correct way to fog in software, probably doesn't matter though
+	else if ( (OGL_fogmode == 2) && Cmdline_nohtl ) {
+		glFogf(GL_FOG_COORDINATE_SOURCE_EXT, GL_FOG_COORDINATE_EXT);
+		fog_near *= fog_near;		// it's faster this way
+		fog_far *= fog_far;		
+	} else {
+		glFogf(GL_FOG_COORDINATE_SOURCE, GL_FRAGMENT_DEPTH);
+	}
 
-		GL_state.Fog(GL_TRUE); 
-		glFogf(GL_FOG_MODE, GL_LINEAR);
-		glFogf(GL_FOG_START, fog_near);
-		glFogf(GL_FOG_END, fog_far);
+	GL_state.Fog(GL_TRUE); 
+	glFogf(GL_FOG_MODE, GL_LINEAR);
+	glFogf(GL_FOG_START, fog_near);
+	glFogf(GL_FOG_END, fog_far);
 
-		gr_screen.current_fog_mode = fog_mode;
-	}
+	gr_screen.current_fog_mode = fog_mode;
 	
 	if ( (gr_screen.current_fog_color.red != r) ||
 			(gr_screen.current_fog_color.green != g) ||
Index: code/object/objectsort.cpp
===================================================================
--- code/object/objectsort.cpp	(revision 10814)
+++ code/object/objectsort.cpp	(working copy)
@@ -307,7 +307,7 @@
 
 			// only reset fog if the fog mode has changed - since regenerating a fog table takes
 			// a bit of time
-			if((fog_near != gr_screen.fog_near) || (fog_far != gr_screen.fog_far)){
+			if((GR_FOGMODE_FOG != gr_screen.current_fog_mode) || (fog_near != gr_screen.fog_near) || (fog_far != gr_screen.fog_far)) {
 				gr_fog_set(GR_FOGMODE_FOG, gr_screen.current_fog_color.red, gr_screen.current_fog_color.green, gr_screen.current_fog_color.blue, fog_near, fog_far);
 			}
 
ship_pop-in.patch (2,432 bytes)   

MageKing17

2014-06-14 06:57

developer   ~0015861

I have attached a pair of patches that seem to fix the ship-disappearing problem and the ship-pop-in problem, but I have been unable to track down the cause of the thrusters not rendering properly.

MageKing17

2014-06-14 18:57

developer  

invisible_thrusters.patch (499 bytes)   
Index: code/model/modelinterp.cpp
===================================================================
--- code/model/modelinterp.cpp	(revision 10819)
+++ code/model/modelinterp.cpp	(working copy)
@@ -2331,7 +2331,7 @@
 
 			// fade them in the nebula as well
 			if (The_mission.flags & MISSION_FLAG_FULLNEB) {
-				vm_vec_rotate(&npnt, &gpt->pnt, orient);
+				vm_vec_unrotate(&npnt, &gpt->pnt, orient);
 				vm_vec_add2(&npnt, pos);
 
 				fog_int = (1.0f - (neb2_get_fog_intensity(&npnt)));
invisible_thrusters.patch (499 bytes)   

MageKing17

2014-06-14 18:57

developer   ~0015871

Found the invisible thruster problem; I think it's time this got some extra eyes on it. Switching to code review.

Hellzed

2014-06-15 12:34

reporter   ~0015878

Just tried it, all issues are fixed (engine glow, ships rendering...).

The_E

2014-06-16 15:44

administrator   ~0015883

Patches committed in revision 10821

Issue History

Date Modified Username Field Change
2014-02-28 07:11 The_E New Issue
2014-03-02 09:13 Zacam Note Added: 0015633
2014-03-02 09:13 Zacam Status new => confirmed
2014-05-10 11:10 The_E Note Added: 0015737
2014-05-12 14:25 Hellzed Note Added: 0015742
2014-06-09 07:45 Lykurgos88 Note Added: 0015823
2014-06-14 06:54 MageKing17 File Added: disappearing_ships.patch
2014-06-14 06:55 MageKing17 File Added: ship_pop-in.patch
2014-06-14 06:57 MageKing17 Note Added: 0015861
2014-06-14 18:57 MageKing17 File Added: invisible_thrusters.patch
2014-06-14 18:57 MageKing17 Assigned To => MageKing17
2014-06-14 18:57 MageKing17 Status confirmed => assigned
2014-06-14 18:57 MageKing17 Note Added: 0015871
2014-06-14 18:57 MageKing17 Status assigned => code review
2014-06-15 12:34 Hellzed Note Added: 0015878
2014-06-16 15:44 The_E Status code review => assigned
2014-06-16 15:44 The_E Note Added: 0015883
2014-06-16 15:44 The_E Status assigned => resolved
2014-06-16 15:44 The_E Resolution open => fixed