Author Topic: Nebula and Sunshafts  (Read 3234 times)

0 Members and 1 Guest are viewing this topic.

Offline Kolgena

  • 211
Nebula and Sunshafts
I have a question about render distances in nebula:

Right now, it seems that ships will gradually blend into the nebula background color the further away they are, until at one point, they instead stop getting rendered at all. This is normally fine, except when you have sunshafts on. Then, when you're facing the sun and a ship gets close enough to pop into existence, it starts casting a giant sunshaft shadow out of nowhere, even if you can't see it yet.

Best way to reproduce: Fly somewhat far away from a friendly cap ship, position it roughly between you and a sun, start flying towards it.

Is this an engine limitation or something that needs to be tweaked in FRED? Btw, the missions in question are any of the retail FS2 nebula missions with cap ships, most notably The Great Hunt.

 

Offline The E

  • He's Ebeneezer Goode
  • Moderator
  • 213
  • Nothing personal, just tech support.
    • Steam
    • Twitter
Re: Nebula and Sunshafts
This is an OpenGL limitation. Fog is created via the OGL fog functions, which simply clip objects out once they're too far away; With the current setup, we can't actually do anything about this, this'll have to wait until we move to the deferred renderer.
If I'm just aching this can't go on
I came from chasing dreams to feel alone
There must be changes, miss to feel strong
I really need lifе to touch me
--Evergrey, Where August Mourns

 

Offline Kolgena

  • 211
Re: Nebula and Sunshafts
I'm guessing there are good reasons preventing the engine from doing the same (similar but asymptotic?) alpha blending as now, but somehow skip the clipping or set the clip distance to 9999999?

 

Offline Aardwolf

  • 211
  • Posts: 16,384
    • Minecraft
Re: Nebula and Sunshafts
So do the fog with the fragment shader instead? Then you can avoid that stupid effect where the fog at the edges of the screen is thinner than if you look directly at the object, too.

Huh... I wasn't aware fog caused objects to clip. You learn something new every day.

 

Offline Swifty

  • 210
  • I reject your fantasy & substitute my own
Re: Nebula and Sunshafts
The fog is already done with the fragment shader. 

I can't think of an adequate way to ease in ship lightshaft visibility based on distance. Would turning off lightshafts in the renderer be an acceptable solution in nebula scenes?

 

Offline Luis Dias

  • 211
Re: Nebula and Sunshafts
No. Absolutely not. This is a problem that is rare to encounter and if its solution is to scrap off the one case where lightshafts make the best sense to exist, the best atmosphere, the coolest thing ever, **** the problem.

 

Offline Kolgena

  • 211
Re: Nebula and Sunshafts
The fog is already done with the fragment shader. 

I can't think of an adequate way to ease in ship lightshaft visibility based on distance. Would turning off lightshafts in the renderer be an acceptable solution in nebula scenes?

Is there a reason why we can't change it so ships never clip out of existence? They can be 100% the same color as the background nebula (effectively invisible), but if the model itself never disappears, it should cast sunshafts, no?

(Also, IMO sunshafts ONLY make sense in nebula and look terrible to me in space missions. Reversing it would just be lulzy)

 

Offline Swifty

  • 210
  • I reject your fantasy & substitute my own
Re: Nebula and Sunshafts
We exclude rendering of ships out of fog distance to save on rendering time. At least that's what I think is why.

But if you guys insist, we'll just keep rendering ships in fog regardless of distance if lightshafts are turned on then. I'm just worried about potential rendering bugs this fix could create if any, especially if my assumptions are wrong.

 

Offline Kolgena

  • 211
Re: Nebula and Sunshafts
Thanks Swifty!

Is rendering much more expensive in nebula because of all the blending? Space missions with similar complexity run just fine otherwise. (Also, how does the engine calculate damage/collisions in skirmishes for ships that aren't rendered because they're far away? For one, beam burn particles seem to render somewhat properly in absence of a rendered model)

Another thing that (may have) been there since forever: I'm pretty sure cap ships will blink into existence in front of suns in the skybox once you get close enough. I might be wrong though.

 

Offline Aardwolf

  • 211
  • Posts: 16,384
    • Minecraft
Re: Nebula and Sunshafts
Could you render them cheaper somehow because they are entirely fogged out? (Rhetorical question, yes you could... but would that sort of optimization be worthwhile?)

 

Offline Luis Dias

  • 211
Re: Nebula and Sunshafts
That is an idea. Force the renderer to use the last available LOD when the distance is bigger than the fog's max for instance. Although there would be a difference in the outline.

  

Offline Aardwolf

  • 211
  • Posts: 16,384
    • Minecraft
Re: Nebula and Sunshafts
I was thinking more like...

Pass just the verts to the shader because the texcoords and normal vectors aren't going to matter. And you could also render all the subobjects without having to change any texture states.