Shaders’ Outpost

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: winston, another_commander

User avatar
submersible
Commodore
Commodore
Posts: 264
Joined: Thu Nov 10, 2011 7:49 am

Re: Shaders’ Outpost

Post by submersible »

Griff wrote:
From lusting after the lovely planet screenshots going up in the 'progress' thread i dug out the old Earth example shader (based on the example shader in ATI's Rendermonkey) and added in a small rim light atmosphere effect i pinched off a shader tutorial website
Griff - do you mind if I include this in the sample SHADY_PLANETS oxp , for use as reference in getting planets with shaders and materials working ?

Also - regarding rim atmosphere effects , I have seen some use of a clever vertex shader to simulate this effect also (it does require additional geometry - perhaps the oolite planet atmosphere could use a similar method).

The code I think I found here
http://rapidlibrary.com/files/spo-sandb ... i89on.html
It produces an atmosphere halo like this
Image
I've yet to reproduce this with Oolite however I think with a couple of uniform bindings (radius and atmosphere radius) for the planet entity, it would be feasible.
Last edited by submersible on Sat Mar 31, 2018 11:32 pm, edited 1 time in total.
User avatar
Griff
Oolite 2 Art Director
Oolite 2 Art Director
Posts: 2483
Joined: Fri Jul 14, 2006 12:29 pm
Location: Probably hugging his Air Fryer

Re: Shaders’ Outpost

Post by Griff »

submersible wrote:
Griff - do you mind if I include this in the sample SHADY_PLANETS oxp , for use as reference in getting planets with shaders and materials working ?
Yes please do if it'll help you guys with the amazing looking work your doing with the planet code! This oxp is just my hamfisted mangling of a normal map shader Ahruman wrote just after normalmapping became available in Oolite and some bits of code (& textures) out of an example shader that ships with AMD/ATI's Rendermonkey. The atmoshpere 'rim light' bit comes from here http://entitycrisis.blogspot.co.uk/2011 ... hader.html
He has a link to slightly more advanced effect on that page that looks a bit like your screenshot but i couldn't get it working nicely in oolite (it looks OK on the dark side of the planet, but on the lit side the whole surface takes on the colour of the atmosphere rather than just limiting itself to a halo effect)
If you'd like the original rendermonkey shader code i can post it up here - it seems to have a lot of advanced stuff in it that probably doesn't apply to what Oolite needs)

There's some mad shader work here - way to advanced for me to understand, looks a lot like the effect in your screenshot!
http://http.developer.nvidia.com/GPUGem ... ter16.html
User avatar
submersible
Commodore
Commodore
Posts: 264
Joined: Thu Nov 10, 2011 7:49 am

Re: Shaders’ Outpost

Post by submersible »

Griff wrote:
submersible wrote:
Griff - do you mind if I include this in the sample SHADY_PLANETS oxp , for use as reference in getting planets with shaders and materials working ?
Yes please do if it'll help you guys with the amazing looking work your doing with the planet code!
Great - thanks. I will include it as a test case in the reference OXP.
Griff wrote:
There's some mad shader work here - way to advanced for me to understand, looks a lot like the effect in your screenshot!
http://http.developer.nvidia.com/GPUGem ... ter16.html
Yup - that is the approach being taken in the shader in my previous screenshot, approximate simulation of scattering and the resulting decay of different frequencies of the transmitted light. Also too tricky for me to grasp right now. :?
User avatar
Smivs
Retired Assassin
Retired Assassin
Posts: 8408
Joined: Tue Feb 09, 2010 11:31 am
Location: Lost in space
Contact:

Re: Shaders’ Outpost

Post by Smivs »

I am currently developing a revolutionary player ship for OXP release sometime in the future. The 'nuts and bolts' of the project are taking shape and I am going to be looking at texturing the ship soon. However one area I still know nothing about is shaders, and I would like to offer a shader version of the ship alongside the normal diffuse/emission mapped version.
So, in a word, I will be looking for a volunteer to 'shaderify' the ship for me. There will be two models to 'skin'. I am not yet at the stage where this is necessary, but if anybody would be interested in looking at this for me some time, please get in touch.
Commander Smivs, the friendliest Gourd this side of Riedquat.
User avatar
Griff
Oolite 2 Art Director
Oolite 2 Art Director
Posts: 2483
Joined: Fri Jul 14, 2006 12:29 pm
Location: Probably hugging his Air Fryer

Re: Shaders’ Outpost

Post by Griff »

What sort of stuff do you want to do in the shader Smivs? You might not actually need them - there's lots of stuff you can do with 'Materials', [wiki]Materials_in_Oolite[/wiki] nearly all the shader effects in my shipset can be done with materials - i think the only things not supported are the engine/lasergun glows that change with speed/temperature and the random decals and paint colour stuff
User avatar
submersible
Commodore
Commodore
Posts: 264
Joined: Thu Nov 10, 2011 7:49 am

Re: Shaders’ Outpost

Post by submersible »

Griff wrote:
What sort of stuff do you want to do in the shader Smivs? You might not actually need them - there's lots of stuff you can do with 'Materials', [wiki]Materials_in_Oolite[/wiki] nearly all the shader effects in my shipset can be done with materials - i think the only things not supported are the engine/lasergun glows that change with speed/temperature and the random decals and paint colour stuff
This is very true. The way the ship is coming together at the moment it will probably be the usual suspects of diffuse,specular,normal,emission and illumination maps - all possible using the regular materials. Not sure if environment reflection mapping can be done there.
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Re: Shaders’ Outpost

Post by JensAyton »

submersible wrote:
Not sure if environment reflection mapping can be done there.
Nope.
User avatar
Smivs
Retired Assassin
Retired Assassin
Posts: 8408
Joined: Tue Feb 09, 2010 11:31 am
Location: Lost in space
Contact:

Re: Shaders’ Outpost

Post by Smivs »

submersible wrote:
Griff wrote:
What sort of stuff do you want to do in the shader Smivs? You might not actually need them - there's lots of stuff you can do with 'Materials', [wiki]Materials_in_Oolite[/wiki] nearly all the shader effects in my shipset can be done with materials - i think the only things not supported are the engine/lasergun glows that change with speed/temperature and the random decals and paint colour stuff
This is very true. The way the ship is coming together at the moment it will probably be the usual suspects of diffuse,specular,normal,emission and illumination maps - all possible using the regular materials. Not sure if environment reflection mapping can be done there.
I can see I will need to expand my knowledge a bit here. Diffuse, emission and illumination maps I'm OK with, but have not dabbled with normal and specular maps, largely because my computer has not been good enough to use these! However a recent upgrade has made all things possible :)
My original thought was to offer two versions of the OXP, one with full shaders and one for non-shader machines relying just on diffuse and emission maps. It seems this may not be necessary, and that a 'materials' based version may be equally good for shader and non-shader computers.
@ submersible - I'll stay in touch via PM
@Griff - Many thanks for the offer of help. While I may not need to ask you to 'do' anything, I can see me needing some advice and explanations as to how to do things and how things works. :)
Commander Smivs, the friendliest Gourd this side of Riedquat.
User avatar
Svengali
Commander
Commander
Posts: 2370
Joined: Sat Oct 20, 2007 2:52 pm

Re: Shaders’ Outpost

Post by Svengali »

To get a feeling for the supported keys you could try the [wiki]Cabal_Common_MaterialsFinder[/wiki].
This way you can play around with different settings and watch it in the game.
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Re: Shaders’ Outpost

Post by JensAyton »

It’s only a proof of concept, and focussed on 2D, but anyone interested in shaders should take a look at http://pixelshaders.com. (A modern browser with WebGL enabled is required for best effect.)
User avatar
DaddyHoggy
Intergalactic Spam Assassin
Intergalactic Spam Assassin
Posts: 8515
Joined: Tue Dec 05, 2006 9:43 pm
Location: Newbury, UK
Contact:

Re: Shaders’ Outpost

Post by DaddyHoggy »

Ahruman wrote:
It’s only a proof of concept, and focussed on 2D, but anyone interested in shaders should take a look at http://pixelshaders.com. (A modern browser with WebGL enabled is required for best effect.)
Excellent - I've made a note of the site for my students when they take their Computer Graphics module of their course.
Selezen wrote:
Apparently I was having a DaddyHoggy moment.
Oolite Life is now revealed here
User avatar
submersible
Commodore
Commodore
Posts: 264
Joined: Thu Nov 10, 2011 7:49 am

Re: Shaders’ Outpost

Post by submersible »

Ahruman wrote:
submersible wrote:
Not sure if environment reflection mapping can be done there.
Nope.
And it's a big Nope too. I think all my attempts at funky environment lighting are defeated because I cannot grasp the matrix math to get normals and positions back into world space. Would it be possible to hack a model-only matrix into the default uniforms ?
User avatar
Mauiby de Fug
---- E L I T E ----
---- E L I T E ----
Posts: 847
Joined: Tue Sep 07, 2010 2:23 pm

Re: Shaders’ Outpost

Post by Mauiby de Fug »

Well, having successfully downloaded and built Oolite from source, and then discovered that not only is it running at an acceptable frame rate, but I can also have "simple" shaders enabled, I was rather excited! Since I've been getting to grips quite nicely with GLSL in my own projects, I've been rummaging through the Oolite documentation on the wiki, and I have a question...

What are the light sources that are exposed to the shaders? THe example shader on the "Shaders in Oolite page calls gl_LightSource[0], but I'm not sure what this corresponds to. Is it the light attached to the camera, or something else? Similarly, is there a light source representing the sun, or not?
submersible wrote:
Griff wrote:
There's some mad shader work here - way to advanced for me to understand, looks a lot like the effect in your screenshot!
http://http.developer.nvidia.com/GPUGem ... ter16.html
Yup - that is the approach being taken in the shader in my previous screenshot, approximate simulation of scattering and the resulting decay of different frequencies of the transmitted light. Also too tricky for me to grasp right now. :?
I've had some success in using his shaders for the atmosphere from the sky in my own stuff, so I'm curious as to the state of your shady-planets branch. I attempted to compile it, and Oolite runs, but I get a whole host of errors in the log, and no shady planets at all...
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Re: Shaders’ Outpost

Post by JensAyton »

Mauiby de Fug wrote:
What are the light sources that are exposed to the shaders? THe example shader on the "Shaders in Oolite page calls gl_LightSource[0], but I'm not sure what this corresponds to. Is it the light attached to the camera, or something else? Similarly, is there a light source representing the sun, or not?
Whoops! Someone should update that example. *Rolls thumbs, whistles tunelessly*

For historical reasons, only gl_LightSource[1] is used in Oolite. It represents the sun, or the showroom light, or an unspecified light source in interstellar space.

For ambient light, use gl_LightModel.ambient, not gl_LightSource[0].ambient.
User avatar
Mauiby de Fug
---- E L I T E ----
---- E L I T E ----
Posts: 847
Joined: Tue Sep 07, 2010 2:23 pm

Re: Shaders’ Outpost

Post by Mauiby de Fug »

Cheers, that clears that up! I'll continue perusing examples in oxps to get an idea of how to use the various Oolite parameters available, and then have a go at writing my own. No doubt if it all goes wrong I'll be back with a few other questions...
Post Reply