Ruining the classics (screenshot heavy thread)

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

Moderators: another_commander, winston

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 »

Well, that last one shouldn’t work. It doesn’t make sense.

But none of those shaders made it blue? I wonder where that’s coming from, then. Annoying.

Try these:

Code: Select all

void main(void) 
{ 
    gl_FragColor = gl_LightSource[1].diffuse; 
}

Code: Select all

void main(void) 
{ 
    gl_FragColor = gl_FrontMaterial.diffuse; 
}

Code: Select all

uniform float hull_heat_level;
void main(void) 
{ 
    gl_FragColor = vec4(hull_heat_level, 0.5, -hull_heat_level, 1.0); 
}
My guess is that something, somewhere, isn’t being set up properly. What, though?

User avatar
Griff
Oolite 2 Art Director
Oolite 2 Art Director
Posts: 2298
Joined: Fri Jul 14, 2006 12:29 pm
Location: Wales

Post by Griff »

hi Ahruman, the last example from that batch:-

Code: Select all

uniform float hull_heat_level; 
void main(void) 
{ 
    gl_FragColor = vec4(hull_heat_level, 0.5, -hull_heat_level, 1.0); 
} 

seems to have done the job, look:-
Image

the other two gave me the white hull:-
Image

and the last one from the previous posting that you were puzzled by gave me a black hull:-
the code was :-

Code: Select all

void main(void) 
{ 
    gl_FragColor = gl_LightSource[1].ambient; 
}
and the result was:-
Image

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:hi Ahruman, the last example from that batch:-

Code: Select all

uniform float hull_heat_level; 
void main(void) 
{ 
    gl_FragColor = vec4(hull_heat_level, 0.5, -hull_heat_level, 1.0); 
} 

seems to have done the job, look:
No, it’s just not working. That’s the shaderless version you’re getting.

My guess is that you’re not replacing the entire shader, so “uniform float hull_heat_level;” is appearing twice. There should be an error message in the log.

The thing that shouldn’t work was:

Code: Select all

<key>shaders</key>
    <dict>
        <key>griff_krait_skin_1&2.png</key>
        <dict>
            <key>textures</key>
            <array>
                <string>griff_krait_shaded_skin_1&2.png</string>
            </array>
            <key>vertex_shader</key>
            <string>ahruman-generic.vertex</string>
            <key>fragment_shader</key>
            <string>ahruman-griff-krait-basic.fragment</string>
            <string>FrontMaterial.fragment</string>
            <string>LightModel.fragment</string>
            <string>LightSource0.fragment</string>
            <string>LightSource1.fragment</string>
        </dict>
    </dict>
</dict>
That’s an invalid plist, because of the series of strings. It should generate an error message in the log, then fall back to the “homebrew parser”, which will interpret it as:

Code: Select all

<key>shaders</key>
    <dict>
        <key>griff_krait_skin_1&2.png</key>
        <dict>
            <key>textures</key>
            <array>
                <string>griff_krait_shaded_skin_1&2.png</string>
            </array>
            <key>vertex_shader</key>
            <string>ahruman-generic.vertex</string>
            <key>fragment_shader</key>
            <string>ahruman-griff-krait-basic.fragment</string>
            <key>FrontMaterial.fragment</key>
            <string>LightModel.fragment</string>
            <key>LightSource0.fragment</key>
            <string>LightSource1.fragment</string>
        </dict>
    </dict>
</dict>

User avatar
Griff
Oolite 2 Art Director
Oolite 2 Art Director
Posts: 2298
Joined: Fri Jul 14, 2006 12:29 pm
Location: Wales

Post by Griff »

oh heck, uniform float hull_heat_level; did appear twice, once at the start of the shader and again in the bit i pasted in,
here's the error from the log

2007-04-08 13:48:57.000 oolite.exe[2752] [rendering.opengl.shader.init.failed]: GLSL ERROR: shader code would not compile:
ERROR: 0:72: 'hull_heat_level' : redefinition
ERROR: 1 compilation errors. No code generated.

i took out the uniform float hull_heat_level; from the start of the shader, and got this..mmm, nice green paintjob!


Image

here's the full shader code

Code: Select all

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

uniform float			time;
uniform float			engine_level;


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


// Colour ramp from black through reddish brown/dark orange to yellow-white.
vec4 TemperatureGlow(float level)
{
	vec4 result;
	
	result.r = level;
	result.g = level * level * level;
	result.b = max(level - 0.7, 0.0) * 2.0;
	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 * 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;
}


// 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_LightSource[idx].ambient; \
		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), 40.0); \
	}

uniform float hull_heat_level; 
void main(void) 
{ 
    gl_FragColor = vec4(hull_heat_level, 0.5, -hull_heat_level, 1.0); 
}


User avatar
Dr. Nil
---- E L I T E ----
---- E L I T E ----
Posts: 985
Joined: Thu Sep 28, 2006 5:11 pm
Location: Nearest Hoopy Casino
Contact:

Post by Dr. Nil »

Great job on the Krait, Griff.

Once more you've made it to the cover of What Spaceship?

Image

from http://aegidian.org/bb/viewtopic.php?p=34624#34624
Last edited by Dr. Nil on Sun Apr 08, 2007 1:43 pm, edited 1 time in total.
Image

300 billboards in Your Ad Here!
Astromines and more in Commies.
AVAILABLE HERE along with other Oolite eXpansion Packs.

User avatar
Griff
Oolite 2 Art Director
Oolite 2 Art Director
Posts: 2298
Joined: Fri Jul 14, 2006 12:29 pm
Location: Wales

Post by Griff »

Doc, heh, that's great!
30% off what spaceship? what a bargain!

Ahruman, maybe it's just something weird with my pc, i wouldn't worry to much about the blueships i've been posting as it could just be something here on my system causing it

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 »

Well, the green is about the right shade, suggesting it’s not a problem with the hull heat glow stuff.

Since these test shaders work fine, it’s probably a bug in Oolite or the shaders. If anyone with a PC could verify that they’ve got working shaders without the blueness (or with it, for that matter) it would be helpful.

User avatar
Griff
Oolite 2 Art Director
Oolite 2 Art Director
Posts: 2298
Joined: Fri Jul 14, 2006 12:29 pm
Location: Wales

Post by Griff »

i'll take oolite into work next tuesday and try it out there on some of the pc's :)

you know, i think i was wrong when i said the level of blue varied with the kraits orientation to the sun in game, it seems to be more effected by the players position to the krait.
here's a two screenshots of the same krait merged into one image, when the krait is on the left of the screen it appears more purple and when it's on the right it's more blue, at other positions it can get quite cyan in colour but i think that might be the specular effect whitening out the blue
Image

User avatar
Griff
Oolite 2 Art Director
Oolite 2 Art Director
Posts: 2298
Joined: Fri Jul 14, 2006 12:29 pm
Location: Wales

Post by Griff »

Ahruman, i'm having a go and drawing out specularity maps for the upper & lower hulls of the krait, i'm used to seeing these maps done as greyscale images - with the lighter shades being more shiny than the darker shades, anyway, refering to your explanation of specular maps earlier in the thread you mention 2 components - specular exponent and colour (and a third map to fade between plastic & metal).

is it OK to use a greyscale map along the lines of the one below for the specular exponent?
Image

for the colour map can the regular diffuse texture map be used?
...and i'm confused about the third map? is it a transparency 'mask' for the colour map?

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 »

The idea of the “metallic map” was to fade between the diffuse texture colour and white, instead of having a separate specular colour map – white looks plasticy, self-coloured more metal-like. But if you just send me a single-channel map, I can bodge something together.

User avatar
Griff
Oolite 2 Art Director
Oolite 2 Art Director
Posts: 2298
Joined: Fri Jul 14, 2006 12:29 pm
Location: Wales

Post by Griff »

i've upped some specular exponent maps for the upper & lower hull & the exhaust here:-
http://www.box.net/shared/o7ygx17788

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 »

More shadificated.
These all use the red channel as exponent and the green channel as intensity, so you can fiddle with adjusting these separately. The blue is unused, except for the exhaust, where it’s the engine_level glow map.

User avatar
Griff
Oolite 2 Art Director
Oolite 2 Art Director
Posts: 2298
Joined: Fri Jul 14, 2006 12:29 pm
Location: Wales

Post by Griff »

Cheers Ahruman, thanks for writing the specularity shader and connecting it to the krait! i've split the greyscale images i posted back into their rgb channels and i'm doing a few experiments to see how varing the levels of red & green effect the specular highlights. these shaders are powerfull stuff!

User avatar
Charlie
---- E L I T E ----
---- E L I T E ----
Posts: 262
Joined: Wed Sep 27, 2006 5:33 pm

Post by Charlie »

Griff wrote:Ahruman, sorry to be a pain, what do i do with that shader code? do i copy the four examples into each of the .fragment file in the kraits Shaders folder?

Charlie, you've got to get hold of the 1.68 version of Oolite and get stuck into the glowy stuff, it looks unbelievable... specular highlights on hulls, engine exhausts all glowing hot, you see heat spreading across the hull from the gun mountings..drool..gibber...basically, it's totally up your psychedelic mind-blowing alley!
@Griff:
Your faith in my modeling ability is much appreciated - I'm not sure it's deserved, especially compared to what you & Selezen have been doing lately!
Many thanks for your kind comments. :D
I agree my B.inc & Orb ships will benefit hugely from this...

@Aruman:
I don't know, I stop keeping a close eye on the Oolite B.B. for five miniutes while pursuing other projects & suddenly I find... :shock: 8)
Fantastic work!
My thanks & appreciation for your on-going hard work.
:
:
Pardon me while I go locate your latest build + Griff's Krait & spend some time catching up with developments. Then I'll need to figure out how it's done so I can add some more eye-candy. :D

*Edit*
@Aruman et al:
Pardon a v. daft question:
Is this build Windoze, OSX, or both?
I'm a 'doze user you see ( probably obvious given my chronic inability to squash case-sensitivity bugs :roll: ) though I'm in the process of going dual boot with OSx86. :D :wink:
Um... The Mac version of Oolite: It will run on OSx86..?
:
I've really not being paying attention, have I?
Benulobiweed.inc
By Appointment to
--- : GalCoop : ---

Your nearest Benulobiweed.inc dealer:
http://www.box.net/public/b2tic3tjsk#main

Charlie

User avatar
Uncle Reno
Intergalactic Spam Assassin
Intergalactic Spam Assassin
Posts: 648
Joined: Mon Apr 24, 2006 12:54 pm
Location: UK

Post by Uncle Reno »

Charlie wrote:Is this build Windoze, OSX, or both?
Windows build (and thread) here.
"Get back or I unleash my lethal spotted batoid!!"

What I do when not reading the Oolite bulletin board!

Post Reply