Oolite Bulletins

For information and discussion about Oolite.
It is currently Thu Apr 19, 2018 3:33 pm

All times are UTC




Post new topic  Reply to topic  [ 411 posts ]  Go to page Previous 120 21 22 23 2428 Next
Author Message
 Post subject:
PostPosted: Sat Sep 12, 2009 12:04 am 
Offline
Intergalactic Spam Assassin
Intergalactic Spam Assassin
User avatar

Joined: Tue Dec 05, 2006 9:43 pm
Posts: 8501
Location: Newbury, UK
I tried installing the GIMP normalmap plugin as described somewhere way back in this thread and I get this:
Code:
 sudo apt-get install gimp-normalmap
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Couldn't find package gimp-normalmap
john@new-ubuntu:~$
I presume I'm simply not looking at the wrong repository?

I did find it here: http://packages.ubuntu.com/source/hardy/gimp-normalmap - but I'm running Gutsy - and when I search with Synaptic Package manager for GIMP related stuff this isn't included and trying to add this crashes the SPM and I had to hack sources.lst to get it up and running again. :?

Sometimes I wish I'd stuck with Solaris and hadn't gone all soft under M$ Windows when I was offered the chance to change machines at work all those years ago...

_________________
Quote:
Apparently I was having a DaddyHoggy moment.
Oolite Life is now revealed here


Top
   
 Post subject:
PostPosted: Tue Dec 22, 2009 2:05 pm 
Offline
---- E L I T E ----
---- E L I T E ----
User avatar

Joined: Mon Nov 17, 2008 4:15 pm
Posts: 406
Location: Blighty
Hey peeps, a quick question... Blender produces tangent normal maps that allow you to bake a high poly model in the form of normals to a low poly model, is it possible for Oolites' normal mapping support to work with these?


Top
   
 Post subject:
PostPosted: Thu Jan 07, 2010 10:40 pm 
Offline
Grand Admiral Emeritus
Grand Admiral Emeritus
User avatar

Joined: Sat Apr 02, 2005 2:43 pm
Posts: 6657
Location: Sweden
What with planet shaders coming up, this video is quite interesting.

_________________
E-mail: jens@oolite.org


Top
   
 Post subject:
PostPosted: Thu Jan 07, 2010 11:59 pm 
Offline
Intergalactic Spam Assassin
Intergalactic Spam Assassin
User avatar

Joined: Tue Dec 05, 2006 9:43 pm
Posts: 8501
Location: Newbury, UK
Very interesting indeed, thanks for the link!

So, will Oolite planets cope with watery sun glints then?

_________________
Quote:
Apparently I was having a DaddyHoggy moment.
Oolite Life is now revealed here


Top
   
 Post subject:
PostPosted: Fri Jan 08, 2010 12:04 am 
Offline
Grand Admiral Emeritus
Grand Admiral Emeritus
User avatar

Joined: Sat Apr 02, 2005 2:43 pm
Posts: 6657
Location: Sweden
Kinda. For the synthesised planets, there’s no reasonable way to distinguish between lakes and ocean (or to estimate the surface smoothness), so the specular mapping will be optimised for ocean. Making the distinction in custom shaders shouldn’t be too hard.
Quote:
Hey peeps, a quick question... Blender produces tangent normal maps that allow you to bake a high poly model in the form of normals to a low poly model, is it possible for Oolites' normal mapping support to work with these?
Oops, missed this question. Yes, those should work with normal_map or any of the normal-mapping shaders. You may need to swap channels around or invert them to get the light to come from the right direction.

_________________
E-mail: jens@oolite.org


Top
   
 Post subject:
PostPosted: Wed Jan 13, 2010 5:25 pm 
Offline
Oolite 2 Art Director
Oolite 2 Art Director
User avatar

Joined: Fri Jul 14, 2006 12:29 pm
Posts: 2266
Location: Wales
from http://aegidian.org/bb/viewtopic.php?t=4494&start=1662


I've been doing the recolouring as follows, there's probably much more sophisticated ways of doing it that don't lead to such muddy colours in the lower range of tones

The re-painting can be thought of as simply taking a greyscale 'paintmask' image, recolouring it and mixing it into the underlying texturemap (the paint mask is used

to control the effect and limit it to only certain areas of the ship - black areas in the paintmask won't be recoloured, white areas will get the maximum amount of

re-colouring).

Taking the griff_normalmapped cobraIII as an example:
The cobra has 2 paintmasks, these are stored are the green channel and the alpha channel in the 'Griff_cobra_mk3_cleaner_mainhull_effects.png' image.

In the fragment shader (Griff_Cobra_mk3_Mainhull_Cleaner.fragment) the re-painting effect is included in the same function that creates the decal, the function is

called diffuseColor and is found at lines 120-146:
Code:
vec4 diffuseColor() 
{ 
// Calculate decal texture co-ordinates. 
   vec2 decalTexCoord = vTexCoord; 
   decalTexCoord -= vec2(kDecalS, kDecalT - (0.5 / kDecalSize)); 
   decalTexCoord *= vec2(kDecalSize / kDecalCount, kDecalSize); 
    
// Select the desired decal from the set. 
   float offset = floor(uDecalSelect * kDecalCount) / kDecalCount; 
   decalTexCoord.s += offset; 
    
// Get texture values. 
   vec4 baseTex = texture2D(uColorMap, vTexCoord); 
   vec2 PaintMap = texture2D(uEffectsMap, vTexCoord).ga; 
   float decalTex = texture2D(uDecalMap, decalTexCoord).b; 
        baseTex += PaintMap.x * PaintColor1;
        baseTex += PaintMap.y * PaintColor2;
        decalTex *= step(offset, decalTexCoord.s) * 
                    step(0.0, decalTexCoord.t) * 
                    step(-1.0 / kDecalCount - offset, -decalTexCoord.s) * 
                    step(-1.0, -decalTexCoord.t); 
    
// Composite decal over base. 
   return baseTex + decalTex * DecalColor; 
}      
the lines we are interested in here are:
Code:
   vec2 PaintMap = texture2D(uEffectsMap, vTexCoord).ga; 
this line creates a 2 component vector and stores the green and alpha channels from the 'uEffectsMap' texture - (see the cobras shipdata.plist and line 3 in the shader

to see the lines that link the Griff_cobra_mk3_cleaner_mainhull_effects.png to the shader as an 'uniform' called uEffectsMap)

aargh, i just realise i've started in the wrong place with the explanation, so skip back up the fragment shader to lines 25 & 26
Code:
   uniform vec4   PaintColor1; // used with paintmask map to tint diffuse texture
   uniform vec4   PaintColor2; // used with paintmask map to tint diffuse texture
Here we're reading in the paint colours from the cobraIII's shipdata.plist and storing them in the shader as 2 '4 component vectors' (that's too many components

really, the 4th one isn't really going to be used - bad shader writing on my part, we could have used a vec3 for Red, Green, and Blue)

next, skip down the fragment shader to line 134
Code:
 vec4 baseTex = texture2D(uColorMap, vTexCoord); 
here we're reading in the cobras basic texture 'skin' image and storing it in a vec4 called baseTex, see the shipdata.plist and line 1 in the shader for the setting up

of the uniform to link 'Griff_cobra_mk3_cleaner_mainhull_diffuse_spec.png' to the uniform binding 'uColorMap'

now we just need to mix our 2 paintmask images with our 2 paintColors and add them into the basetexture,this is done in lines 137 & 138
Code:
        baseTex += PaintMap.x * PaintColor1;
        baseTex += PaintMap.y * PaintColor2;
then line 145 outputs the final texture (as a vec4) from the function where it is used in line 170 onwards

the random paint colours are generated by oolite using the following info in the shipdata.plist
Code:
PaintColor1 = {type = "randomUnitVector"; scale = 0.4;};
PaintColor2 = {type = "randomUnitVector"; scale = 0.4;};
the scale is used as an upper limit for the values generated, anything more vivid that 0.4 gets a bit lurid in the game, notice how the player ship has it's paint

colours set to black:
Code:
PaintColor1 = { type = vector; value = "0.0 0.0 0.0"; }; 
PaintColor2 = { type = vector; value = "0.0 0.0 0.0"; };
we can't use random colours for the player as the ship would change it's paint job every game session. As the paint effects are added into the underlying texturemap,

setting the paint colour to black has no effect on the under lying texture as your basically just adding a 0.0 to whatever the current colour value is.

edit: as suggested by Zieman in the post below, 'baseTexCoord' wasn't actually needed it was just a duplicate of the vTexCoord vec2, i've ammended the example above to remove it and also the problematic references to gl_TexCoord[0].st


Last edited by Griff on Thu Apr 08, 2010 7:23 pm, edited 1 time in total.

Top
   
 Post subject:
PostPosted: Wed Jan 13, 2010 8:44 pm 
Offline
Grand Admiral Emeritus
Grand Admiral Emeritus
User avatar

Joined: Sat Apr 02, 2005 2:43 pm
Posts: 6657
Location: Sweden
Quote:
we can't use random colours for the player as the ship would change it's paint job every game session.
This is now fixed in trunk – entity personalities are saved, and also copied from display models in the shipyard.

_________________
E-mail: jens@oolite.org


Top
   
 Post subject:
PostPosted: Thu Apr 08, 2010 2:42 pm 
Offline
---- E L I T E ----
---- E L I T E ----
User avatar

Joined: Sat Oct 20, 2007 2:52 pm
Posts: 2313
Would it help to avoid problems with oxp-shaders if we'd use the preprocessor directive #version for our shaders?


Top
   
 Post subject:
PostPosted: Thu Apr 08, 2010 4:20 pm 
Offline
---- E L I T E ----
---- E L I T E ----
User avatar

Joined: Tue Sep 01, 2009 11:55 pm
Posts: 678
Location: in maZe
Quote:
...
Code:
...
{ 
   vec2 baseTexCoord = gl_TexCoord[0].st; 
...
...
Should this be fixed?
ATI users are in trouble with that gl_TexCoord[0].st part.

_________________
...and keep it under lightspeed!

Friendliest Meteor Police that side of Riedquat

[EliteWiki] Far Arm ships
[EliteWiki] Z-ships
[EliteWiki] Baakili Far Trader
[EliteWiki] Tin of SPAM


Top
   
 Post subject:
PostPosted: Thu Apr 08, 2010 5:21 pm 
Offline
---- E L I T E ----
---- E L I T E ----
User avatar

Joined: Sat Oct 20, 2007 2:52 pm
Posts: 2313
Quote:
Should this be fixed?
ATI users are in trouble with that gl_TexCoord[0].st part.
Can you test if Snoopers, BuoyRepair or Vector are working for you? If so, this is not the problem then...

Quite interesting stuff with differences betwen ATI and Nvidia, sometimes even between series of cards of the same manufactorer )-:


Top
   
 Post subject:
PostPosted: Thu Apr 08, 2010 7:26 pm 
Offline
Oolite 2 Art Director
Oolite 2 Art Director
User avatar

Joined: Fri Jul 14, 2006 12:29 pm
Posts: 2266
Location: Wales
i've edited the example above to remove (as Zieman correctly suggests) the gl_TexCoord[0].st blunder, it neededn't have been in the shader, proper ATI friendly texture coords were already being passed from the vertex shader to the fragment shader using the varying vec 2 'vTexCoord' , i've no idea where i got the gl_TexCoord[0] from, probably from an example shader i found on the internet and copied without having a clue what it did


Top
   
 Post subject:
PostPosted: Thu Apr 08, 2010 7:44 pm 
Offline
---- E L I T E ----
---- E L I T E ----
User avatar

Joined: Tue Sep 01, 2009 11:55 pm
Posts: 678
Location: in maZe
Quote:
Can you test if Snoopers, BuoyRepair or Vector are working for you? If so, this is not the problem then...
Vector 1.3 is not working. Looks like the textures don't load - all faces are black.

Oolite 1.73.4 test
WinXP pro SP3 32 bit
ATI HD3870
Catalyst 10.3

Latest.log clear (= no errors reported)

EDIT: I listed here: http://aegidian.org/bb/viewtopic.php?p=106344#106344 those OXPs I have installed and use problematic shaders = everything is either black or in shades of grey, totally untextured.

_________________
...and keep it under lightspeed!

Friendliest Meteor Police that side of Riedquat

[EliteWiki] Far Arm ships
[EliteWiki] Z-ships
[EliteWiki] Baakili Far Trader
[EliteWiki] Tin of SPAM


Last edited by Zieman on Thu Apr 08, 2010 7:56 pm, edited 1 time in total.

Top
   
 Post subject:
PostPosted: Thu Apr 08, 2010 7:54 pm 
Offline
---- E L I T E ----
---- E L I T E ----
User avatar

Joined: Sat Oct 20, 2007 2:52 pm
Posts: 2313
Quote:
Quote:
Can you test if Snoopers, BuoyRepair or Vector are working for you? If so, this is not the problem then...
Vector 1.3 is not working. Looks like the textures don't load - all faces are black.
Good to know - thanks for checking and reporting, Zieman.


Top
   
 Post subject:
PostPosted: Thu Apr 08, 2010 8:33 pm 
Offline
---- E L I T E ----
---- E L I T E ----
User avatar

Joined: Tue Sep 01, 2009 11:55 pm
Posts: 678
Location: in maZe
You're welcome. :)

_________________
...and keep it under lightspeed!

Friendliest Meteor Police that side of Riedquat

[EliteWiki] Far Arm ships
[EliteWiki] Z-ships
[EliteWiki] Baakili Far Trader
[EliteWiki] Tin of SPAM


Top
   
 Post subject:
PostPosted: Thu Apr 08, 2010 9:30 pm 
Offline
Oolite 2 Art Director
Oolite 2 Art Director
User avatar

Joined: Fri Jul 14, 2006 12:29 pm
Posts: 2266
Location: Wales
possible fix is to use the new code from ahrumans later shaders, i've added it in to the vector shaders here (i haven't checked if vector has been updated since v1.0 which is the one i've got downloaded in my oolite folder)

The shaders below set up a varying vec2 called vTexCoord to pass texture coordinates from the vertex to the fragment shader, texture coords are now set up using gl_MultiTexCoord0.st instead of gl_TexCoord[0].st, this seems to be more AMD friendly
ahruman_sv_ship_vector.vertex
Code:
varying vec3			v_normal;		// Surface normal
varying vec3			v_pos;		// Vertex/fragment position in eye space
varying vec2         vTexCoord;

void main()
{
	v_normal = normalize(gl_NormalMatrix * gl_Normal);
	v_pos = vec3(gl_ModelViewMatrix * gl_Vertex);
	
    vTexCoord = gl_MultiTexCoord0.st;
	gl_Position = ftransform();
}
ahruman_sv_ship_vector.fragment
Code:
// Information from Oolite.
uniform sampler2D		tex0;
uniform sampler2D		tex1;
				
uniform float			uTime;
uniform float			uEngineLevel;
uniform float			uLaserHeatLevel;
uniform float			uHullHeatLevel;


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

// intensity proportional to level.
vec4 EngineGlow(float level)
{
	return vec4(vec3(1.0, 0.6, 0.3) * level, 1);
}


// Colour ramp
vec4 TemperatureGlow(float level)
{
	// Load texture data
	vec4 colorMap = texture2D(tex0, vTexCoord);
	vec4 effectMap = texture2D(tex1, vTexCoord);

	vec4 result = vec4(0);
	
	result.r = effectMap.r * level * 4.0 + colorMap.r * level * 8.0;
	result.g = effectMap.g * level * 4.0 + colorMap.g * level * 2.3;
	result.b = effectMap.b * level * 4.0 + colorMap.b * level * 1.2;
	result.a = 1.0;
	
	return result;	
}


#ifdef OO_REDUCED_COMPLEXITY
float Pulse(float value, float timeScale)
{
	return 0.95 * value;
}
#else
// Version of wave() from Freaky Thargoid broken to produce irregular flickering.
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;
}
#endif


// 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), 20.0); \
	}


void main(void)
{
	vec4 diffuse = vec4(0), specular = vec4(0);
	vec3 eyeVector = normalize(-v_pos);
	
/*	Light 0 is the "showroom" light, but also the only light with an ambient component.
	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;
	
	// Load texture data
	vec4 colorMap = texture2D(tex0, vTexCoord);
	vec4 effectMap = texture2D(tex1, vTexCoord);
	
	// Add in constant glow (window and fuel scoop)
	diffuse += effectMap.b;
	
	// Apply part of engine effect before applying colour, so it is partially texture-dependant
	float engineAlpha = effectMap.r;
	vec4 engineEffect = engineAlpha * EngineGlow(min(uEngineLevel, 1.0));
	diffuse += 0.8 * engineEffect;
	
	// Multiply illumination by base colour
	vec4 color = diffuse * colorMap + specular;
	
	// Apply rest of engine effect (texture-invariant component, so yellow centre of engines also glows a bit)
	color += 1.0 * engineEffect;
	
	// ...and heat effects
	float laserAlpha = Pulse(effectMap.g, 0.7);
	float hullHeat;
	hullHeat = max(uHullHeatLevel - 0.5, 0.0) * 2.0;
	hullHeat = Pulse(hullHeat * hullHeat, 0.1);
	float heat = hullHeat + uLaserHeatLevel  * laserAlpha;
	color += TemperatureGlow(heat);
	
	gl_FragColor = color;
}
important note: if you copy and paste the above into your shaders, make sure you check for blank spaces after the \ at the end of every line in the light macro in the fragment shader (lines 74 - 79) - there musn't be any, if there are, your shader won't run and you'll have a whole load of errors in your log - basically nearly almost everyline in the shader will be flagged up as having an error in it


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 411 posts ]  Go to page Previous 120 21 22 23 2428 Next

All times are UTC


Who is online

Users browsing this forum: Baidu [Spider] and 13 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Limited