Author Topic: Deferred Lighting and soft shadows  (Read 30768 times)

0 Members and 5 Guests are viewing this topic.

Offline zookeeper

  • *knock knock* Who's there? Poe. Poe who?
  • 210
Re: Deferred Lighting and soft shadows
And just in case I wasn't clear, we're not going to actually commit the shadows code to my branch until it hits trunk, this is only for the purpose of getting test builds.

 

Offline Swifty

  • 210
  • I reject your fantasy & substitute my own
Re: Deferred Lighting and soft shadows
hopefully there won't be too many conflicts but I'll get a patch going soon.

 

Offline zookeeper

  • *knock knock* Who's there? Poe. Poe who?
  • 210
Re: Deferred Lighting and soft shadows
Great, thanks! I synced my branch with trunk r10900 just now, in case that'll make anything easier.

 

Offline Swifty

  • 210
  • I reject your fantasy & substitute my own
Re: Deferred Lighting and soft shadows
New build. This time with a bunch of rendering optimizations.

I restored the batched model rendering system I wrote a while back but scrapped because it had problems. This one is designed a bit better and should increase framerates when drawing models with a lot of sub-objects. You can turn it off by going to the "Troubleshooting" dropdown menu in the launcher and selecting "Disable batched model rendering"

I also refactored the shader system for effects. I noticed a very large chunk of frametime gets consumed by drawing soft particle effects and I seemed to source it to sampling the depth texture on my AMD card. Sampling the position texture produced by the deferred lighting system seems to eliminate this bottleneck at least on my machine so I dunno if this performance boost will extend to other machines.

Fixed a bunch of bugs. Added a bit of some additional error handling code if users don't have the proper OpenGL extensions. We're still on Revision 10794 on this build because resyncing with trunk takes a bit out of me especially if I have to backport the changes done to the deprecated model rendering code into the new model rendering code.

Enjoy.

http://www.mediafire.com/download/v2y7ob1ipz6zn2h/shadows_10794_r4.zip

 

Offline Kolgena

  • 211
Re: Deferred Lighting and soft shadows
I just tried the build, and there are some odd shenanigans with the way certain elements are getting rendered.

1. Missile trails in the nebula (only tested hornets, and only in the nebula, didn't try any empty space missions) will flicker in and out of being rendered. This behavior seems to only affect missiles that have aspect lock. Firing hornets with no target renders trails consistently.
2. 3D weapon and ship selection is a bit buggy. The model animation starts wrong (it's rotated by exactly 180 degrees), which means the scanline doesn't follow the model's glow/render effect.
3. In weapon selection, the spinning 3D ship model appears to have a clipping plane right in the middle of it parallel to the screen. Parts of the ship behind this plane are invisible as it spins.

 

Offline Swifty

  • 210
  • I reject your fantasy & substitute my own
Re: Deferred Lighting and soft shadows
The wrong model animations in the weapon and ship select screens are because I haven't merged with the current revisions in trunk.

I'm not getting any clip plane issues in the weapon select screen. Screenshots would help. I do notice the shadows and lighting are incorrect and need to be fixed though. I also notice that the hardpoint indicators are being drawn in the wrong location as well. But I'm not see a clipping issue.

I'm not getting any issues with missile trails either in nebulas. Is there a specific mission you tested?

 

Offline Kolgena

  • 211
Re: Deferred Lighting and soft shadows
Not able to give you a screenshot at this moment.

All of this was tested in The Great Hunt (lysander gets skewered by ravanna), with Mediavps 2014 (with the new nebulas). The problem with the hornets is, the missiles will spawn within view, without trails, then fly forwards, at which points trails will spawn (I was shooting astaroths). However, these same trails will periodically blink out of existence and back again, based on some unknown factors. Shooting hornets in the same environment without a target or missile lock will cause missiles to spawn with trails, and for the trails to more reliably stay in existence.

In weapon selection, the spinning 3D model of the Herc II will have the back bit of the model become black. That's what I mean by the clipping issue. If you don't see it, might just be something on my end. I am on CCC 14.4 WHQL, which is supposed to have garbage OGL support, so it could be that.

I didn't get a chance to properly test shadows/lighting aside from the F3 ship lab, so can't comment on if it looks right or not because nebula missions make you half blind. Things seemed fine in ship lab.

 

Offline Cyborg17

  • 29
  • A-1 Supar
Re: Deferred Lighting and soft shadows
All of this was tested in The Great Hunt (lysander gets skewered by ravanna), with Mediavps 2014 (with the new nebulas). The problem with the hornets is, the missiles will spawn within view, without trails, then fly forwards, at which points trails will spawn (I was shooting astaroths). However, these same trails will periodically blink out of existence and back again, based on some unknown factors. Shooting hornets in the same environment without a target or missile lock will cause missiles to spawn with trails, and for the trails to more reliably stay in existence.

Isn't this just the nebula render bug that was fixed in trunk? The fix in r10821, if I'm reading the log right.  This shadows build was forked before that (r10794), right?

 

Online AdmiralRalwood

  • 211
  • Mister Subspace Strikes
    • Skype
    • Steam
    • Twitter
Re: Deferred Lighting and soft shadows
r10821 was fixing ships and engines, not missile trails. I can guarantee that I changed no code related to missile trails in that commit.
Ph'nglui mglw'nafh Codethulhu GitHub wgah'nagl fhtagn.

schrödinbug (noun) - a bug that manifests itself in running software after a programmer notices that the code should never have worked in the first place.

When you gaze long into BMPMAN, BMPMAN also gazes into you.

"I am one of the best FREDders on Earth" -General Battuta

<Aesaar> literary criticism is vladimir putin

<MageKing17> "There's probably a reason the code is the way it is" is a very dangerous line of thought. :P
<MageKing17> Because the "reason" often turns out to be "nobody noticed it was wrong".
(the very next day)
<MageKing17> this ****ing code did it to me again
<MageKing17> "That doesn't really make sense to me, but I'll assume it was being done for a reason."
<MageKing17> **** ME
<MageKing17> THE REASON IS PEOPLE ARE STUPID
<MageKing17> ESPECIALLY ME

<MageKing17> God damn, I do not understand how this is breaking.
<MageKing17> Everything points to "this should work fine", and yet it's clearly not working.
<MjnMixael> 2 hours later... "God damn, how did this ever work at all?!"
(...)
<MageKing17> so
<MageKing17> more than two hours
<MageKing17> but once again we have reached the inevitable conclusion
<MageKing17> How did this code ever work in the first place!?

<@The_E> Welcome to OpenGL, where standards compliance is optional, and error reporting inconsistent

<MageKing17> It was all working perfectly until I actually tried it on an actual mission.

<IronWorks> I am useful for FSO stuff again. This is a red-letter day!
* z64555 erases "Thursday" and rewrites it in red ink

<MageKing17> TIL the entire homing code is held up by shoestrings and duct tape, basically.

 

Offline DahBlount

  • 29
  • Alpine ☆ Cancer Tribulation
    • Minecraft
    • Skype
    • Steam
Re: Deferred Lighting and soft shadows
So this happens.



This only occurs with large ships, not fighters and bombers.
<Axem> yet still more insightful than #hard-light

<Axem> jad2.23 will just be cat videos

<DahBlount> So
<DahBlount> JAD2.2 is like that
<Axem> maybe
<Axem> it can be whatever you like!
<DahBlount> A Chocolate Sundae?
<Axem> sure

My models: GTF Gilgamesh - GTD Nuadha [Redesigning] - Ningirama [WIP] - GTG Zephyrus

 

Online AdmiralRalwood

  • 211
  • Mister Subspace Strikes
    • Skype
    • Steam
    • Twitter
Re: Deferred Lighting and soft shadows
I get the same behavior as DahBlount... although speaking of Icarus, I also get way better performance. Almost a 15 FPS increase in the worst-performing part, compared to trunk. Pretty impressive work, Swifty!
Ph'nglui mglw'nafh Codethulhu GitHub wgah'nagl fhtagn.

schrödinbug (noun) - a bug that manifests itself in running software after a programmer notices that the code should never have worked in the first place.

When you gaze long into BMPMAN, BMPMAN also gazes into you.

"I am one of the best FREDders on Earth" -General Battuta

<Aesaar> literary criticism is vladimir putin

<MageKing17> "There's probably a reason the code is the way it is" is a very dangerous line of thought. :P
<MageKing17> Because the "reason" often turns out to be "nobody noticed it was wrong".
(the very next day)
<MageKing17> this ****ing code did it to me again
<MageKing17> "That doesn't really make sense to me, but I'll assume it was being done for a reason."
<MageKing17> **** ME
<MageKing17> THE REASON IS PEOPLE ARE STUPID
<MageKing17> ESPECIALLY ME

<MageKing17> God damn, I do not understand how this is breaking.
<MageKing17> Everything points to "this should work fine", and yet it's clearly not working.
<MjnMixael> 2 hours later... "God damn, how did this ever work at all?!"
(...)
<MageKing17> so
<MageKing17> more than two hours
<MageKing17> but once again we have reached the inevitable conclusion
<MageKing17> How did this code ever work in the first place!?

<@The_E> Welcome to OpenGL, where standards compliance is optional, and error reporting inconsistent

<MageKing17> It was all working perfectly until I actually tried it on an actual mission.

<IronWorks> I am useful for FSO stuff again. This is a red-letter day!
* z64555 erases "Thursday" and rewrites it in red ink

<MageKing17> TIL the entire homing code is held up by shoestrings and duct tape, basically.

 

Offline Swifty

  • 210
  • I reject your fantasy & substitute my own
Re: Deferred Lighting and soft shadows
Thanks! For both that bug report and the praise!

It looks like I didn't account for 3D warp models. I'll figure out what's up with that.

 

Offline DahBlount

  • 29
  • Alpine ☆ Cancer Tribulation
    • Minecraft
    • Skype
    • Steam
Re: Deferred Lighting and soft shadows
Indeed, great job on the performance boost.

In other news, JAD:XA and Soft Shadows do not blend.


Includes a few old bugs, as well as new ones.
<Axem> yet still more insightful than #hard-light

<Axem> jad2.23 will just be cat videos

<DahBlount> So
<DahBlount> JAD2.2 is like that
<Axem> maybe
<Axem> it can be whatever you like!
<DahBlount> A Chocolate Sundae?
<Axem> sure

My models: GTF Gilgamesh - GTD Nuadha [Redesigning] - Ningirama [WIP] - GTG Zephyrus

 

Offline Swifty

  • 210
  • I reject your fantasy & substitute my own
Re: Deferred Lighting and soft shadows
Videos help but if you can specify what I should be looking for, that will go a long way into making sure I don't miss anything.

 

Offline DahBlount

  • 29
  • Alpine ☆ Cancer Tribulation
    • Minecraft
    • Skype
    • Steam
Re: Deferred Lighting and soft shadows
Issues: sky box and starfield get left behind

Weapons and ships rotated 90 degrees in the select screen


Other than that the invisible ship is due to an external main-f.sdr
<Axem> yet still more insightful than #hard-light

<Axem> jad2.23 will just be cat videos

<DahBlount> So
<DahBlount> JAD2.2 is like that
<Axem> maybe
<Axem> it can be whatever you like!
<DahBlount> A Chocolate Sundae?
<Axem> sure

My models: GTF Gilgamesh - GTD Nuadha [Redesigning] - Ningirama [WIP] - GTG Zephyrus

 

Offline Swifty

  • 210
  • I reject your fantasy & substitute my own
Re: Deferred Lighting and soft shadows
http://www.mediafire.com/download/prw8w7kkieg62kt/shadows_11046.zip

I synced the builds to Revision 11046. I fixed warp POFs while also fixing a lot of weapon and ship select rendering issues. I also fixed a problem with jumpnodes not rendering.

 

Online AdmiralRalwood

  • 211
  • Mister Subspace Strikes
    • Skype
    • Steam
    • Twitter
Re: Deferred Lighting and soft shadows
I fixed warp POFs
I can confirm this! The good ol' test of Icarus is looking much better.

I did have a weird problem, though. When I re-ran Icarus immediately after it finished, FSO crashed. When I tried again with Debug, I got this:
Code: [Select]
Assert: Polygon_models[num]->id == model_num
File: modelread.cpp
Line: 3066
Index collision between model Torrent.pof and requested model 3008. Please backtrace and investigate.


ntdll.dll! ZwWaitForSingleObject + 21 bytes
kernel32.dll! WaitForSingleObjectEx + 67 bytes
kernel32.dll! WaitForSingleObject + 18 bytes
fs2_open_3_7_1_shadows_SSE2-DEBUG.exe! <no symbol>
fs2_open_3_7_1_shadows_SSE2-DEBUG.exe! <no symbol>
fs2_open_3_7_1_shadows_SSE2-DEBUG.exe! <no symbol>
fs2_open_3_7_1_shadows_SSE2-DEBUG.exe! <no symbol>
fs2_open_3_7_1_shadows_SSE2-DEBUG.exe! <no symbol>
fs2_open_3_7_1_shadows_SSE2-DEBUG.exe! <no symbol>
fs2_open_3_7_1_shadows_SSE2-DEBUG.exe! <no symbol>
fs2_open_3_7_1_shadows_SSE2-DEBUG.exe! <no symbol>
fs2_open_3_7_1_shadows_SSE2-DEBUG.exe! <no symbol>
fs2_open_3_7_1_shadows_SSE2-DEBUG.exe! <no symbol>
fs2_open_3_7_1_shadows_SSE2-DEBUG.exe! <no symbol>
fs2_open_3_7_1_shadows_SSE2-DEBUG.exe! <no symbol>
fs2_open_3_7_1_shadows_SSE2-DEBUG.exe! <no symbol>
fs2_open_3_7_1_shadows_SSE2-DEBUG.exe! <no symbol>
fs2_open_3_7_1_shadows_SSE2-DEBUG.exe! <no symbol>
fs2_open_3_7_1_shadows_SSE2-DEBUG.exe! <no symbol>
kernel32.dll! BaseThreadInitThunk + 18 bytes
ntdll.dll! RtlInitializeExceptionChain + 99 bytes
ntdll.dll! RtlInitializeExceptionChain + 54 bytes

Since the lack of symbols makes that less than helpful, here's the same error on a self-compiled build (which exhibited identical behavior to the provided builds):
Code: [Select]
Assert: Polygon_models[num]->id == model_num
File: modelread.cpp
Line: 3066
Index collision between model Torrent.pof and requested model 3008. Please backtrace and investigate.


ntdll.dll! ZwWaitForSingleObject + 21 bytes
kernel32.dll! WaitForSingleObjectEx + 67 bytes
kernel32.dll! WaitForSingleObject + 18 bytes
fs2_open_3_7_1_shadows_AVX-DEBUG.exe! SCP_DumpStack + 354 bytes
fs2_open_3_7_1_shadows_AVX-DEBUG.exe! WinAssert + 238 bytes
fs2_open_3_7_1_shadows_AVX-DEBUG.exe! model_get + 309 bytes
fs2_open_3_7_1_shadows_AVX-DEBUG.exe! ship_page_in + 2693 bytes
fs2_open_3_7_1_shadows_AVX-DEBUG.exe! level_page_in + 48 bytes
fs2_open_3_7_1_shadows_AVX-DEBUG.exe! freespace_mission_load_stuff + 206 bytes
fs2_open_3_7_1_shadows_AVX-DEBUG.exe! game_post_level_init + 177 bytes
fs2_open_3_7_1_shadows_AVX-DEBUG.exe! game_start_mission + 371 bytes
fs2_open_3_7_1_shadows_AVX-DEBUG.exe! game_enter_state + 520 bytes
fs2_open_3_7_1_shadows_AVX-DEBUG.exe! gameseq_set_state + 303 bytes
fs2_open_3_7_1_shadows_AVX-DEBUG.exe! game_process_event + 242 bytes
fs2_open_3_7_1_shadows_AVX-DEBUG.exe! gameseq_process_events + 149 bytes
fs2_open_3_7_1_shadows_AVX-DEBUG.exe! game_main + 782 bytes
fs2_open_3_7_1_shadows_AVX-DEBUG.exe! WinMain + 328 bytes
fs2_open_3_7_1_shadows_AVX-DEBUG.exe! __tmainCRTStartup + 296 bytes
fs2_open_3_7_1_shadows_AVX-DEBUG.exe! WinMainCRTStartup + 13 bytes
kernel32.dll! BaseThreadInitThunk + 18 bytes
ntdll.dll! RtlInitializeExceptionChain + 99 bytes
ntdll.dll! RtlInitializeExceptionChain + 54 bytes


Finally, I was playing around with uncommenting the "$Glowpoint overrides:" entries in bp2-shp.tbm, and encountered some... odd behavior. After the "dogfighting" scene, when the camera cuts to the bombing run, I get a solid white screen (I took a screenshot of it, but it's just a 1920x1080 block of white, so I didn't see a point in uploading it) until about here:


Occasionally the "white screen" happens at some point during the "dogfighting" scene, too, depending on where the camera winds up pointing.

Additionally, although I'm not sure why, this also disables lightshafts at the end:


Again, this only happens if you take bp2-shp.tbm and uncomment the "$Glowpoint overrides:" lines.
Ph'nglui mglw'nafh Codethulhu GitHub wgah'nagl fhtagn.

schrödinbug (noun) - a bug that manifests itself in running software after a programmer notices that the code should never have worked in the first place.

When you gaze long into BMPMAN, BMPMAN also gazes into you.

"I am one of the best FREDders on Earth" -General Battuta

<Aesaar> literary criticism is vladimir putin

<MageKing17> "There's probably a reason the code is the way it is" is a very dangerous line of thought. :P
<MageKing17> Because the "reason" often turns out to be "nobody noticed it was wrong".
(the very next day)
<MageKing17> this ****ing code did it to me again
<MageKing17> "That doesn't really make sense to me, but I'll assume it was being done for a reason."
<MageKing17> **** ME
<MageKing17> THE REASON IS PEOPLE ARE STUPID
<MageKing17> ESPECIALLY ME

<MageKing17> God damn, I do not understand how this is breaking.
<MageKing17> Everything points to "this should work fine", and yet it's clearly not working.
<MjnMixael> 2 hours later... "God damn, how did this ever work at all?!"
(...)
<MageKing17> so
<MageKing17> more than two hours
<MageKing17> but once again we have reached the inevitable conclusion
<MageKing17> How did this code ever work in the first place!?

<@The_E> Welcome to OpenGL, where standards compliance is optional, and error reporting inconsistent

<MageKing17> It was all working perfectly until I actually tried it on an actual mission.

<IronWorks> I am useful for FSO stuff again. This is a red-letter day!
* z64555 erases "Thursday" and rewrites it in red ink

<MageKing17> TIL the entire homing code is held up by shoestrings and duct tape, basically.

 

Offline Swifty

  • 210
  • I reject your fantasy & substitute my own
Re: Deferred Lighting and soft shadows
I just fixed the white screen issue. I've yet to figure out what's causing the crash when loading up Icarus the second time. Same thing happens when loading the first intro mission for BP2 Part 1. Hopefully I'll resolve it this weekend.

 

Offline DahBlount

  • 29
  • Alpine ☆ Cancer Tribulation
    • Minecraft
    • Skype
    • Steam
Re: Deferred Lighting and soft shadows
Could you also figure out why glowpoints aren't clipping through warp models correctly? At the moment, they just appear from no where and follow the ship as it comes through the warp plane.
<Axem> yet still more insightful than #hard-light

<Axem> jad2.23 will just be cat videos

<DahBlount> So
<DahBlount> JAD2.2 is like that
<Axem> maybe
<Axem> it can be whatever you like!
<DahBlount> A Chocolate Sundae?
<Axem> sure

My models: GTF Gilgamesh - GTD Nuadha [Redesigning] - Ningirama [WIP] - GTG Zephyrus

 

Offline Cyborg17

  • 29
  • A-1 Supar
Re: Deferred Lighting and soft shadows
My (admittedly Intelgrated) laptop is unable to render models or skyboxes. 

Screenshot From Icarus scene 1:



[attachment kidnapped by pirates]