Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: rscaper1070 on August 15, 2011, 09:31:48 pm

Title: Nebula and Skyboxes
Post by: rscaper1070 on August 15, 2011, 09:31:48 pm
You've probably already seen it but I recently made a skybox that is meant to be freded with nebula poofs. When I made my test mission I only used small craft and everything looks pretty cool. Luis Dias pointed out though that larger ships don't show up at all until about 1500 meters and when they do they pop into the scene.

Here's a vid to illustrate: http://www.youtube.com/watch?v=7mHHU1CBzsk (http://www.youtube.com/watch?v=7mHHU1CBzsk)

It seems the ship should still be visible in silhouette from far away and then gradually become more visible as you get closer. Is there a way to change the way large ships are rendered in nebula when a skybox is present?


(p.s. I know my hud is all messed up. It's just in my test mod.)


 
Title: Re: Nebula and Skyboxes
Post by: IronBeer on August 15, 2011, 11:26:54 pm
The large ship "pop" is unfortunate, but finding that skyboxes work with nebulae is f'kin awesome! Seriously, the overall effect is absolutely kickass.
Title: Re: Nebula and Skyboxes
Post by: Bobboau on August 15, 2011, 11:39:26 pm
a long time ago I tried implementing 'texture fog' where it would use the background image and interpolate it with the textures/lighting of the ship, I never quite got it working, but I didn't have shaders, such an effect should be relatively easy now, especially since it's technically almost identical to the cloaking effect.
Title: Re: Nebula and Skyboxes
Post by: mjn.mixael on August 15, 2011, 11:41:26 pm
Hmmm... someone page Valathil to this thread....  :nervous:
Title: Re: Nebula and Skyboxes
Post by: Shivan Hunter on August 15, 2011, 11:44:37 pm
valathil is dinosaur coding jesus :D
Title: Re: Nebula and Skyboxes
Post by: Flipside on August 15, 2011, 11:50:58 pm
I'm not one of the coders, but it looks to me like if the nebula flag is enabled, the maximum draw distance is reduced to a preset amount and that changing that value should be all that is needed, however, since I don't have to look at the code, that's easy for me to say ;)
Title: Re: Nebula and Skyboxes
Post by: rscaper1070 on August 15, 2011, 11:55:03 pm
I'm not one of the coders, but it looks to me like if the nebula flag is enabled, the maximum draw distance is reduced to a preset amount and that changing that value should be all that is needed, however, since I don't have to look at the code, that's easy for me to say ;)

That's pretty much what my non-coder brain was thinking as well. I also thought that if Valathil took a bite of the problem he would probably spit something out that would blow all of our minds.
Title: Re: Nebula and Skyboxes
Post by: Sobbsy on August 15, 2011, 11:55:55 pm
It would be nice if there was the ability to 'billboard' distant models - ie; beyond a certain range, models are represented by a 2d 'sprite' of sorts. As you get closer, they switch out with their relative 3d model. Something like that combined with soft particles would be a good workaround. The only problem is that I have no idea how to do the 2d sprite and account for 'angle of attack', ie; what angle the player is approaching it from. Either you'd need a LOT of sprites for all possible angles, or somehow make the ship model appear as a sprite viewed from the angle you're approaching it from.

Probably not the best solution for obvious reasons. The other option is to have models fade in to view gradually rather than just snap into existence. I'm sure that's a far more plausible workaround for any plucky coders out there, and it would probably be the most visually appealing method.

I'm not sure if increasing the render distance is the most elegant solution either, but it would definitely work.
Title: Re: Nebula and Skyboxes
Post by: Flipside on August 15, 2011, 11:57:22 pm
As an aside, I think this is one of those situations where a procedural 'cloud' type effect in the background as a sort of midground between the poofs and the skybox would really have an impact, since the skybox does reveal that the nebula is a lot thinner than it seems and relies a lot on not having a skybox in order to encourage that 'where am I?' sensation.
Title: Re: Nebula and Skyboxes
Post by: The E on August 16, 2011, 02:09:55 am
It would be nice if there was the ability to 'billboard' distant models - ie; beyond a certain range, models are represented by a 2d 'sprite' of sorts. As you get closer, they switch out with their relative 3d model. Something like that combined with soft particles would be a good workaround. The only problem is that I have no idea how to do the 2d sprite and account for 'angle of attack', ie; what angle the player is approaching it from. Either you'd need a LOT of sprites for all possible angles, or somehow make the ship model appear as a sprite viewed from the angle you're approaching it from.

Probably not the best solution for obvious reasons. The other option is to have models fade in to view gradually rather than just snap into existence. I'm sure that's a far more plausible workaround for any plucky coders out there, and it would probably be the most visually appealing method.

I'm not sure if increasing the render distance is the most elegant solution either, but it would definitely work.

Not going to happen, because that's what LODs are for.
Title: Re: Nebula and Skyboxes
Post by: Nuke on August 16, 2011, 03:45:25 am
transparency sorta is conflicting there, you see these distant clouds but at the same time you see the ship hazed up so bad that it looks like visibility should be a fraction of that, making it impossible to see the skybox. if you could just reduce the haze you would have a nice effect there.
Title: Re: Nebula and Skyboxes
Post by: Sobbsy on August 16, 2011, 03:52:33 am
Not going to happen, because that's what LODs are for.

Yeah, I was going to make a comment along the lines of "But I suppose we could just use more aggressive LODs for that effect". I think that with some good LOD models and a more effective method of 'fading' models into view, the problem is more or less solved. It'd be a bit like soft particles, you know? Have the model fade in gradually based on its distance away from the player, and it should work quite well.

Really the biggest issue with what I saw in the OP's video was not with how far away the models were being rendered, but rather with how harshly the models blinked into existence when they hit the rendering range's outer limit. If we can make them appear more 'naturally', then I would say that would do the trick just fine. Perhaps some sort of additive / blend setup whereby that fog-like effect that covers them tries its best to match the surrounding textures (the ship had a blue-ish fogging on it in the video). You know, a bit like how most AA methods sample surrounding pixels in order to better match the colour blending on harsh edges? Nothing quite so complex, but you get the idea.
Title: Re: Nebula and Skyboxes
Post by: The E on August 16, 2011, 05:22:46 am
I will await your code patch then.
Title: Re: Nebula and Skyboxes
Post by: headdie on August 16, 2011, 06:57:32 am
Not going to happen, because that's what LODs are for.

Yeah, I was going to make a comment along the lines of "But I suppose we could just use more aggressive LODs for that effect". I think that with some good LOD models and a more effective method of 'fading' models into view, the problem is more or less solved. It'd be a bit like soft particles, you know? Have the model fade in gradually based on its distance away from the player, and it should work quite well.

Really the biggest issue with what I saw in the OP's video was not with how far away the models were being rendered, but rather with how harshly the models blinked into existence when they hit the rendering range's outer limit. If we can make them appear more 'naturally', then I would say that would do the trick just fine. Perhaps some sort of additive / blend setup whereby that fog-like effect that covers them tries its best to match the surrounding textures (the ship had a blue-ish fogging on it in the video). You know, a bit like how most AA methods sample surrounding pixels in order to better match the colour blending on harsh edges? Nothing quite so complex, but you get the idea.

would the cloaking shader help?
Title: Re: Nebula and Skyboxes
Post by: Trivial Psychic on August 16, 2011, 04:48:03 pm
I'm not sure whether this has any bearing to the discussion, but objecttypes.tbl has an option on a per-class basis, to adjust at what point a ship will begin to be obscured by nebula fog, and at what point it will be completely obscured.  As I have pointed out in the asteroids and nebula thread, (and others over the years) it doesn't seem that much of a stretch of the imagination to allow this figure to be adjusted on a per-mission basis using a global multiplier used on the figures for each class, in the background editor in FRED, or perhaps via sexps in-mission to allow for variable density nebulae.
Title: Re: Nebula and Skyboxes
Post by: Zacam on August 17, 2011, 12:28:15 am

May or may not be related, but there is code pending that, to quote:
Quote from: Sushi
Adds +Fog Near Mult: and +Fog Far Mult: to the .fs2 file, allowing mission-specific changes to fog render distance. This doesn't affect the way the poofs are drawn, just the models.

It's still pending tests and the interface elements to FRED and may no precisely address all elements raised in this thread, but it's something at any rate and will likely be showing up as soon as FRED controls are made for it and it's been further tested.
Title: Re: Nebula and Skyboxes
Post by: Nuke on August 17, 2011, 07:32:05 am
that otta fix the haze issue nicely.
Title: Re: Nebula and Skyboxes
Post by: Sushi on August 17, 2011, 10:09:01 am

May or may not be related, but there is code pending that, to quote:
Quote from: Sushi
Adds +Fog Near Mult: and +Fog Far Mult: to the .fs2 file, allowing mission-specific changes to fog render distance. This doesn't affect the way the poofs are drawn, just the models.

It's still pending tests and the interface elements to FRED and may no precisely address all elements raised in this thread, but it's something at any rate and will likely be showing up as soon as FRED controls are made for it and it's been further tested.


It's been "pending FRED integration" for months and months. :) I'd do it myself, but lacking VS Professional, I can't compile FRED. So if you want it, bug one of the other SCP guys to do it. :)
Title: Re: Nebula and Skyboxes
Post by: JCDNWarrior on August 17, 2011, 10:10:52 am
Less pending, more integration! ;)

I'd love to toy around with all the new effects as of late, but seems I'll have to wait with that until there's a solid version of it in the SVN/Nightlies.

EDIT: Wow, speak of the 'devil', a new nightly just got released. ^^
Title: Re: Nebula and Skyboxes
Post by: Iss Mneur on August 18, 2011, 11:09:24 am

May or may not be related, but there is code pending that, to quote:
Quote from: Sushi
Adds +Fog Near Mult: and +Fog Far Mult: to the .fs2 file, allowing mission-specific changes to fog render distance. This doesn't affect the way the poofs are drawn, just the models.

It's still pending tests and the interface elements to FRED and may no precisely address all elements raised in this thread, but it's something at any rate and will likely be showing up as soon as FRED controls are made for it and it's been further tested.


It's been "pending FRED integration" for months and months. :) I'd do it myself, but lacking VS Professional, I can't compile FRED. So if you want it, bug one of the other SCP guys to do it. :)

Just to be clear, you are talking about this (http://www.hard-light.net/forums/index.php?topic=74143.0) [SCP internal] patch?  Since I am futzing around with FRED anyway I will do it tonight if Zacam or Karajorma don't beat me to it.
Title: Re: Nebula and Skyboxes
Post by: Sushi on August 18, 2011, 03:23:11 pm

May or may not be related, but there is code pending that, to quote:
Quote from: Sushi
Adds +Fog Near Mult: and +Fog Far Mult: to the .fs2 file, allowing mission-specific changes to fog render distance. This doesn't affect the way the poofs are drawn, just the models.

It's still pending tests and the interface elements to FRED and may no precisely address all elements raised in this thread, but it's something at any rate and will likely be showing up as soon as FRED controls are made for it and it's been further tested.


It's been "pending FRED integration" for months and months. :) I'd do it myself, but lacking VS Professional, I can't compile FRED. So if you want it, bug one of the other SCP guys to do it. :)

Just to be clear, you are talking about this (http://www.hard-light.net/forums/index.php?topic=74143.0) [SCP internal] patch?  Since I am futzing around with FRED anyway I will do it tonight if Zacam or Karajorma don't beat me to it.

Yep, that's the one. All it needs is FRED integration.

A SEXP for mid-mission changes might be nice too, but I can do that just fine on my own. :)
Title: Re: Nebula and Skyboxes
Post by: Bobboau on August 18, 2011, 05:02:39 pm
that otta fix the haze issue nicely.

no it won't, unless you make it so far it's effectively infinite, in which case no fogging will be applied. once an object reaches the end of the fog distance it will blink out (or in if moving the other way) this is because once you reach maximum fog distance you are supposed to be the same color as the backgrund, and thus don't need to be drawn anymore, unless the background is a different color then the fog (as in the case with a skybox), the only way to fix this (without losing the performance benefit of distance culling) is to make sure you fade to what is behind you.
Title: Re: Nebula and Skyboxes
Post by: Trivial Psychic on August 20, 2011, 06:17:48 pm
POP (http://svn.icculus.org/fs2open/?pathrev=7494)!!

Next thing we need (I'm assuming that its not included in this update) is sexps to control these in-mission.  That way, a FREDder could place waypoints and use variables based on distance between the player and the waypoints to control how thick a nebula is, allowing for clear pockets to be created.
Title: Re: Nebula and Skyboxes
Post by: Luis Dias on August 20, 2011, 09:43:18 pm
That's actually a pretty idea, to use distances between said waypoints and alpha1, since it creates smoothed transitions. But the equations and implementations should be discussed. There is the potential to screw it up bigtime. Suppose you have a waypoint in 0,0,0 with maxfogdistance of 10 000. Then you have a waypoint in 0,0,2000 with mfd of 2000. And you have a ship located @ 0,0,6000.

If you'd go straight ahead, you'd see the ship, then you wouldn't, then you'd see it again, in a very unrealistical way.

OTOH, it could possibly create mesmerizing experiences (a la Ransom).
Title: Re: Nebula and Skyboxes
Post by: Trivial Psychic on August 21, 2011, 11:44:30 am
The nebula fog options are now in a Knightly (http://www.hard-light.net/forums/index.php?topic=77891.msg1541179) build... no sexps yet though.
Title: Re: Nebula and Skyboxes
Post by: Sushi on August 21, 2011, 11:56:54 am
POP (http://svn.icculus.org/fs2open/?pathrev=7494)!!

Next thing we need (I'm assuming that its not included in this update) is sexps to control these in-mission.  That way, a FREDder could place waypoints and use variables based on distance between the player and the waypoints to control how thick a nebula is, allowing for clear pockets to be created.

Keep in mind, for that effect to look good, you'd probably also need to dynamically change the nebula poofs. The changes here do NOT affect the nebula poofs: just how far away things are rendered. It may look odd for the fog to "thin" but the poofs keep looking the same.
Title: Re: Nebula and Skyboxes
Post by: Trivial Psychic on August 21, 2011, 12:11:34 pm
Well, in the Asteroids and Nebula thread, I also suggested a means of increasing the distance between nebula poofs as a way of complimenting the fog thing to make nebulae appear thinner, but there was already some code in place for fog control (in objecttypes.tbl) so it appeared the most likely to get implemented.  The fog controls are at least a start.  If we could combine this with fog sexps and similar controls for poof distances, then we should have quite a system in-place.
Title: Re: Nebula and Skyboxes
Post by: Luis Dias on August 21, 2011, 01:04:51 pm
Dunno. I think this is one of those cases of "wait and see". And lots of iterations, prepare for that. It will be very strange to see the background almost clear and then seeing it fade away while you are traveling towards it... or not.
Title: Re: Nebula and Skyboxes
Post by: Nyctaeus on December 30, 2015, 05:34:21 pm
:bump:

Sorry for about 5 years old necro but I'm diggin', diggin' and... Well, diggin'. And I found nothing :(.

Maybe I'm stupid and I don't know where I should look for some solution. I remember someone did something with post processing table. Was this ever solved?
Title: Re: Nebula and Skyboxes
Post by: mjn.mixael on December 31, 2015, 09:23:06 am
:bump:

Sorry for about 5 years old necro but I'm diggin', diggin' and... Well, diggin'. And I found nothing :(.

Maybe I'm stupid and I don't know where I should look for some solution. I remember someone did something with post processing table. Was this ever solved?

This is a 5 year necro... I'm not going to go back and re-read this whole thread... could you explain what you are actually looking for? kthx.
Title: Re: Nebula and Skyboxes
Post by: Nyctaeus on January 01, 2016, 02:40:17 pm
The problem is when I'm using skybox in nebula mission. Silhouettes of all ships are visible at large distances. Without skybox distant ships are in the same color as nebula and are invisible, but with skybox silhouettes are constantly visible. This is not a major issue, but the coolness of nebula missions are exactly because you can hide ships in gas :D.