Standard station textures

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

Moderators: winston, another_commander

User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Post by Commander McLane »

Done. What I did was simply to add roles-keys to the three entries in question. So now they look like this (just c&p into your shipdata):

Code: Select all

    "PAGroove-coriolis-reference" = {
        "ai_type" = "stationAI.plist"; 
        "cargo_type" = "CARGO_NOT_CARGO"; 
        "energy_recharge_rate" = 100; 
        "forward_weapon_type" = "WEAPON_NONE"; 
        frangible = 0; 
        "has_ecm" = yes; 
        "has_escape_pod" = 0; 
        "has_scoop" = no; 
        "max_energy" = 25000; 
        "max_flight_pitch" = 8; 
        "max_flight_roll" = 8; 
        "max_flight_speed" = 0; 
        missiles = 0; 
        "port_radius" = 500; 
        roles = "PAGroove-coriolis-reference"; 
        rotating = yes; 
        thrust = 100; 
        "weapon_energy" = 0; 
    }; 
    "PAGroove-dodecahedron-reference" = {
        "ai_type" = "stationAI.plist"; 
        "cargo_type" = "CARGO_NOT_CARGO"; 
        "energy_recharge_rate" = 100; 
        "forward_weapon_type" = "WEAPON_NONE"; 
        frangible = 0; 
        "has_ecm" = yes; 
        "has_escape_pod" = 0; 
        "has_scoop" = no; 
        "max_energy" = 25000; 
        "max_flight_pitch" = 8; 
        "max_flight_roll" = 8; 
        "max_flight_speed" = 0; 
        missiles = 0; 
        name = "Dodecahedron Station"; 
        "port_radius" = 392; 
        roles = "PAGroove-dodecahedron-reference"; 
        rotating = yes; 
        thrust = 100; 
        "weapon_energy" = 0; 
    }; 
    "PAGroove-icosahedron-reference" = {
        "ai_type" = "stationAI.plist"; 
        "cargo_type" = "CARGO_NOT_CARGO"; 
        "energy_recharge_rate" = 100; 
        "forward_weapon_type" = "WEAPON_NONE"; 
        frangible = 0; 
        "has_ecm" = yes; 
        "has_escape_pod" = 0; 
        "has_scoop" = no; 
        "max_energy" = 25000; 
        "max_flight_pitch" = 8; 
        "max_flight_roll" = 8; 
        "max_flight_speed" = 0; 
        missiles = 0; 
        name = "Icosahedron Station"; 
        "port_radius" = 500; 
        roles = "PAGroove-icosahedron-reference"; 
        rotating = yes; 
        thrust = 100; 
        "weapon_energy" = 0; 
    }; 
But after starting the game another error showed up:

Code: Select all

[shader.compile.vertex.failure]: ***** GLSL vertex shader compilation failed for PAGroove_station_baydoor_flashers.vertex:
>>>>> GLSL log:
ERROR: 0:17: '=' :  assigning non-constant to 'const float'


>>>>> GLSL source code:
#define OO_USER_DEFINED_BINDINGS  1
#define OO_REDUCED_COMPLEXITY  1
#define OO_TEXTURE_UNIT_COUNT  8


// Information from Oolite.
uniform float         uTime;
uniform float         FrameCount;
uniform float         TimePerFrame;

varying vec3         v_normal;      // Surface normal
varying vec3         v_pos;      // Vertex/fragment position in eye space

// Control factors.

// Derived constants.
const float         kAnimCycleTime = TimePerFrame * FrameCount;


void main(void)
{

   v_normal = normalize(gl_NormalMatrix * gl_Normal);
   v_pos = vec3(gl_ModelViewMatrix * gl_Vertex);
   gl_Position = ftransform();
   
 
   vec4 coord = gl_TextureMatrix[0] * gl_MultiTexCoord0;
   
   // Select frame.
   coord.t += floor(mod(uTime, kAnimCycleTime) / TimePerFrame);
   
   // Scale texture co-ordinates to 0..1
   coord.t /= FrameCount;
   
   gl_TexCoord[0] = coord;
}
I guess this falls in your areas.

Waiting for eternal fame... :D
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

Post by Griff »

Thanks for fixing that business with the roles Commander McLane & Ahruman, i'll update the oxp with your code in a bit.

I'm not seeing that error with the vertex shader on my system, probably because of some difference in my graphics cards opengl implementation, (the error is probably happening but the driver's given up warning me about it).
i reckon if the line

Code: Select all

const float         kAnimCycleTime = TimePerFrame * FrameCount;
in the PAGroove_station_baydoor_flashers.vertex shader is changed to

Code: Select all

float         kAnimCycleTime = TimePerFrame * FrameCount;
everything should be ok.
Last edited by Griff on Sat May 24, 2008 11:26 am, edited 1 time in total.
User avatar
pagroove
---- E L I T E ----
---- E L I T E ----
Posts: 3035
Joined: Wed Feb 21, 2007 11:52 pm
Location: On a famous planet

Post by pagroove »

Thx Commander McLane,

As I said, eternal fame!. When Griff has a new version I will also update the WIKI and the Readme and you will in the creditlines! :D 8) :D
For P.A. Groove's music check
https://soundcloud.com/p-a-groove
Famous Planets v 2.7. (for Povray)
Image
https://bb.oolite.space/viewtopic.php?f=4&t=13709
User avatar
pagroove
---- E L I T E ----
---- E L I T E ----
Posts: 3035
Joined: Wed Feb 21, 2007 11:52 pm
Location: On a famous planet

Post by pagroove »

@Commander McLane,

You are on the Wiki in the Special Thanks section of the P.A. Groovestations OXP.

http://wiki.alioth.net/index.php/P.A._G ... ations_OXP
For P.A. Groove's music check
https://soundcloud.com/p-a-groove
Famous Planets v 2.7. (for Povray)
Image
https://bb.oolite.space/viewtopic.php?f=4&t=13709
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:
i reckon if the line

Code: Select all

const float         kAnimCycleTime = TimePerFrame * FrameCount;
in the PAGroove_station_baydoor_flashers.vertex shader is changed to

Code: Select all

float         kAnimCycleTime = TimePerFrame * FrameCount;
everything should be ok.
Correct.
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 »

Fixed the crash (it now reverts to a normal Coriolis when it fails to set up a station, as intended). Next step, work out why like_ship isn’t working.
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Post by Commander McLane »

pagroove wrote:
@Commander McLane,

You are on the Wiki in the Special Thanks section of the P.A. Groovestations OXP.

http://wiki.alioth.net/index.php/P.A._G ... ations_OXP
:D :D :D :D :D
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Post by Commander McLane »

Hi, folks!

Got another error with the griff-station-shaders. Here's the relevant lines from the logfile:

Code: Select all

[shader.compile.fragment.failure]: ***** GLSL fragment shader compilation failed for PAGroove_ico_with_specularmap.fragment:
>>>>> GLSL log:
ERROR: 0:33: '=' :  cannot convert from '4-component vector of float' to 'float'


>>>>> GLSL source code:
#define OO_USER_DEFINED_BINDINGS  1
#define OO_TEXTURE_UNIT_COUNT  8


// Information from Oolite.
uniform sampler2D      tex0; // Difuse map
uniform sampler2D      tex1; // Specular map

const float specExponent = 8.0;

// Information from vertex shader.
varying vec3         v_normal;      // Surface normal
varying vec3         v_pos;      // Vertex/fragment position in eye space

// Calculate the contribution of a single light. Ought to be a function, but OS X's GLSlang implementation isn't sufficiently clever.
#define LIGHT(idx) \
   { \
      vec3 lightVector   = normalize(gl_LightSource[idx].position.xyz); \
      vec3 reflection   = normalize(-reflect(lightVector, v_normal)); \
      diffuse += gl_FrontMaterial.diffuse * gl_LightSource[idx].diffuse * max(dot(v_normal, lightVector), 0.0);  \
      specular += gl_LightSource[idx].diffuse * pow(max(dot(reflection, eyeVector), 0.0), specExponent); \
   }

void main(void)
{
   vec4 diffuse = vec4(0.0), specular = vec4(0.0);
   vec3 eyeVector = normalize(-v_pos);
   
   // Load texture data,,
   vec2 texCoord = gl_TexCoord[0].st;
   vec4 colorMap = texture2D(tex0, texCoord);
   vec4 specMap = texture2D(tex1, texCoord);
float specIntensity = 15.0 * specMap * specMap; //put a multiplier eg " float specIntensity = specMap.g * 6.0; " on the end of this line to further tweak your specular maps intensity effect
   
/*   Light 0 is the "showroom" light, used in the demo screen and shipyard.
   Light 0 is currently disabled, because there's no way for the shader to know when it's turned off.
   The solution for this will probably be for Oolite to set its diffuse and specular components to
   black when it's not being used.
   
   Light 1 is the sun.
   */
#ifdef OO_LIGHT_0_FIX
   LIGHT(0);
#endif
   LIGHT(1);
   diffuse += gl_FrontMaterial.ambient * gl_LightModel.ambient; //
   diffuse += colorMap.a * 3.0; // multiplier here to increase glow effect
   vec4 color = diffuse * colorMap + specular * specIntensity;

   gl_FragColor = vec4(color.rgb, 1.0);
}
Beautiful stations, by the way. I am getting quite used to them! :wink: :D

Oh, and Griff, whenever I dock with one of your stations I can't help wondering whether you perhaps could do something to the Salvage Gang's (and to a lesser extent, the Hacker Outpost's) interior? Killer Wolf has gone as far as he could get in simulating lights and so on with a normal texture, and has done a marvellous job with that. But the use of shaders would take it to a whole new level, of course.
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

Post by Griff »

oh heck, not sure what that error means, it could be this line:

Code: Select all

float specIntensity = 15.0 * specMap * specMap;
causing problems, it looks like i've forgotten to specify a colour channel from the specMap texture to use, maybe if you edit the line to something like

Code: Select all

float specIntensity = 15.0 * specMap.r * specMap.r;

it will work, i'm away from my home pc at the moment but i'll definately have a look into solving this later this evening.

I'd love to shader-ify some more stations, i actually get a lot of fun just tinkeringing away with shaders in rendermonkey, must be some sort of middle age crisis or something :D so i'll definately have a look at applying these shaders to the stations you mention
User avatar
pagroove
---- E L I T E ----
---- E L I T E ----
Posts: 3035
Joined: Wed Feb 21, 2007 11:52 pm
Location: On a famous planet

Post by pagroove »

Ah Griff and Commander McLane,

Nice to see you 2.

@ Cmndr Mc Lane: Glad you enjoy the stations.
@ Griff

Maybe also the largest station (trans-hab I believe?) then. Would be nice to make these with a transparant texture that resembles glass (if possible). I'm now busy with The famous planets. It's quite addicting texturing the planets. But on-topic. If you nee any station textures just give a call :D :D
For P.A. Groove's music check
https://soundcloud.com/p-a-groove
Famous Planets v 2.7. (for Povray)
Image
https://bb.oolite.space/viewtopic.php?f=4&t=13709
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

Post by Griff »

Hmm, i can't get that error at all on my pc, it looks like the graphics card driver is taking care of it automatically.
I wonder i f you could try this on your Mac Commander McLane:

open the "PAGroove_ico_with_specularmap.fragment" in a text editing program, delete all the text and replace it with the code below, then save the file and start Oolite with the 'clearing out the cache' shift key press. does this cure the error?

Code: Select all

// Information from Oolite.
uniform sampler2D      tex0; // Difuse map
uniform sampler2D      tex1; // Specular map

// Information from vertex shader.
varying vec3         v_normal;      // Surface normal
varying vec3         v_pos;      // Vertex/fragment position in eye space

// Constants
const float specExponent = 8.0;

// Calculate the contribution of a single light.
#define LIGHT(idx) \
   { \
      vec3 lightVector   = normalize(gl_LightSource[idx].position.xyz); \
      vec3 reflection   = normalize(-reflect(lightVector, v_normal)); \
      diffuse += gl_FrontMaterial.diffuse * gl_LightSource[idx].diffuse * max(dot(v_normal, lightVector), 0.0);  \
      specular += gl_LightSource[idx].diffuse * pow(max(dot(reflection, eyeVector), 0.0), specExponent); \
   }

void main(void)
{
   vec4 diffuse = vec4(0.0), specular = vec4(0.0);
   vec3 eyeVector = normalize(-v_pos);
   
// Load texture data.
   vec2 texCoord = gl_TexCoord[0].st;
   vec4 colorMap = texture2D(tex0, texCoord);
   vec4 specMap = texture2D(tex1, texCoord);
   
// Calculate the specularity effect.  
float specIntensity = 15.0 * specMap.r * specMap.r;
   
//   Light 0 is the "showroom" light, Light 1 is the sun.
#ifdef OO_LIGHT_0_FIX
   LIGHT(0);
#endif
   LIGHT(1);
   diffuse += gl_FrontMaterial.ambient * gl_LightModel.ambient; //
   diffuse += colorMap.a * 3.0; // multiplier here to increase glow effect
   vec4 color = diffuse * colorMap + specular * specIntensity;

// Output the final colour.
   gl_FragColor = vec4(color.rgb, 1.0);
}
This is the same shader code as before, but i've changed the line float specIntensity = 15.0 * specMap * specMap.r to read float specIntensity = 15.0 * specMap.r * specMap.r;

@ pagroove
Great work on the planets oxp, really lovely stuff! I don't think transparent textures are going to be possible, i remember Ahruman mentioning that the Oolite graphics engine sorts polygons from 'front to back', where 'front 'means the players view out onto the universe, for transparency to be supported polygons have to be sorted in the opposite order (back to front), and then you get all sorts of performance slowdowns and huge programming complexities and all that stuff.
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:
Hmm, i can't get that error at all on my pc, it looks like the graphics card driver is taking care of it automatically.
Really? How buggy of it. Both this and the thing about assigning to consts are things the GLSL compiler is required to reject.
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Post by Commander McLane »

Hi, Griff.

I've just added the ".r"s in my existing file, and it did the trick. The error message is gone.

Thanks! :D
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

Post by Griff »

weird, i couldn't see any errors in the stderr file at all even with shader debug mode on plus the shader was working in game, this is a change from my old ATI graphics card that used to tint everything blue given half the chance :) the me assigning to const bugs would stop the shader working though and log an error in the stderr so i can't always be blissfully unaware of my mistakes.
I'll update the shader and re-upload the oxp
edit: done! Same download links as before
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Post by Commander McLane »

Hi!

The first run of 1.72 brings these in my logfile:
[shipData.load.error]: ***** ERROR: the shipdata.plist entry "PAGroove-dodecahedron-reference" specifies no model, ignoring.
[shipData.load.error]: ***** ERROR: the shipdata.plist entry "PAGroove-icosahedron-reference" specifies no model, ignoring.
[shipData.load.error]: ***** ERROR: the shipdata.plist entry "PAGroove-coriolis-reference" specifies no model, ignoring.
I don't know if this would go away with the new template-key, or even a template needs a model.
Post Reply