Page 10 of 32

Posted: Sat Mar 15, 2008 2:13 pm
by Griff
yeah, there's a lot of stuff wrong with it :(
here's a screengrab of it running in Rendermonkey
Image

I've pretty much binned the other attempts and started again using the rendermonkey example as a template, removing from it the need for 'nighttime' copies of the surface texture and specularity & cloud cover maps. just need to get oolite friendly lightsource information into it now. fingers crossed!

Posted: Sat Mar 15, 2008 4:27 pm
by LittleBear
This is just outstanding! I love the idea of the lights on the planet comming on at the right time! 8)

Posted: Sat Mar 15, 2008 11:33 pm
by Griff
Oh my god, I can't believe what a twit i've been. I've been ages puzzling over why the planet shader was working in Rendermonky and not working in Oolite, literally i've been working on it all day.. i now just realised that i've been been playing Oolite with Shaders switched off and that's why the shader effects weren't working! AAARGH!!

Anyway, here's the shader in a test oxp, seems to be working quite nicely - see screenshot in post above.

Grab the oxp here. contains the pdf guide to pasting greyscale textures into RGB texturemaps which will be handy when pasting the city lights texture into the colourmap.
http://www.box.net/shared/gruzn77k0c

Posted: Sun Mar 16, 2008 11:32 am
by Commander McLane
Griff wrote:
Oh my god, I can't believe what a twit i've been. I've been ages puzzling over why the planet shader was working in Rendermonky and not working in Oolite, literally i've been working on it all day.. i now just realised that i've been been playing Oolite with Shaders switched off and that's why the shader effects weren't working! AAARGH!!
Sorry! I think each of us can recall something similar from their own experience. :)

Posted: Sun Mar 16, 2008 1:56 pm
by Griff
Is it possible to send vec3's as uniform bindings to a shader?
I'm trying to make it possible to specify the nightside colour 'tint' and 'city light' colours from inside the shipdata.plist
i've set the uniforms out like this:

Code: Select all

uniforms = 
  { 
     nightmutedColor = {type = "vec3"; value = "0.0, 0.16, 0.33"; };
     citylightColor  = {type = "vec3"; value = "0.89, 0.86, 0.52"; };
  };
but i keep ketting this error in the stder:

Code: Select all

[shader.uniform.badDescription]: ----- Warning: could not bind uniform "citylightColor" -- could not interpret definition:
{type = vec3; value = "0.89, 0.86, 0.52"; 
in the shader the uniforms as declared like this:

Code: Select all

uniform vec3 nightmutedColor;
uniform vec3 citylightColor;

Posted: Sun Mar 16, 2008 2:07 pm
by JensAyton
Nope. The infrastructure is mostly there, though, so I can add it for 1.71. Until then, you’re stuck with doing one float per channel.

Edit: added; also added ability to set constant quaternion uniforms as matrix (default) or vector (by adding asMatrix = no to binding dictionary).

Posted: Tue Mar 25, 2008 8:55 pm
by Griff
well, i dug my shaders for game artists book out again with the idea of reading up on how corona effects are done around light sources - which turned out to be in a whole chapter of the book that dealt with lots of interesting effects - blurs, colour manipulation etc.
Right, i'm completely out of my depth here, but it looks like these effects mostly seem to be done by rendering the normal camera view to a seperate 'offscreen' texture, which is then manipulated by shader code to get the desired effect, before then being re-combined with the normal camera view and finally sent out to the screen for the player to see, is that right?

Am i right in thinking this 'rendering to offscreen textures' part of the process can only be done by programming it into the oolite graphic engine, it's not something you can do in glsl? i'm just asking because i'm kind of interested in these effects but i don't want to spend much time worrying about them if the technique to achieve them isn't supported in Oolite - uh, that's not a feature request by the way :)

Edit: just started flipping through pages at random, oo, this sounds interesting, 'polynormal texture mapping' - self shadowing bumpmaps!

Posted: Tue Mar 25, 2008 9:14 pm
by JensAyton
Griff wrote:
Am i right in thinking this 'rendering to offscreen textures' part of the process can only be done by programming it into the oolite graphic engine, it's not something you can do in glsl?
Correct. And no, not gonna happen.
Griff wrote:
Edit: just started flipping through pages at random, oo, this sounds interesting, 'polynormal texture mapping' - self shadowing bumpmaps!
I really should get around to adding tangent information, shouldn’t I?

Incidentally, I just noticed that the emission property for default-shader materials is broken; the specular colour is used instead of the emission colour. (It works fine with shaders off, and is fixed for 1.71.)

Posted: Tue Mar 25, 2008 10:37 pm
by Griff
Ahruman wrote:
Correct. And no, not gonna happen.
Ah well, nevermind, you've already given us loads of cool graphics possibilities!
About the Tangent lighting thing, my shader book has an example vertex shader that ''..illustrates a basic
implementation of how you can determine the tangent space for a simple light"
any use to you as reference if i type it out here? it's only about 30 short lines of code so it's no big problem doing it - not that i'm trying to suggest you don't know how to write one of your own :) Oh, it's in HLSL though.

Posted: Sat Apr 19, 2008 3:44 pm
by Griff
I've been mucking around a bit more with the heated metal effect from the glowing alloy shader and thought i'd apply it to one of the station models since i think we're missing one of the missions from the spectrum version of Elite? (i don't know how to the the 'spoiler' thing to hide text so i won't go into details about which mission is missing).
I wanted to try the 'discard' thing to give crinkly edges to the polygons too.
Image

Griff_burning_coriolis
http://www.box.net/shared/kqz9yeftw8 (1Mb)

Posted: Sat Apr 19, 2008 8:34 pm
by ovvldc
Gorgeous!

Nobody will be docking there anytime soon...

-Oz

Posted: Sun Apr 20, 2008 10:20 pm
by TGHC
Awesome as usual, you are a genius.

Posted: Sun Apr 20, 2008 10:31 pm
by Kaks
Got to say, it is amazing, as always!

Btw I've written a spoiler here:hello everybody. the original code is

Code: Select all

[color=#eeeeff][b]hello everybody[/b][/color] 
You'll need to change the 'color' value to match the background colour, of course.
Edit: Now you've got to tell us what the missing mission was! :)

Posted: Mon Apr 21, 2008 7:44 am
by Griff
Cheers Kaks for the spoiler tutorial!
uh, i think i might have got my wires crossed with the missing mission, i thought it was...
...Spoiler:You are sent to defend a station that is under attack by Thargoids
which i thought might be easily scriptable, but it look like it really is this...

...Spoiler:You are sent to destroy a space station overrun with Thargoids, you get a new Elite Rank of Archangel and a new Galaxy (Galaxy 9) becomes available
Which seems like it needs a whole load of new features written into the game itself.

Most of the credit for the oxp should really go to OpenGl and the shader code Ahruman wrote for the Shady Cobra oxp, i've just been cribbing everything from that and clone brushing gritty metal textures around in photoshop, but don't tell anyone!

Posted: Mon Apr 21, 2008 10:14 am
by Commander McLane
@ Griff: I need this station! A Thargoid attack on a station is exactly what I am scripting in this very second. :wink:

One question though: Is the docking bay still intact? Because in my context the player still has to dock.

Moderator: Please respect other people’s spoiler warnings.