Page 26 of 32
Re: Shaders’ Outpost
Posted: Sat Apr 28, 2012 3:12 am
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
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.
Re: Shaders’ Outpost
Posted: Sat Apr 28, 2012 11:50 am
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
Re: Shaders’ Outpost
Posted: Sat Apr 28, 2012 12:27 pm
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.
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.
Re: Shaders’ Outpost
Posted: Fri Oct 05, 2012 12:45 pm
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.
Re: Shaders’ Outpost
Posted: Wed Oct 10, 2012 9:07 pm
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
Re: Shaders’ Outpost
Posted: Thu Oct 11, 2012 1:53 am
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.
Re: Shaders’ Outpost
Posted: Thu Oct 11, 2012 6:16 am
by JensAyton
submersible wrote:Not sure if environment reflection mapping can be done there.
Nope.
Re: Shaders’ Outpost
Posted: Thu Oct 11, 2012 8:56 am
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.
Re: Shaders’ Outpost
Posted: Thu Oct 11, 2012 9:39 am
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.
Re: Shaders’ Outpost
Posted: Mon Oct 15, 2012 7:24 pm
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.)
Re: Shaders’ Outpost
Posted: Tue Oct 16, 2012 5:44 am
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.
Re: Shaders’ Outpost
Posted: Tue Oct 16, 2012 12:39 pm
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 ?
Re: Shaders’ Outpost
Posted: Sun Jun 09, 2013 9:29 pm
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:
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...
Re: Shaders’ Outpost
Posted: Sun Jun 09, 2013 9:55 pm
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
.
Re: Shaders’ Outpost
Posted: Sun Jun 09, 2013 10:34 pm
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...