Replacing Constores with Griff Trade outposts@Griff and Doc

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

Moderators: winston, another_commander

User avatar
Griff
Oolite 2 Art Director
Oolite 2 Art Director
Posts: 2482
Joined: Fri Jul 14, 2006 12:29 pm
Location: Probably hugging his Air Fryer

Post by Griff »

ah, just saw your edit about it working in full shader mode only, i'd only tested it with shaders set to full, but annoyingly i don't get any errors running the oxp with shaders set to simple or off :?
the mistake must be somewhere in the bits of shader code that run when OO_REDUCED_COMPLEXITY is true
that should narrow it down to these parts (i think)

Code: Select all

// Irregular flickering function
   #ifdef OO_REDUCED_COMPLEXITY 
   #define Pulse(v, ts) ((v) * 0.95) 
   #else

     float Pulse(float value, float timeScale)
     {
        float t = uTime * timeScale;   

        float s0 = t;
        s0 -= floor(s0);
        float sum = abs( s0 - 0.5);
   
        float s1 = t * 0.7 - 0.05;
        s1 -= floor(s1);
        sum += abs(s1 - 0.5) - 0.25;
   
        float s2 = t * 1.3 - 0.3;
        s2 -= floor(s2);
        sum += abs(s2 - 0.5) - 0.25;
   
        float s3 = t * 5.09 - 0.6;
        s3 -= floor(s3);
        sum += abs(s3 - 0.5) - 0.25;

        return (sum * 0.1 + 0.9) * value;

      }

// Hull Temperate heat glow
     vec4 TemperatureGlow(float level) 
     { 
        vec4 result = vec4(0); 
    
        result.r = level; 
        result.g = level * level * level; 
        result.b = max(level - 0.7, 0.0) * 2.0; 
        result.a = 1.0; 
    
        return result;    
     } 
   #endif 
and

Code: Select all

   #ifdef OO_REDUCED_COMPLEXITY
// Add in the specular effects for simple shader mode
   color += specular * color * 3.0 * specIntensity;
   #endif
Sorry about all this Ark, i don't know if commander Mclane is reading but this must all see familiar to him when i tried sending him some shaders a few weeks back, i think it took about 12 attempts by me to come up with a working shader!
How does it behave with the newer uploaded version? that's the version i'm seeing no errors with on my pc
ah, i think it must be this line #define Pulse(v, ts) ((v) * 0.95) that gets used in simple & shaders off mode, i should imagine v, ts should be floating point numbers and not numbers
Last edited by Griff on Sat Jan 10, 2009 4:24 pm, edited 1 time in total.
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6678
Joined: Wed Feb 28, 2007 7:54 am

Post by another_commander »

The mistake is most likely this line in the shader:

Code: Select all

 #define Blink_on_off(1.0)
I don't think this is syntactically correct. It should be more like

Code: Select all

 #define Blink_on_off(value) (1.0)
User avatar
Griff
Oolite 2 Art Director
Oolite 2 Art Director
Posts: 2482
Joined: Fri Jul 14, 2006 12:29 pm
Location: Probably hugging his Air Fryer

Post by Griff »

oh wow, man A_C i am glad to see you here! does this line look OK
define Pulse(v, ts) ((v) * 0.95) should the variable v and ts actually be floating point values?
the line you flagged up as being wrong the #define Blink_on_off(1.0) one shouldn't actually be in this shader, but it is in the griff_boa shaders so they must be broken in simple shader mode too :(
when you say it should be #define Blink_on_off(value) (1.0) should the value bit stay as 'value' or should value be an actuall number eg:
#define Blink_on_off(0.5) (1.0)
User avatar
Pangloss
---- E L I T E ----
---- E L I T E ----
Posts: 303
Joined: Wed Dec 13, 2006 5:57 pm
Location: Scranton, PA (via Stevenage, Herts)

Post by Pangloss »

Griff wrote:
@zygoUgo
I don't mind at all if you want to rename the ships, those sound like really great names!

I've added a sort of crappy LED pixel effect to the scrolling ad-ring shader, i've bunged it all into an oxp here http://www.box.net/shared/l07ll8kmxq (just the updated shaders & texturemaps and a small script to spawn them outside the station when you launch)
there's 2 versions, with differing 'LED pixel sizes' - it looks quite neat the way the texture scrolls through the grip of pixels - the bigger one looks nicer but you loose a lot of the fine detail in your advert texture map as it falls in the gaps between the led pixels (as you can see in the pic, most of the text has become unreadable)
anyway, since they exist i thought i'd upload them but i'm not suggesting you have to include them in the oxp or anything :)
Big LED pixels:
Image
Small LED Pixels
Image

edit: Forgot to mention, i generated the grid texture that is being used as a mask for these shaders using the free 'halftone' plugin by Richard Rosenman
http://www.richardrosenman.com/software/downloads/
very cool stuff, the 'scanlines' one is really good too.
There seems to be a guide on installing photoshop plugins in Gimp here:
http://akvis.com/en/graphic-tips/gimp-add-plugins.php
and here for linux http://www.gimp.org/~tml/gimp/win32/pspi.html
I haven't tried this myself though (i'm a posh photoshop user)
:shock: ZOWEE!!

I was going to pixelate the Ring Ads I did to give them a scoreboard look, or give them scan lines (eventually, I just went with the transparent stripes). Looks like you did it in code, and I like it a LOT. The big pixels, especially.

If I had a medal, I'd hand it out. Outstanding gobbledegook language work there, Griff... from one not-so-post PhotoShop user to a posh one (I'm using PS 7).
"All is for the best in this best of all possible worlds..."
Dr.Pangloss, Voltaire's 'Candide'.

Image
User avatar
Ark
---- E L I T E ----
---- E L I T E ----
Posts: 664
Joined: Sun Dec 09, 2007 8:22 am
Location: Athens Greece

Post by Ark »

another_commander wrote:
The mistake is most likely this line in the shader:

Code: Select all

 #define Blink_on_off(1.0)
I don't think this is syntactically correct. It should be more like

Code: Select all

 #define Blink_on_off(value) (1.0)
Yes now i am not receiving any errors. Thank you A_C
@Griff: is it normal that the predefined color in the station applied only in full shaders mode and do i have to donwload the station again?
User avatar
Griff
Oolite 2 Art Director
Oolite 2 Art Director
Posts: 2482
Joined: Fri Jul 14, 2006 12:29 pm
Location: Probably hugging his Air Fryer

Post by Griff »

no need to re-download the OXP, the #define Blink_on_off(1.0) error is in the new upload too, so if i change the line
#define Blink_on_off(1.0)
to
#define Blink_on_off(value) (1.0)
the shader runs OK? I'll get right onto it! thanks A_C for fixing that for me!

yeah, the re-colouring the texture map lines such as these from the griff_station_bottom_section.fragment:

Code: Select all

// Modify the main diffuse colour using the maskMap.b channel & 'MainhullColor' binding from the shipdata.plist.Full Shader mode only
   color += diffuse * maskMap.b * MainhullColor; 

// Modify the main hull decal colour using the maskMap.a channel & 'DecalColor'  binding from the shipdata.plist.Full Shader mode only
   color += maskMap.a * DecalColor * diffuse;  
are inside
#ifndef OO_REDUCED_COMPLEXITY
.
.
.
#endif

which means they only run if OO_REDUCED_COMPLEXITY is not defined, ie Oolite is not in simple shader mode. you could edit the shader so the colour modifiying lines are outside of #ifndef OO_REDUCED_COMPLEXITY .. #endif
then they will run even in simple shader mode, but i think the colour modifiy process might be quite taxing for older video cards and really bog down the frame rate - i haven't tested it though so i'm probably wrong and graphics cards love to do this type of stuff with hardly any performance hit!
Last edited by Griff on Sat Jan 10, 2009 4:54 pm, edited 1 time in total.
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6678
Joined: Wed Feb 28, 2007 7:54 am

Post by another_commander »

@Griff: The #define Pulse line looks OK to me. See next paragraph for an explanation of how it works. But the Blink_on_off one is wrong and is in Ark's shader first example. Since it's wrong, the shader fails to compile. And yes, the Boa shaders are broken in Simple shader mode as well.

To clarify the #define Blink_on_off(value) thing, you can write the word "value" as you see it above. Value represents a parameter variable which can be anything (you could have put the word "GriffsTrickyValue" or even "GriffRules" instead of "value", it does not matter). The shader compiler will simply substiute the Blink_on_off macro with whatever follows it, in this case the number 1.0. This means that regardless of what's being passed as parameter to the macro, the end result will always be 1.0. In the case of the Puse macro, the shader compiler will substitute Pulse(v, ts) with whatever follows it, and will further substitute v with whatever expression or variable or value has been passed to it as first parameter, and ts with whatever has been passed to it as second parameter. Regarding the Pulse macro if it is defined like this

Code: Select all

#define Pulse(v, ts) ((v) * 0.95)
if we write in the shader code for example

Code: Select all

Pulse(aValue, 0.2)
this will be substituted during shader compile time with

Code: Select all

((aValue) * 0.95)
In this case, we choose to ignore the second parameter alltogether and we do this because when full shaders are defined, it is the function Pulse that is used instead of the macro and there both v and ts parameters are used. This way, we can use the same code for Pulse both when we have simple and when we have full shaders.

Hope this helps a bit.
User avatar
Ark
---- E L I T E ----
---- E L I T E ----
Posts: 664
Joined: Sun Dec 09, 2007 8:22 am
Location: Athens Greece

Post by Ark »

Griff wrote:
no need to re-download the OXP, the #define Blink_on_off(1.0) error is in the new upload too,
Well it gets even better !!!! The socond download works fine to
:?

@Griff:What other changes you did in the "griff_station_bottom_section.fragment" of the second download?
What file sould i keep the frirst one corrected as A_C instucted me or the second one (in the second one there is no #define Blink_on_off(1.0) line at all
User avatar
Griff
Oolite 2 Art Director
Oolite 2 Art Director
Posts: 2482
Joined: Fri Jul 14, 2006 12:29 pm
Location: Probably hugging his Air Fryer

Post by Griff »

oops, sorry, even though i wrote earlier that i hadn't changed that line in the re-uploaded oxp, i infact have! it shouldn't have been in there in the first place, when i was chopping up the griff_boa shader to use for this station i forgot to remove it - it's part of the function that flickers the hull lights and the cyan coloured engine glow on the griff_boa when it gets heavily damaged, this doesn't apply to the trade outpost, so i think in this case use the version of the fragment shader from the second upload rather than A_C's fixed version.
Thanks for flagging this up though and massive thanks A_C for the fix and the explanation about the code, i'll need to get busy repairing a whole load of my oxp's now!
so to sum up - what i have learned today:
1. i don't in fact have a magic error correcting graphics card inside my computer
2. i need to abide by the laws of OpenGL 2.0

@ Pangloss
Sorry i didn't see your post in all the excitment about the broken shader! If it's ok with you, can i put the adring graphics you posted earlier into the 'LED shader' test oxp?

@ DaddyHoggy
Can i include your adring banner graphics too?

edit: um, i hope you guys didn't mind, i've rushed ahead and included your artwork
http://www.box.net/shared/3x6yz98518
it's the same as the other test oxp except it includes all the banner ads from pangloss & daddyhoggy, in big & small LED pixel versions. What's funny is that the alpha channel info already in pangloss's ads makes it look like some of the LED bulbs are broken!

What i should have done in this oxp is collect 4 rows of ads into one large 1024 x 128 pixel image and used the shader to select rows randomly, is this worth doing? or will it waste too much video memory as 3 of the 4 rows loaded into memory won't ever be seen by the player?
User avatar
DaddyHoggy
Intergalactic Spam Assassin
Intergalactic Spam Assassin
Posts: 8515
Joined: Tue Dec 05, 2006 9:43 pm
Location: Newbury, UK
Contact:

Post by DaddyHoggy »

Happy for you to have used my work - I think I suggested:

What i should have done in this oxp is collect 4 rows of ads into one large 1024 x 128 pixel image and used the shader to select rows randomly, is this worth doing? or will it waste too much video memory as 3 of the 4 rows loaded into memory won't ever be seen by the player?
already!

In fact I did:
@Griff - is it possible to do multiframe versions of the ad-rings - i.e. two 1024x64 images on top of each other making a 1024x128 and using the same technique used for the other multiframe ads, switch between them (at a much slower frame rate) - just a thought...
Way back on page 5!

So I think it would be great!
Selezen wrote:
Apparently I was having a DaddyHoggy moment.
Oolite Life is now revealed here
User avatar
Griff
Oolite 2 Art Director
Oolite 2 Art Director
Posts: 2482
Joined: Fri Jul 14, 2006 12:29 pm
Location: Probably hugging his Air Fryer

Post by Griff »

:D Yes you did! I remember now tweaking the shader, oh well, that makes it much easier to implement!
actually, i've got to admit, when you made the suggestion i thought you wanted to be able to make an adring banner that would animate between frames like the billboard ads and still scroll around the station, hmm now i've typed that out i've just had a vision of pac-man and some ghosts chasing each other round and round the station *searches google for pacman screenshots*
User avatar
Pangloss
---- E L I T E ----
---- E L I T E ----
Posts: 303
Joined: Wed Dec 13, 2006 5:57 pm
Location: Scranton, PA (via Stevenage, Herts)

Post by Pangloss »

Long answer: under licenses stipulated as GNU GPL version 2 for any source code and the CC-BY-NC-SA-3.0 license for other resources (pictures, music, textures, models), contributions made by this user (Pangloss / Shawn Seabrook) are for open and perpetual free use for the game Oolite.

Short answer: use away.
"All is for the best in this best of all possible worlds..."
Dr.Pangloss, Voltaire's 'Candide'.

Image
User avatar
Pangloss
---- E L I T E ----
---- E L I T E ----
Posts: 303
Joined: Wed Dec 13, 2006 5:57 pm
Location: Scranton, PA (via Stevenage, Herts)

Post by Pangloss »

Griff wrote:
oops, sorry, even though i wrote earlier that i hadn't changed that line in the re-uploaded oxp, i infact have! it shouldn't have been in there in the first place, when i was chopping up the griff_boa shader to use for this station i forgot to remove it - it's part of the function that flickers the hull lights and the cyan coloured engine glow on the griff_boa when it gets heavily damaged, this doesn't apply to the trade outpost, so i think in this case use the version of the fragment shader from the second upload rather than A_C's fixed version.
Thanks for flagging this up though and massive thanks A_C for the fix and the explanation about the code, i'll need to get busy repairing a whole load of my oxp's now!
so to sum up - what i have learned today:
1. i don't in fact have a magic error correcting graphics card inside my computer
2. i need to abide by the laws of OpenGL 2.0

@ Pangloss
Sorry i didn't see your post in all the excitment about the broken shader! If it's ok with you, can i put the adring graphics you posted earlier into the 'LED shader' test oxp?


@ DaddyHoggy
Can i include your adring banner graphics too?

edit: um, i hope you guys didn't mind, i've rushed ahead and included your artwork
http://www.box.net/shared/3x6yz98518
it's the same as the other test oxp except it includes all the banner ads from pangloss & daddyhoggy, in big & small LED pixel versions. What's funny is that the alpha channel info already in pangloss's ads makes it look like some of the LED bulbs are broken!

What i should have done in this oxp is collect 4 rows of ads into one large 1024 x 128 pixel image and used the shader to select rows randomly, is this worth doing? or will it waste too much video memory as 3 of the 4 rows loaded into memory won't ever be seen by the player?
As I said, please use them... and I like the idea of not-quite-utopian displays. Like a smeared screen at Kings Cross station!

And the idea of randomly generating ads is a great one. I'll start work on thse Monday. Do you prefer a black background or a transparent one?
"All is for the best in this best of all possible worlds..."
Dr.Pangloss, Voltaire's 'Candide'.

Image
User avatar
Griff
Oolite 2 Art Director
Oolite 2 Art Director
Posts: 2482
Joined: Fri Jul 14, 2006 12:29 pm
Location: Probably hugging his Air Fryer

Post by Griff »

thanks guys for the use of your artwork!
@ pangloss
a background of any colour will work ok, but no transparency if possible as the shader will be using the transparency (alpha) channel to put the grid texture that makes the image look pixelated in.
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

Griff wrote:
the shaders i've used for the station need floating point values for R G B rather than the 0-255 scale the paint programs use, i don't know the way to convert between the 2 using a calculator
You divide by 255. Or multiply, depending on which way you’re going. :-)
Post Reply