Join us at the Oolite Anniversary Party -- London, 7th July 2024, 1pm
More details in this thread.

Ruining the classics (screenshot heavy thread)

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

Moderators: winston, another_commander

Post Reply
User avatar
Frame
---- E L I T E ----
---- E L I T E ----
Posts: 1477
Joined: Fri Mar 30, 2007 8:32 am
Location: Witchspace

Post by Frame »

Image

There :D
User avatar
TGHC
---- E L I T E ----
---- E L I T E ----
Posts: 2157
Joined: Mon Jan 31, 2005 4:16 pm
Location: Berkshire, UK

Post by TGHC »

WTF.

Awesome! but why does it say Krait in the missile indicator?
The Grey Haired Commander has spoken!
OK so I'm a PC user - "you know whats scary? Out of billions of sperm I was the fastest"
User avatar
Uncle Reno
---- E L I T E ----
---- E L I T E ----
Posts: 648
Joined: Mon Apr 24, 2006 12:54 pm
Location: UK

Post by Uncle Reno »

TGHC wrote:
but why does it say Krait in the missile indicator?
Because it always shows the current ship name targeted there when you use your ID system. :)
"Get back or I unleash my lethal spotted batoid!!"

What I do when not reading the Oolite bulletin board!
User avatar
Griff
Oolite 2 Art Director
Oolite 2 Art Director
Posts: 2479
Joined: Fri Jul 14, 2006 12:29 pm
Location: Probably hugging his Air Fryer

Post by Griff »

y'know, i've never noticed it say the ship name down by the missile indicator before too busy looking at the laser temperature gauge i guess!
anyway, i imagine everyone's pretty tired of seeing this ship by now but i thought i'd post one more screenshot:-
Image
i've been taking the various shaders ahruman wrote for the 'krait' and it's subentities and adding them into one shader, what i thought was cool here is the hot metal glow on the laser cannons and various engine bits at the back of the ship, i thought this might look cool on the alloy fragments left behing by exploding ships? making them look red hot from the laser fire & explosion, i might have a go at it and if it works maybe write it out as a sort-of tutorial ('sort-of' since i'm not really sure what i'm doing!)
User avatar
Arexack_Heretic
Dangerous Subversive Element
Dangerous Subversive Element
Posts: 1876
Joined: Tue Jun 07, 2005 7:32 pm
Location: [%H] = Earth surface, Lattitude 52°10'58.19"N, longtitude 4°30'0.25"E.
Contact:

Post by Arexack_Heretic »

I'm almost expecting you to add homeworld-esque damage effects any minute now. ;)

You are taking these models to a whole new level.

Mucho cudos.
Riding the Rocket!
User avatar
Griff
Oolite 2 Art Director
Oolite 2 Art Director
Posts: 2479
Joined: Fri Jul 14, 2006 12:29 pm
Location: Probably hugging his Air Fryer

Post by Griff »

heh, i dunno that krait is starting to look a bit garish now! i'm going overboard on the effects!
what i'm planning on doing soon is painting out some glow & effects maps for one of the standard ships, putting it all into rendermonkey (and hopefully the open source shader program ahruman linked to a few pages back - 'lumiere'?) and uploading it somewhere for us all to have a tinker with and see what we can come up with - hopefully get a shader version of the 'scripters cove' thread going, although ahrumans recent posting about ship materials will bring all the goodness of shaders into some extra <key>'s that you just add to a ships shipdata.plist file to switch on the effects, all the complex stuff will happen behind the scenes!
User avatar
Arexack_Heretic
Dangerous Subversive Element
Dangerous Subversive Element
Posts: 1876
Joined: Tue Jun 07, 2005 7:32 pm
Location: [%H] = Earth surface, Lattitude 52°10'58.19"N, longtitude 4°30'0.25"E.
Contact:

Post by Arexack_Heretic »

Yes dandilly so. ;)

But remove the outlandish deepsea-hullglow and the heatglow takes on a menacing rather than garish appearance, i bet.

-Started 'Shaders Outpost' thread. -
Riding the Rocket!
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:
…although ahrumans recent posting about ship materials will bring all the goodness of shaders into some extra <key>'s that you just add to a ships shipdata.plist file to switch on the effects, all the complex stuff will happen behind the scenes!
It’s not gone that far… yet. The material stuff lets you set an overall glow colour for a material, for instance, irrespective of shaders, but it doesn’t allow you to specify a glow map.
User avatar
Dr. Nil
---- E L I T E ----
---- E L I T E ----
Posts: 983
Joined: Thu Sep 28, 2006 5:11 pm
Location: Nearest Hoopy Casino
Contact:

Post by Dr. Nil »

Griff wrote:
anyway, i imagine everyone's pretty tired of seeing this ship by now
I'm not :D
Image

300 billboards in Your Ad Here!
Astromines and more in Commies.
AVAILABLE HERE along with other Oolite eXpansion Packs.
User avatar
TGHC
---- E L I T E ----
---- E L I T E ----
Posts: 2157
Joined: Mon Jan 31, 2005 4:16 pm
Location: Berkshire, UK

Post by TGHC »

Me neither.
The Grey Haired Commander has spoken!
OK so I'm a PC user - "you know whats scary? Out of billions of sperm I was the fastest"
User avatar
Griff
Oolite 2 Art Director
Oolite 2 Art Director
Posts: 2479
Joined: Fri Jul 14, 2006 12:29 pm
Location: Probably hugging his Air Fryer

Post by Griff »

i've vandalised Ahrumans laserglow shader into a glowing metal fragment shader for use on debris left behind by exploding ships, here is it at work on the 'alloy' metal fragment:-

Image

I'm trying to get the glow amount to decrease over time, the glow amount is being set by a variable called metal_temperature in the shader code, can this be counted down from 1 to 0 in the shader code?

here's the fragment shader code:-

Code: Select all

// Information from Oolite.
uniform sampler2D      tex0;
uniform sampler2D      tex1;

uniform float         time;
uniform float         metal_temperature;


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


// Calculates the levels of R, G & B that make up the glow effect (MetalGlow). Red channel in effects map png proportional to level of effect.
vec4 MetalGlow(float level)
{
   vec4 result;
   
   result.rgb = vec3(1.0, 0.5, 0.25) * level; 
   result.a = 1.0;
   
   return result;
}

// Irregular flickering function.
float Pulse(float value, float timeScale)

{
   float t = time * timeScale; 
   float s0 = t;
   s0 -= floor(s0);
   float sum = abs( s0 - 0.5);
   
   float s1 = t * 1.7 - 0.05;
   s1 -= floor(s1);
   sum += abs(s1 - 0.5);
   
   float s2 = t * 2.3 - 0.3;
   s2 -= floor(s2);
   sum += abs(s2 - 0.5);
   
   float s3 = t * 5.09;
   s3 -= floor(s3);
   sum += abs(s3 - 0.5);

   return (sum * 0.25) * value;
}


// 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 EffectsMap = texture2D(tex1, texCoord); 
   float specExponent = EffectsMap.b * 200.0 + 1.0;
   float specIntensity = EffectsMap.g * 1.2;
   
/*   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;    
   specular = mix(specular, specular * diffuse, 0.0);
   vec4 color = diffuse * ColorMap + specular * specIntensity;
   
   
   
   float HeatAlphaR = EffectsMap.r * 2.0; 
   float HeatAlphaB = EffectsMap.r * 0.05; 
   
   color += MetalGlow(metal_temperature * HeatAlphaR + HeatAlphaB);
   
   // ...and heat effects
   float Heat = max(metal_temperature - 0.5, 0.0) * 2.0;
   Heat = Pulse(metal_temperature, 0.1); 
   float Heat2 = Pulse(metal_temperature, 0.5); 
   float turnuptheheat = ((Heat + metal_temperature * HeatAlphaR) * HeatAlphaB) + ((Heat2 + metal_temperature * HeatAlphaB) * HeatAlphaR);     
   color += MetalGlow(turnuptheheat);
    
   gl_FragColor = vec4(color.rgb, 1.0);
}
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've vandalised Ahrumans laserglow shader into a glowing metal fragment shader for use on debris left behind by exploding ships, here is it at work on the 'alloy' metal fragment:-
Nice!
Griff wrote:
I'm trying to get the glow amount to decrease over time, the glow amount is being set by a variable called metal_temperature in the shader code, can this be counted down from 1 to 0 in the shader code?
No. However, in 1.69 or 1.70 this will be possible by setting the initial time (as a uniform) in the “ship script” for the fragment. This’ll involve something along the lines of:

Code: Select all

// Ship script (JavaScript):
this.didSpawn = function()
{
    this.setShaderUniform("startTime", time);
}

// Shader (GLSL):
uniform float time;
uniform float startTime;
// ...
float elapsedTime = time - startTime;
The details of the JavaScript bit here haven’t been determined yet, but should look about like that. The setShaderUniform method will probably set a uniform for every material in the ship/entity and all subentities. There will probably also be a bindShaderUniform method to bind a uniform to a ship property.

Come to think of it, a shader-bindable spawnTime uniform might be a more elegant solution.
Jakob Kramer
Above Average
Above Average
Posts: 25
Joined: Tue Apr 17, 2007 2:10 pm
Location: Denmark

Post by Jakob Kramer »

Griff wrote:
i've vandalised Ahrumans laserglow shader into a glowing metal fragment shader for use on debris left behind by exploding ships, here is it at work on the 'alloy' metal fragment
Ooh! That looks nice!

A cool (but probably not easily implemented) effect could be if such a "heated metal glow" could be added to the places a ship's hull was hit during combat. That is, the more hits it takes the more the hull glows (ideally at those points the hull was hit).
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 »

Not gonna happen any time soon, I’m afraid.
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 »

@ Griff: very, very nice. And it will definitely make it easier to locate all those fragments after you have blown up some ship. :twisted:

:D :D :D
Post Reply