Oolite Bulletins

For information and discussion about Oolite.
It is currently Tue Oct 17, 2017 1:57 am

All times are UTC




Post new topic  Reply to topic  [ 411 posts ]  Go to page Previous 118 19 20 21 2228 Next
Author Message
 Post subject:
PostPosted: Tue Mar 24, 2009 11:09 am 
Offline
Oolite 2 Art Director
Oolite 2 Art Director
User avatar

Joined: Fri Jul 14, 2006 12:29 pm
Posts: 2263
Location: Wales
I'm really rubbish at explaining stuff, but i made a pdf guide on how to take a greyscale image and a colour images and merge the 2 together using Gimp http://www.box.net/shared/jk87l4f0gw

Using the alpha channel for a 1 channel texture map (like a specular map or an illumination map) is a great way to save video memory as you can stuff them in the otherwise unused alpha channel of your ships 'skin' map.

Alpha channels are a confusing nightmare though, i've never found a proper way of removing an alpha channel from a png after it's been saved into it, so if anyone knows how to do this i'd really like to know (the only way i've found is to use amd's rendermonkey, it has a built in texture viewer that allows you to switch between the rgb and the alpha channels of a texture, then i do a screen grab of the channels i want and paste them into a new image file!)

The griff_cobra_III shaders are probably the most complex of the ones i've cobbled together from Ahrumans original shader code examples, i've written a little list of what texture maps it expects to see and in what order, but i don't know where it is at hte moment, it might even be in the oxp's readme!, i'll have a hunt about and post it up here when i find it.

here's a post i made a while back about painting out the 'effects map' (basically a texture map where each colour channel controls the strength of a shader effect - i'm using them to add in the glows around the ships engines and guns)
-------
Painting your own effects map can be a bit confusing especially if you try and split an image into seperate colour channels, you just end up with a series of greyscale images, it always gives me headaches, but there is a much simpler way of working, just create seperate layers for each colour 'channel' stack them above your usual texture map (diffuse map) and work by paining only red in teh red layer, blue in the blue layer and green in the green layer. When it comes time to save out your final effects map, just switch off the visibility of the diffuse map and a "save as.." so you can save out a copy of your effects map .png
Image
-------
Here's the textures for my cobra3 & viper oxp's in psd format (photoshop format, but gimp should open them) so you can see all the layers and how i stack them up so i know where to paint effects and stuff, all the images that will go into the alpha channels are on seperate layers so you can see how they all fit together rather than looking at the final images in the oxp's which just look like odd patches of colour on a transparent background
http://www.box.net/shared/4jpsppapev
this isn't gospel, it's just the way i do it, have a look at SimonB's and Scarecrows texturing tutorials, those guys really know what they're doing!
----
edit: ah, found the list of the textures in the normal mapped version griff_cobra oxp:
colour map RGB channels = the colour texture for shader & non shader mode
colour map A channel = the specular intensity map for shaders mode
Effects map - R channel - the red hot metal around the 'rocket exhaust'
Effects map - B channel - the cyan coloured exhaust glow
Effects map - G channel - Mask 1 for the re-painting effect
Effects map - A channel - Mask 2 for the re-painting effect
Normal Map -RGB Channels - Used for normal Mapping
Normal Map -A Channel - Illumination map for the hull lights (including the faked spill light from the cockpit window)
Decal Map - RGBA Channels, 4 different decals in each channel arranged horizontally in the image, chosen randomly for NPC's fixed for the player version, see the uDecalSelect 'uniform' in the griff_cobraIII's shipdata.plist - it's bound to 'entitypersonality' - which is a number in the range 0.0 to 1.0 ranomly generated when the ship is spawned.
http://wiki.alioth.net/index.php/Shader ... :_uniforms

'uniforms' are used to send information from the oolite game engine to your shader


Top
   
 Post subject:
PostPosted: Sun May 03, 2009 11:09 pm 
Offline
---- E L I T E ----
---- E L I T E ----
User avatar

Joined: Thu Jun 01, 2006 2:38 pm
Posts: 346
Location: Tavistock
I've gone and bought myself a new book and in it it says 'Ambient occlusion (AO) maps are an industry-standard method of baking subtle lighting information into models.'

I've rendered the Asp I'm working on (no normals yet, and the diffuse map is nowhere near complete) with and without the AO:

Image

I don't really understand how it works, but it does look nice with AO. I think it might be something I could replicate in a paint package. But seeing as this is the shader outpost I might as well ask, are there any plans on including an AO shader?

_________________
DarkWheel Cobra
Marett Vol 1
Various ships for the Assassins Guild


Top
   
 Post subject:
PostPosted: Mon May 04, 2009 8:42 am 
Offline
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral

Joined: Wed Feb 28, 2007 7:54 am
Posts: 4973
That Asp looks awesome even in its half-finished state. Great job ramon!


Top
   
 Post subject:
PostPosted: Mon May 04, 2009 9:34 am 
Offline
Intergalactic Spam Assassin
Intergalactic Spam Assassin
User avatar

Joined: Tue Dec 05, 2006 9:43 pm
Posts: 8501
Location: Newbury, UK
I like the AO version - I notice A_C didn't actually answer your question! (although I may be unfairly assuming A_C may know the answer one way or another)

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


Top
   
 Post subject:
PostPosted: Mon May 04, 2009 9:41 am 
Offline
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral

Joined: Wed Feb 28, 2007 7:54 am
Posts: 4973
@DH: I do not know the answer to the question and I certainly have not got the background to come up with something like this myself. If I must answer, I would say that no plans for ambient occlusion shaders exist, unless Ahruman returns and decides to have a go at it. or somebody with sufficient knowledge of the technicalities behind it wants to give it a try.


Top
   
 Post subject:
PostPosted: Mon May 04, 2009 10:04 am 
Offline
Intergalactic Spam Assassin
Intergalactic Spam Assassin
User avatar

Joined: Tue Dec 05, 2006 9:43 pm
Posts: 8501
Location: Newbury, UK
Quote:
@DH: I do not know the answer to the question and I certainly have not got the background to come up with something like this myself. If I must answer, I would say that no plans for ambient occlusion shaders exist, unless Ahruman returns and decides to have a go at it. or somebody with sufficient knowledge of the technicalities behind it wants to give it a try.
I suspected that the graphical side was the Great One Eye's domain - didn't mean to lean on you for answer - from my lowly position all the Dev's are coding gods and I forget you each have your specialties.

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


Top
   
 Post subject:
PostPosted: Mon May 04, 2009 10:40 am 
Offline
Oolite 2 Art Director
Oolite 2 Art Director
User avatar

Joined: Fri Jul 14, 2006 12:29 pm
Posts: 2263
Location: Wales
Aren't ambient occlusion maps used in the 3d program at rendertime to bake the lighting and shadowing from the lights in the scene into the models texture maps so these effects don't have to be calculated realtime in the game engine. I'm sure Scarecrow used them in his viper remake thread, i'll try and did out the link.edit: here we go, last post on this page
http://aegidian.org/bb/viewtopic.php?t= ... c&start=75


Top
   
 Post subject:
PostPosted: Mon May 04, 2009 1:35 pm 
Offline
---- E L I T E ----
---- E L I T E ----
User avatar

Joined: Thu Jun 01, 2006 2:38 pm
Posts: 346
Location: Tavistock
yeah i think that's right. i just stuck a white texture on the ship and rendered the UVW map out then stuck it on top of my diffuse map in photoshop and now have this. looks quite nice:

Image

_________________
DarkWheel Cobra
Marett Vol 1
Various ships for the Assassins Guild


Top
   
 Post subject:
PostPosted: Fri May 08, 2009 10:50 am 
Offline
---- E L I T E ----
---- E L I T E ----
User avatar

Joined: Tue Jul 08, 2008 12:31 am
Posts: 2508
Location: London England
OK here's an interesting one is it possible to apply fx maps to sub-entities?
would you simply utilise the same scripts or would you need duplicates?

In the same vein I take it that by the animated banner discussion, that it's indeed possible to apply animation to sub-entities too?

Doesn't matter I've had a play and sorted it.

_________________
Medusa.HUD NeoCaduceus
Quaternion


Top
   
 Post subject:
PostPosted: Sat May 09, 2009 10:24 pm 
Offline
Oolite 2 Art Director
Oolite 2 Art Director
User avatar

Joined: Fri Jul 14, 2006 12:29 pm
Posts: 2263
Location: Wales
yep, there's no problem at all adding shaders to subentities, just give them their own shaders definitions in their entry in the shipdata.plist file. you can use the same shader & texture files for the main ship and all it's subentites, or you can write different shaders for each subentity and even use different texture maps for them all too.
eg, here's an example from the griff_krait oxp, the main ship's shader code looks like this
Code:
"Griff_Krait_chrome_grey" = 
	{
shaders = 
		{ 
            "griff_krait_blue_diffuse.png" = 
			{ 
                vertex_shader = "griff_enviromap.vertex"; 
                fragment_shader = "griff_krait_chrome_hull_fi.fragment"; 
             
                textures = ("griff_krait_grey_diffuse.png",	"griff_krait_effects_illum.png", 
                {name = "griff_enviromentmap1.png"; repeat_s = "yes"; repeat_t = "yes";});
           
				uniforms = 
				{ 
				uTime = "universalTime"; 
				engine_power = "speedFactor"; 
				nearly_dead = "throwingSparks"; 
				hull_heat_level = "hullHeatLevel";				
				}; 				
			}; 
		}; 
	};
and one of it's subentities looks like this:
Code:
"griff_chrome_krait_ecm" = 
	{
shaders = 
		{ 
            "griff_krait_blue_diffuse.png" = 
			{ 
                vertex_shader = "griff_enviromap.vertex"; 
                fragment_shader = "griff_krait_chrome_scoop_eu.fragment"; 
             
                textures = ("griff_krait_blue_diffuse.png", "griff_krait_effects_illum.png",
				{name = "griff_enviromentmap1.png"; repeat_s = "yes"; repeat_t = "yes";}); 
				
				uniforms = 
				{ 
				uTime = "universalTime"; 
				nearly_dead = "throwingSparks"; 
				hull_heat_level = "hullHeatLevel";
				}; 
			}; 
		};  
	};
you can see in this example both the main ship and the subentity are sharing the same texture & effects maps ("griff_krait_blue_diffuse.png" and "griff_krait_effects_illum.png") and they both use the same vertex shader ("griff_enviromap.vertex"), but the main ship has a different fragment shader to the subentity.

Animation can be done in the vertex shader, there's no 'bones' or pose keyframing available though, the animated banner shader from a few pages back is just applying a sine wave to the points that make up the banner model and it's using each vertex's distance from the 0,0,0 origin co-ordinate in the model to fade out the effect)
The blackmonk monestary & spacebar turrets are using the laser heat uniform binding to control a recoil effect on the barrel - laser heat works differently on NPC than it does for the players ship - for an NPC ship everytime it fires, it's laser temp cycles from maximum temperature to minimum temperature each shot (unlike the players ship where the temperatre gradulay rises with the shot until it reaches maximum temperature.) this is great for us because we can then use this laser temperature value to offset points in the model.
here's the vertex shader for the recoiling turret in the spacebar
Code:
varying vec3         v_normal;      // Surface normal
varying vec3         v_pos;      // Vertex/fragment position in eye space
uniform float  laser_heat_level;
float recoil_offset = -laser_heat_level * 8.0;   
float vertex_Z_pos = gl_Vertex.z; 
  
void main()
{
   v_normal = normalize(gl_NormalMatrix * gl_Normal);
   v_pos = vec3(gl_ModelViewMatrix * gl_Vertex);
   vec4 recoil_deform_effect = vec4(gl_Vertex.x, gl_Vertex.y, gl_Vertex.z + recoil_offset, gl_Vertex.w);
   
   gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
   
   
if (vertex_Z_pos>50.0) // check the vert Z co-ords in Wings and modify the 50.0 as required for your model
       gl_Position = gl_ModelViewProjectionMatrix * recoil_deform_effect;
   else
   {
       gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
   } 
   
}
I'm not entirely confident in my coding in this shader, i am probably doing a lot of stuff really weirdly, anyway i'll give a small explanation of what the shader is doing...

you can see the shader reading in the laser heat level in this line
uniform float laser_heat_level;
then in the next line
float recoil_offset = -laser_heat_level * 8.0;
it takes the laser heat value, multiplies it by 8 and stores it in a floating point variable "recoil_offset" - this variable holds the amount we will be moving the models verticies along the z axis, multiplying by 8 is just amplifying the recoil effect, i got the number 8 from just testing then tweaking this value until it looked OK in game.
the next line
float vertex_Z_pos = gl_Vertex.z; is storing the Z axis position of the current vertex that the shader is working with in the floating point variable "vertex_Z_pos"
a bit further down the shader in the line
vec4 recoil_deform_effect = vec4(gl_Vertex.x, gl_Vertex.y, gl_Vertex.z + recoil_offset, gl_Vertex.w);
the shader is making a vec4 called recoil_deform_effect made up of the XYZW co-ordinates of the current vertex in the model - note that the Z co-ordinate is having the recoil_offset variable value added to it - this is basically the 'recoil effect' and will be used to shift the position of verticies in the model a bit later on in the shader
in this section:
if (vertex_Z_pos>50.0) // check the vert Z co-ords in Wings and modify the 50.0 as required for your model
gl_Position = gl_ModelViewProjectionMatrix * recoil_deform_effect;
else
{
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
}

the shader tests if the current vertex's Z co-ordinate is greater than 50.0, if so then it's position is transformedusing the values in the recoil_deform_effect vec4 ( gl_Position = gl_ModelViewProjectionMatrix * recoil_deform_effect;) , if the original z co-ordinate is less than 50.0, then the vertex's gl_position is not transformed (gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; )
the reason i'm testing if the original vertex coord is greater than 50 before deciding whether to deform it's position or not is that all the verticies in the model with z co-ords under 50 were the ones that made up the ball shaped base of the turret - i didn't want this part of the model recoiling, all the verticies with z-coords over 50.0 were the ones that make up the 'barrel' part of the turret.


Top
   
 Post subject:
PostPosted: Sat May 16, 2009 9:33 am 
Offline
Oolite 2 Art Director
Oolite 2 Art Director
User avatar

Joined: Fri Jul 14, 2006 12:29 pm
Posts: 2263
Location: Wales
Fresnel 2 Tone test
Image
Hmm, i tried to add a fresnel shader effect from Rendermonkeys example files into the shader i've been using for my set of normal mapped ships, it's sort of working, i didn't understand the maths properly but i makes for quite a cool effect - it could be used for 'oily' surfaces or on alien organic type ships maybe?
The ship above is coloured green, but there is a red and a blue colour being mixed into the texture depending on the viewing angle.


Top
   
 Post subject:
PostPosted: Sat May 16, 2009 12:45 pm 
Offline
Intergalactic Spam Assassin
Intergalactic Spam Assassin
User avatar

Joined: Tue Dec 05, 2006 9:43 pm
Posts: 8501
Location: Newbury, UK
Griff, it's wonderful! What a fab effect for the Thargoids - glowly and moving from green to purple depending on how you view them!

OR, the best custom pain job ever for a boy racer!

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


Top
   
 Post subject:
PostPosted: Sat May 16, 2009 12:58 pm 
Offline
---- E L I T E ----
---- E L I T E ----
User avatar

Joined: Sat Aug 14, 2004 4:55 pm
Posts: 633
Location: North Norfolk, UK, (Average Agricultural, Feudal States,Tech Level 8)
Now that really does convey an impression of a metallic skin, and the model detail is beautiful - if we can have models that look like that in Oolite, it will set a new standard for space games. Well done Griff! 8)

_________________
Very funny, Scotty, now beam down my clothes...


Top
   
 Post subject:
PostPosted: Sat Jun 13, 2009 10:05 pm 
Offline
Grand Admiral Emeritus
Grand Admiral Emeritus
User avatar

Joined: Sat Apr 02, 2005 2:43 pm
Posts: 6657
Location: Sweden
Quote:
I've gone and bought myself a new book and in it it says 'Ambient occlusion (AO) maps are an industry-standard method of baking subtle lighting information into models.'

I've rendered the Asp I'm working on (no normals yet, and the diffuse map is nowhere near complete) with and without the AO:

Image

I don't really understand how it works, but it does look nice with AO. I think it might be something I could replicate in a paint package. But seeing as this is the shader outpost I might as well ask, are there any plans on including an AO shader?
There is no need for an AO shader. The AO map itself is best generated offline using separate software, as you have done. It can then be baked into the diffuse map (or “the texture” if you’re not using any shaders) – in Photoshop, you’d overlay it over the base texture using Multiply mode. This can be calculated in a shader, but there’s rarely an advantage to doing it there instead of baking it, as far as I’m aware.

_________________
E-mail: jens@oolite.org


Top
   
 Post subject:
PostPosted: Sun Jun 14, 2009 11:30 am 
Offline
---- E L I T E ----
---- E L I T E ----
User avatar

Joined: Thu Jun 01, 2006 2:38 pm
Posts: 346
Location: Tavistock
Thanks Ahruman. I'm just getting my head around this (I normally just model for TV and have never worried about converting to games), but yeah I realise now what the AO is and I did just bake it in the end (seeing as that was the most sensible thing to do - thought I'd give sensible a try).

I've gone back to the drawing board on this Asp now. I like the way Griff's ships appear really chunky and solid, so I'm going to mimic that look.

I know Griff has random icons on his ships but is it possible to randomise the entire diffuse map. (keeping the same specular and bumps). I want to do five completely different colour schemes in case you're wondering why I asked.

_________________
DarkWheel Cobra
Marett Vol 1
Various ships for the Assassins Guild


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 411 posts ]  Go to page Previous 118 19 20 21 2228 Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 19 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:
cron
Powered by phpBB® Forum Software © phpBB Limited