Griff's normalmapped ship remakes
Moderators: winston, another_commander
- Simon B
- ---- E L I T E ----
- Posts: 836
- Joined: Thu Oct 23, 2008 5:54 am
- Location: Red Beach NZ
- Contact:
Well gee shucks.ZygoUgo wrote:@Simon.. Glad to see you about, and that's a very scrummy return. Any thoughts about helping update other willing OXP's to fit Griffs' stylings? Your ships are more than welcome in my Ooniverse
I'm studying griffs shader style and should be able to put together a basic howto. The trick is to use the shader tag off a griff ship that looks sort of the same style you want for the ship you are working on -- that way you don't need to understand how the things actually work. Replace the texture names with yours... these are png files you provide for your ship just like the regular skin.
The skin is done as normal... griff ships have simple color schemes in there though because the shader handles the fancy stuff - so it is dark greys mostly and anything that will be the same in all ships of this type.
The normalmap is also the same as the neolite one - but griff likes to use the alpha channel for information, same with the skin, that's why the textures directory is full of "air".
The information layers work a bit like the effects map for neolite - only the encoding is different. Draw each one in greyscale, seperately, keep a copy of each and combine them to color channels in the final png. Different ships do things slightly differently. So far the sidewinder player version shaders look like the easiest to use.
The model itself is kept boxy - but griff likes to put a spine along the top. For the FDL I worked that into the engine and split the points. And, yes, I have an NG edition in mind. The above won't work for an NG edition of the one currently in the oxp. The FDL is actually the hardest model to redo because its all sharp corners ... the normalmaps don't wrap around corners too well which is probably why griff's tend to follow them more. (They also don't seem to render well close up or in the views.)
Simon Bridge
[re2dux] [neolite]
"Everything is perfect down to every last flaw..."
HBT: The Book of Verse - Principia Discordia
[re2dux] [neolite]
"Everything is perfect down to every last flaw..."
HBT: The Book of Verse - Principia Discordia
- Cody
- Sharp Shooter Spam Assassin
- Posts: 16081
- Joined: Sat Jul 04, 2009 9:31 pm
- Location: The Lizard's Claw
- Contact:
They're certainly 'trippy', Griff... rather nice, in fact.
They throw up a whole bunch of these in the log, though:
They throw up a whole bunch of these in the log, though:
Code: Select all
[shader.compile.failure]: ***** ERROR: GLSL fragment shader compilation failed for griff_glow_moss_asteroid.fragment:
>>>>> GLSL log:
Fragment shader failed to compile with the following errors:
ERROR: 1:112: error(#202) No matching overloaded function found mix
ERROR: error(#273) 1 compilation errors. No code generated
[shader.load.fullModeFailed]: ----- WARNING: Could not build shader griff_glow_moss_asteroid.vertex/griff_glow_moss_asteroid.fragment in full complexity mode, trying simple mode.
[shader.compile.failure]: ***** ERROR: GLSL fragment shader compilation failed for griff_glow_moss_asteroid.fragment:
I would advise stilts for the quagmires, and camels for the snowy hills
And any survivors, their debts I will certainly pay. There's always a way!
And any survivors, their debts I will certainly pay. There's always a way!
- Cmd. Cheyd
- ---- E L I T E ----
- Posts: 934
- Joined: Tue Dec 16, 2008 2:52 pm
- Location: Deep Horizon Industries Manufacturing & Research Site somewhere in G8...
Have you been peaking in my WiP folder again, Griff?
Seriously thought, looks wonderful. Can't wait to see the whole thing. One note however, asteroids are too small to have sufficient mass for thermodynamic reactions.
Seriously thought, looks wonderful. Can't wait to see the whole thing. One note however, asteroids are too small to have sufficient mass for thermodynamic reactions.
Find my OXP's at:
Deep Horizon Industries - Your Planet Our Design
Deep Horizon Industries - Your Planet Our Design
- Griff
- Oolite 2 Art Director
- Posts: 2481
- Joined: Fri Jul 14, 2006 12:29 pm
- Location: Probably hugging his Air Fryer
Drat, i didn't test properly, i think it's this line in the fragment shaderEl Viejo wrote:They throw up a whole bunch of these in the log, though:Code: Select all
[shader.compile.failure]: ***** ERROR: GLSL fragment shader compilation failed for griff_glow_moss_asteroid.fragment: >>>>> GLSL log: Fragment shader failed to compile with the following errors: ERROR: 1:112: error(#202) No matching overloaded function found mix ERROR: error(#273) 1 compilation errors. No code generated [shader.load.fullModeFailed]: ----- WARNING: Could not build shader griff_glow_moss_asteroid.vertex/griff_glow_moss_asteroid.fragment in full complexity mode, trying simple mode. [shader.compile.failure]: ***** ERROR: GLSL fragment shader compilation failed for griff_glow_moss_asteroid.fragment:
Code: Select all
color+= mix(gloweffect, 0.0, (LightLevel + Terminator) * InvTerminator);
Code: Select all
color+= mix(gloweffect, vec3(0.0), (LightLevel + Terminator) * InvTerminator);
edit: Ok, i've reuploaded the oxp with the edited shader, if you want to save yourself another download, open griff_glow_moss_asteroid.fragment in a text editor, clear out the code in there and replace it with this
Code: Select all
uniform sampler2D uColorMap; // Diffuse & Effects mask
uniform sampler2D uNormalMap; // normal map & specular intensity map
uniform sampler2D uCamoNoise; // effects for the swirly camo cloud stuff
varying vec2 vTexCoord;
varying vec3 vEyeVector; // These are all in tangent space
varying vec3 vLight0Vector;
varying vec3 vLight1Vector;
varying float LightLevel;
// Constants
const float KspecExponent = 15.0;
const float k2Pi = 6.283185307179586;
const float kTimeRate = 0.2;
const float uSharpen = 8.0;
const float Terminator = 0.3;
const float InvTerminator = 1.0 / (2.0 * Terminator);
// Uniforms from Oolite
uniform float uTime;
uniform float hull_heat_level;
uniform float uPersonality;
// Select between two camo colours
float CamoEffect(sampler2D texture, vec2 vTexCoord)
{
float n1, n2, n3, n4;
float time = uTime * uPersonality;
n1 = texture2D(texture, vTexCoord + vec2(0.01, 0.005) * time).r;
n2 = texture2D(texture, vTexCoord + vec2(0.013, -0.02) * time).g;
n3 = texture2D(texture, vTexCoord + vec2(-0.008, 0.017) * time).b;
n4 = texture2D(texture, vTexCoord + vec2(-0.019, -0.151) * time).a;
n1 = sin(n1 * k2Pi + time);
n2 = sin(n2 * k2Pi * 3.0 + time * 1.003) * 0.5;
n3 = sin(n3 * k2Pi + time * 2.0);
n4 = sin(n4 * k2Pi + time * 3.337);
// 7.0 is the total magnitude of n1..n4 times two.
float scaledSharpen = uSharpen / 7.0;
float n = (n1 + n2 + n3 + n4);
return smoothstep(0.0, 1.0, n * scaledSharpen);
}
// Irregular flickering function
#ifndef OO_REDUCED_COMPLEXITY
// Hull Temperate heat glow effect
vec3 TemperatureGlow(float level)
{
vec3 result = vec3(0);
result.r = level;
result.g = level * level * level;
result.b = max(level - 0.7, 0.0) * 2.0;
return result;
}
#endif
void Light(in vec3 lightVector, in vec3 normal, in vec3 lightColor, in vec3 eyeVector,
in float KspecExponent, inout vec3 totalDiffuse, inout vec3 totalSpecular)
{
lightVector = normalize(lightVector);
vec3 reflection = normalize(-reflect(lightVector, normal));
totalDiffuse += gl_FrontMaterial.diffuse.rgb * lightColor * max(dot(normal, lightVector), 0.0);
totalSpecular += lightColor * pow(max(dot(reflection, eyeVector), 0.0), KspecExponent);
}
#define LIGHT(idx, vector) Light(vector, normal, gl_LightSource[idx].diffuse.rgb, eyeVector, KspecExponent, diffuse, specular)
void main()
{
vec3 eyeVector = normalize(vEyeVector);
vec3 normal = normalize(texture2D(uNormalMap, vTexCoord).rgb - 0.5);
vec3 colorMap = texture2D(uColorMap, vTexCoord).rgb;
vec3 diffuse = vec3(0.0), specular = vec3(0);
float specIntensity = texture2D(uNormalMap, vTexCoord).a;
#ifdef OO_LIGHT_0_FIX
LIGHT(0, normalize(vLight0Vector));
#endif
LIGHT(1, normalize(vLight1Vector)); // change the 0 to 1 when exporting back to oolite
diffuse += gl_FrontMaterial.ambient.rgb * gl_LightModel.ambient.rgb;
float cycletime = uTime * uPersonality;
vec3 color = diffuse * colorMap + colorMap * specular * specIntensity * 2.0;
vec3 CyclingIllumCol = vec3(clamp(sin(cycletime * 0.5),0.0, 1.0), clamp(sin(cycletime * 0.25), 0.0, 1.0), clamp(sin(cycletime * 0.125), 0.0, 1.0));
float mask = texture2D(uColorMap, vTexCoord).a;
#ifndef OO_REDUCED_COMPLEXITY
// these next glow effects are only available in full shader mode
float camoSelect = CamoEffect(uCamoNoise, vTexCoord);
vec3 camo1 = CyclingIllumCol;
vec3 camo2 = CyclingIllumCol * 2.0;
camo2 = camo2 * camo2; // camo foreground, sun-coloured with increased saturation
vec3 camo = mix(camo1, camo2, camoSelect);
vec3 gloweffect = camo * mask;
// fully dark
if (LightLevel < -Terminator)
{
color += gloweffect;
}
// within the twilight zone, mix
if (abs(LightLevel) < Terminator )
{
color+= mix(gloweffect, vec3(0.0), (LightLevel + Terminator) * InvTerminator);
}
// Add the all over hull temperature glow. Full Shader mode only
float hullHeat = max(hull_heat_level - 0.5, 0.0) * 2.0;
color += TemperatureGlow(hullHeat);
#endif
// do a simpler glow effect for simple shader mode
#ifdef OO_REDUCED_COMPLEXITY
color += mask * CyclingIllumCol;
#endif
gl_FragColor = vec4(color.rgb, 1.0);
}
- Cody
- Sharp Shooter Spam Assassin
- Posts: 16081
- Joined: Sat Jul 04, 2009 9:31 pm
- Location: The Lizard's Claw
- Contact:
Thanks Griff.
In fact, you could make them quite rare, and difficult, dangerous but rewarding to mine… add the capability to mass-lock, due to density/mass, perhaps… an interesting addition?
How about ultra-dense 'unobtanium'.Cmd. Cheyd wrote:One note however, asteroids are too small to have sufficient mass for thermodynamic reactions.
In fact, you could make them quite rare, and difficult, dangerous but rewarding to mine… add the capability to mass-lock, due to density/mass, perhaps… an interesting addition?
I would advise stilts for the quagmires, and camels for the snowy hills
And any survivors, their debts I will certainly pay. There's always a way!
And any survivors, their debts I will certainly pay. There's always a way!
- Eric Walch
- Slightly Grand Rear Admiral
- Posts: 5536
- Joined: Sat Jun 16, 2007 3:48 pm
- Location: Netherlands
Its not the problem that you wrapped it wrong. The problem is that it will never be possible to UV wrap a seamless tiled map fully around an object. There will always be an area were the joints don't fit. For wrapping a single texture, seamless around an object you will need something like a lat-long map to start with.Griff wrote:been mucking about with some dry cracked earth textures and the parallax shader, .... although once again i've UV unwrapped these really badly - some clearly visible and horrible seams in the texture which the parallax makes even worse !
With Charlie's asteroids I cheated badly by using a mirrored texture at the other half of the asteroids. That way you can wrap any texture file around the asteroids, but when examining the asteroids closely you will always see the mirror band. And the normal map of the mirrored side will be inverted.
UPS-Courier & DeepSpacePirates & others at the box and some older versions
- Griff
- Oolite 2 Art Director
- Posts: 2481
- Joined: Fri Jul 14, 2006 12:29 pm
- Location: Probably hugging his Air Fryer
proof that not all experiments work out well, the 'iceteroid' :-
http://www.box.net/shared/apoq0kl2oi
Don't think these are going to make the oxp, i'm aiming for reflective ice boulders with frosty patches on them, i've hacked a horribly mangled version of the glitter shader from rendermonkey into it (without the random noise texture it uses to help randomise the glitter effect - so you will see the sparkles form odd symmetrical patterns at some angles)
http://www.box.net/shared/apoq0kl2oi
Don't think these are going to make the oxp, i'm aiming for reflective ice boulders with frosty patches on them, i've hacked a horribly mangled version of the glitter shader from rendermonkey into it (without the random noise texture it uses to help randomise the glitter effect - so you will see the sparkles form odd symmetrical patterns at some angles)
- Cody
- Sharp Shooter Spam Assassin
- Posts: 16081
- Joined: Sat Jul 04, 2009 9:31 pm
- Location: The Lizard's Claw
- Contact:
Took Rolling Thunder out to look at one, and launched straight into a nasty furball (that oxp is great).
The ‘iceteroid’ looks really strange in-game… sort of a weird, hollow 'pattern' under the ‘ice’… very odd!
The ‘iceteroid’ looks really strange in-game… sort of a weird, hollow 'pattern' under the ‘ice’… very odd!
I would advise stilts for the quagmires, and camels for the snowy hills
And any survivors, their debts I will certainly pay. There's always a way!
And any survivors, their debts I will certainly pay. There's always a way!
- Eric Walch
- Slightly Grand Rear Admiral
- Posts: 5536
- Joined: Sat Jun 16, 2007 3:48 pm
- Location: Netherlands
Asteroids? I thought it were Thargoid cocoons, disguised as asteroids.
UPS-Courier & DeepSpacePirates & others at the box and some older versions
- Griff
- Oolite 2 Art Director
- Posts: 2481
- Joined: Fri Jul 14, 2006 12:29 pm
- Location: Probably hugging his Air Fryer
yeah, i thought i'd have a bit of a play around making some colourful ones, i'll probably make these glowing ones rare, it'll be boring if every asteroid is the trippy type, it'll be cool if they could spawn in clusters of the same type, I'll have to ask the scripting wizards if this is possible, oo, and maybe make them 'unstable' so they pop excitingly if you shoot at them What do you think about the glow colours? should they cycle through the whole spectrum, or should they just pick one shade and stick to that, getting brighter and fainter?
yeah, the iceteroid swirly effect isn't really working in this case, it's a copy of the liquid metal effect another_commander discovered and demo'd ages ago on the forum, it comes from giving the parallax shader too high a scale & bias value, i thought it might give a feel of ice refracting the light and contrast nicely with the more traditional frosty bits on the rock, but it looks more like some wierd graphics glitch Maybe a bit more care with the texture maps might help, it's just using some quickly cobbled together ones at the moment
yeah, the iceteroid swirly effect isn't really working in this case, it's a copy of the liquid metal effect another_commander discovered and demo'd ages ago on the forum, it comes from giving the parallax shader too high a scale & bias value, i thought it might give a feel of ice refracting the light and contrast nicely with the more traditional frosty bits on the rock, but it looks more like some wierd graphics glitch Maybe a bit more care with the texture maps might help, it's just using some quickly cobbled together ones at the moment