Oolite Bulletins

For information and discussion about Oolite.
It is currently Sun Nov 19, 2017 5:52 pm

All times are UTC




Post new topic  Reply to topic  [ 411 posts ]  Go to page Previous 124 25 26 27 28
Author Message
 Post subject: Re: Shaders’ Outpost
PostPosted: Tue Jul 18, 2017 12:26 pm 
Offline
---- E L I T E ----
---- E L I T E ----
User avatar

Joined: Sun Jul 19, 2015 1:09 pm
Posts: 417
As some of you know, I have been working on an update for the System Features Rings OXP and there were some discussion about it in the Screenshots thread starting with this post. Because the discussion was out of topic over there (sorry again!), I thought of continuing it here. I currently have three issues that I would like to solve/improve and I would greatly appreciate some advice:

- drawing distance seems to be set at 2.7 OU, at which points the rings pop out of existance. Apparently this would have to be modified in the core code of the game.

- applying opacity < 1.0 to rings: no matter what value I use as the last argument of gl_FragColor. Some people told me that I can't have transparency in Oolite. Others told me to look at the atmosphere fragment shader, but I can't understand why the transparency works there and not with the rings shader. I have also read online that one must enable blending in order to work with opacity, but I am an utter complete GLSL noob and I don't know what that means nor how to accomplish it.

- a minor thing, but would someone here perhaps know how to improve the Moire patterns that the rings display?

Here is what I have so far:

Image

Image

Image


Top
   
 Post subject: Re: Shaders’ Outpost
PostPosted: Tue Jul 18, 2017 3:04 pm 
Offline
---- E L I T E ----
---- E L I T E ----
User avatar

Joined: Sat Oct 20, 2007 2:52 pm
Posts: 2267
Quote:
- applying opacity < 1.0 to rings: no matter what value I use as the last argument of gl_FragColor. Some people told me that I can't have transparency in Oolite. Others told me to look at the atmosphere fragment shader, but I can't understand why the transparency works there and not with the rings shader. I have also read online that one must enable blending in order to work with opacity, but I am an utter complete GLSL noob and I don't know what that means nor how to accomplish it.
You can't enable it through GLSL. Only Oolite can enable blending and as far as I know it does it only for the planets/flashers. So no OXP ship or extra features - like the rings - can use it. There was some thinking about giving shaders are readout for the backbuffer or a render target, but I think it has not been implemented yet.


Top
   
 Post subject: Re: Shaders’ Outpost
PostPosted: Tue Jul 18, 2017 3:52 pm 
Offline
Deadly
Deadly

Joined: Sat Aug 09, 2014 4:16 pm
Posts: 169
To confirm what Svengali said, the material the shader applies to must have transparency "beforehand" the shader comes into action.

The system rings OXP (and the other OXPs too) seem to apply the shader effects using the effectdata.plist file in the Config folder. That file (and the stuff it uses) seems to be defined in OOShipRegistry.m source file. "Injecting" transparency in the material assumed at that point could help here, but also "break" things in other places -- textually -- showing holes where they're not supposed to be :)

The reason I've pointed you to the atmosphere shader "quant" calculation, was to follow Griff's advice on the Screenshots discussion: fading the rings to black when the distance comes close the disappearance limit.

I just checked though, and the size of the rings is too big at that limit -- so fading it to black might be a good thing if the planet is not seen on the background of a nebula, but make it worse if that's the case.


Top
   
 Post subject: Re: Shaders’ Outpost
PostPosted: Tue Jul 18, 2017 5:04 pm 
Offline
---- E L I T E ----
---- E L I T E ----
User avatar

Joined: Sun Jul 19, 2015 1:09 pm
Posts: 417
I see, thanks to you two for the clarifications. I will probably let this opacity issue aside and just think of the others.
Quote:
The reason I've pointed you to the atmosphere shader "quant" calculation, was to follow Griff's advice on the Screenshots discussion: fading the rings to black when the distance comes close the disappearance limit.

I just checked though, and the size of the rings is too big at that limit -- so fading it to black might be a good thing if the planet is not seen on the background of a nebula, but make it worse if that's the case.
Hmm, this might make it look even stranger: a planet against a nebula would have a black ring popping up then slowly getting colour. I wonder how difficult it would be to make a core change to allow certain objects to have larger drawing distances, I will ask another_commander if this is possible and if he would consider implementing this. That would really solve this issue, as this fading might improve a bit, but sounds too much like a hack to me and has this potential drawback that Commander_X pointed out.

And once again, thank you all for all the feedback and patient answers, I really appreciate it all :D


Top
   
 Post subject: Re: Shaders’ Outpost
PostPosted: Tue Jul 18, 2017 7:18 pm 
Offline
Deadly
Deadly

Joined: Sat Aug 09, 2014 4:16 pm
Posts: 169
Quote:
I wonder how difficult it would be to make a core change to allow certain objects to have larger drawing distances, I will ask another_commander if this is possible and if he would consider implementing this. That would really solve this issue, as this fading might improve a bit, but sounds too much like a hack to me and has this potential drawback that Commander_X pointed out.
Well, don't be afraid of hacks. It is how the atmosphere shader started actually, by hacking the planet shader. Then, as suggested by a_c I've done a bit of core hacking on the atmosphere part.
In what you're trying, maybe it would worth investigating the approach to allow for transparency for the effectsdata.plist approach (which would also "free" the OXPs of the non-transparent shader codes).

To come back to your request on the Screenshots discussion, the quick hack I've made to avoid the Moire is quite simple -- I've commented out the code that draws holes in the rings. Unfortunately this lead to two other inconveniences:
1. (which should be easier to overcome) The rings are solid. Although from the distance the patterns are no more a problem, when getting closer (or through) one wouldn't be able to see "through" the rings. In order to avoid this that "quant" method I mentioned could be used to unblock the holes once the ship is close enough.
2. (which is more difficult to overcome) There are other artifacts that come from the whole texture drawing. Some are visible at close range (not very important considering 1. above) -- some seams of the texture, and some weird mapping issues. But from the distance it seems that the whole texture setup is not cooperating as expected with the atmosphere/planet shader, giving some rough edges where the planet is lit along the rings (see below in the top right part of the planet).

Image
Quote:
And once again, thank you all for all the feedback and patient answers, I really appreciate it all :D
You're welcome, that's what a forum is for!


Top
   
 Post subject: Re: Shaders’ Outpost
PostPosted: Mon Aug 07, 2017 6:05 pm 
Offline
---- E L I T E ----
---- E L I T E ----
User avatar

Joined: Sat Oct 20, 2007 2:52 pm
Posts: 2267
Just as sidenote for all the GPU folks - I rediscovered a very good in-depth explanation on how GPU works published in 2008 on c0de517e blog:


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 411 posts ]  Go to page Previous 124 25 26 27 28

All times are UTC


Who is online

Users browsing this forum: No registered users and 26 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron
Powered by phpBB® Forum Software © phpBB Limited