Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: TrashMan on October 24, 2017, 03:29:09 am

Title: Subspace + nebula
Post by: TrashMan on October 24, 2017, 03:29:09 am
Some time ago I made a mission where I used both the subspace and nebula effect, and it worked perfectly.
The subspace corridor was just barely visible, nebula pofs and lighting effect worked normally and ships popped out of the nebula (weren't visible in the distance) as they should.

However, recent (relatively) builds seemed to change how things are rendered, because now I see the outline of every ship in the distance, completely ruining the mission (and the entire effect in a way).

Is it a matter of some setting or render flag I can tweak, or am I fugged?
Title: Re: Subspace + nebula
Post by: Lykurgos88 on October 25, 2017, 02:12:27 pm
My guess is that this is caused by MediaVP2014's more transparent nebula gas sprites. If you want the to change them, you can use MediaVP_3612 or extract only the old sprites and use them in your custom mod (overriding newer MediaVP assets).
Title: Re: Subspace + nebula
Post by: Lykurgos88 on October 25, 2017, 05:21:28 pm
I managed to find an old screenshot of a mission from Shadow Genesis that describes your problem:

(http://olzie.mbnet.fi/Moebius/FSO_bughunt/Nebula_outline/screen0160_mini.png)

So basically this happens, when the background skybox is not unicolor. The older more opaque nebula sprites from mediaVP_3612 managed to hide the ship outlines far better.
Title: Re: Subspace + nebula
Post by: AdmiralRalwood on October 25, 2017, 07:07:54 pm
Can you test something real quick for me? Reproduce this in a debug build, open the debug console (shift+enter in-game), then type "neb_skip", then close the debug console.
Title: Re: Subspace + nebula
Post by: Luis Dias on October 26, 2017, 06:06:03 am
Yes, I've seen this many many times, it's just the way it renders the fog: the color of the nebula fog will paint the ships in a gradient the farther they are, until they are totally that color. A much more useful algorithm would be to have the background painted on top of the ships, but I have no idea if this is hard to do, or even a smart thing to do in all cases.
Title: Re: Subspace + nebula
Post by: TrashMan on October 28, 2017, 09:56:47 am
How it used to be:
(https://s1.postimg.org/8wc42kb5y3/cotsload14.jpg) (https://postimg.org/image/8wc42kb5y3/)
Not a good example, as it doesn't show ship in the distance that were concealed


How it is now:
(https://s1.postimg.org/4nwwsqd7dn/Nebula_Node.jpg) (https://postimg.org/image/4nwwsqd7dn/)
Title: Re: Subspace + nebula
Post by: AdmiralRalwood on October 28, 2017, 10:55:15 am
How it used to be:
[snip]
Not a good example, as it doesn't show ship in the distance that were concealed


How it is now:
[snip]
If you want this fixed, I need you to do this:
Can you test something real quick for me? Reproduce this in a debug build, open the debug console (shift+enter in-game), then type "neb_skip", then close the debug console.
And then report on whether or not that behavior is preferable, obviously.
Title: Re: Subspace + nebula
Post by: TrashMan on October 28, 2017, 04:59:06 pm

Unfortunately, I can't try that, because the debug build complain hat two capital ships (Titan and Typhon) have inverted bounding boxes on EVERYTHING (is there a simple way to fix this), and after clicking trough all the error pop-up, I get:

Assert: "strstr( (const char *)&props, "$glow_texture=") != NULL"
File: modelread.cpp
Line: 1955

ntdll.dll! NtWaitForSingleObject + 10 bytes
KERNELBASE.dll! WaitForSingleObjectEx + 156 bytes
fs2_open_3_8_0_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_0_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_0_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_0_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_0_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_0_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_0_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_0_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_0_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_0_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_0_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_0_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_0_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_0_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_0_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_0_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_0_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_0_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_0_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_0_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_0_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_0_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_0_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_0_x64_SSE2-FASTDBG.exe! <no symbol>
[...]
[ This info is in the clipboard so you can paste it somewhere now ]


This is strange, since I checked all 3 capital ships in the mission and they all have clearly defined glows (red_glow and blue_small4_glow)
Title: Re: Subspace + nebula
Post by: AdmiralRalwood on October 28, 2017, 05:39:45 pm
Well, somewhere in one of those POFs is a glowbank without "$glow_texture=" in its properties.
Title: Re: Subspace + nebula
Post by: TrashMan on October 29, 2017, 05:04:45 am
I made a new mission to test it.

When I use the debug command I can't see ships in the distance, but they just pop up suddenly when I get close. There is NO granularity whatsoever.
It's not like the front is visible and the rear less visible, the entire hing just appears.


Should be easy for anyone to test - just make a mission in subspace with nebula turned on, place some ships and look/fly around.


In a somewhat unrelated note - half of the models I'm using report every single subobject is inverted. Half of those models aren't even mine.
Any way to batch invert/fix, or do I have to go trough every single subobject and invert the values manually in PCS2?
Title: Re: Subspace + nebula
Post by: m!m on October 30, 2017, 04:44:58 am
I'm sorry but the way the rendering engine currently works does not really support fading ships out to the color of the skybox behind the object. There may be a way to either use the skybox cubemap for determining the fade color or using a post-processing effect for achieving the nebula effect but at the moment the behavior you see is more or less the expected behavior.
Title: Re: Subspace + nebula
Post by: Kiloku on October 30, 2017, 06:02:10 am
Is it possible to apply a GLSL shader onto an object? Because that sounds like a cheap way to fade them into an arbitrary color.

Could also figure out a way of making it translucent but still hide other 3D objects that go behind it (in essence, making it show the skybox behind it)
Title: Re: Subspace + nebula
Post by: m!m on October 30, 2017, 07:50:48 am
Since 3.8 we exclusively use shaders for rendering objects so yes, it is possible to apply them to an object which is exactly what we are currently doing for rendering nebula fog but that uses a uniform color for all objects.

The biggest problem is that objects can not be rendered as "transparent" while doing the normal render pass since the rendering technique we are using for that simply does not support that. It may be possible to use the color of the skybox behind the object but that would require a separate texture lookup and it would interfere with later rendering steps so I would like to avoid that.
Title: Re: Subspace + nebula
Post by: Lykurgos88 on October 30, 2017, 12:41:12 pm
My screenshot was from version 3.7.2 or 3.7.1 Nightly.

I thought this was caused by different mediaVPs? At least I got different results when I tried switching back to 3.6.12 at that time.
Title: Re: Subspace + nebula
Post by: m!m on October 30, 2017, 06:17:16 pm
If I remember correctly, 3.7.2 was when the deferred rendering was added which is the reason why objects cannot simply be faded to transparency anymore. That would explain why it started to happen with that version.
Title: Re: Subspace + nebula
Post by: chief1983 on October 31, 2017, 03:30:39 pm
Just want to make sure, but it seems there was some ambiguity there.  Lukurgos88, you mean when you switched to the MediaVPs 3.6.12, with a 3.7.2+ build?  Or you were playing the 3.6.12 MediaVPs with a 3.7.0 or lower build?

m!m, if he meant the former and that wasn't what you understood then there might be more here.  Just wanted to make sure that was or wasn't the case though, the version numbers in the previous post have me a little confused now, and I wondered if you understood them differently than he intended or not.