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

Shaders’ Outpost

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

Moderators: winston, another_commander

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 »

That would look ace normal-mapped, you just need to make a greyscale texture, with white areas being 'bumps' on the surface of the model and dark areas being 'dips' on the surface and bung it through the photoshop or the gimp normalmap generating plugins (which are free to download & use!), you'll end up with one of those odd looking lilac normal maps ready for use.
Ahruman has written all the necessary shaders for us, and i've copied & pasted his code into a bumpmapped coriolis oxp i few pages back in this thread (i think) so you could just start with that oxp and swap out the textures & models for your dodo

As an example of the greyscale image used as a source for the normalmap generating plugin, here's a screen shot from a bump-maped viper oxp i made:
Image
You could probably get a good greyscale image for the plugin by desaturating your colour map and running a few image filters on it, just to simplify it a bit because if the original image is too noisy the bump map ends up quite crinkly and the ship will look like it's made of rough paper or something
Last edited by Griff on Wed Mar 18, 2009 4:00 pm, edited 1 time in total.
User avatar
CaptKev
---- E L I T E ----
---- E L I T E ----
Posts: 519
Joined: Fri Jan 26, 2007 3:21 pm
Location: Shropshire, UK

Post by CaptKev »

@Griff, Thanks for the info I'll have a play with normal-maps this evening.

@DaddyHoggy, hopefully it will be by tonight.
Download Fighter HUD, Stingray and System Redux from the EliteWiki
User avatar
pagroove
---- E L I T E ----
---- E L I T E ----
Posts: 3035
Joined: Wed Feb 21, 2007 11:52 pm
Location: On a famous planet

Post by pagroove »

@ Griff,

We should update the P.A. Groove Stations OXP with normal mapped stations
:D
For P.A. Groove's music check
https://soundcloud.com/p-a-groove
Famous Planets v 2.7. (for Povray)
Image
https://bb.oolite.space/viewtopic.php?f=4&t=13709
User avatar
CaptKev
---- E L I T E ----
---- E L I T E ----
Posts: 519
Joined: Fri Jan 26, 2007 3:21 pm
Location: Shropshire, UK

Post by CaptKev »

Getting there, but it still looks a bit like crinkled paper
Image
Download Fighter HUD, Stingray and System Redux from the EliteWiki
User avatar
DaddyHoggy
Intergalactic Spam Assassin
Intergalactic Spam Assassin
Posts: 8512
Joined: Tue Dec 05, 2006 9:43 pm
Location: Newbury, UK
Contact:

Post by DaddyHoggy »

Getting there indeed - but yes, a bit crinkly still. Very much looking forward to the finished article.
Selezen wrote:
Apparently I was having a DaddyHoggy moment.
Oolite Life is now revealed here
aceshigh
Competent
Competent
Posts: 50
Joined: Thu Mar 05, 2009 6:09 am
Location: Novo Hamburgo, Brazil

Post by aceshigh »

the first one looked more gray... this second one is brownish...
User avatar
CaptKev
---- E L I T E ----
---- E L I T E ----
Posts: 519
Joined: Fri Jan 26, 2007 3:21 pm
Location: Shropshire, UK

Post by CaptKev »

Image
Download Fighter HUD, Stingray and System Redux from the EliteWiki
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 »

Looking really good Captkev!
The lampcolor line (line 12 in the shader):

Code: Select all

vec4 LampColor = vec4(1.0, 0.9219, 0.6436, 1.0);
will just change what colour the 'window' lights on the hull are, i think the brownish tinge is coming from this line (line 50 in the shader):

Code: Select all

color += colorMap * 5.0 * specular * kSpecular;
you could remove the colorMap * 5.0 bit from it so it reads like this

Code: Select all

   color += specular * kSpecular;
That will stop the specular highlight colour being tinted by the colour of the texturemap and only be coloured by the light from the system sun.
you might want to tweak these lines too (lines 9 & 10 in the shader):

Code: Select all

const float          kSpecExponent = 2.0;
const float          kSpecular = 0.8;
the kSpecExponent value controls the size of the highlight and kSpecular controls the highlight strengthm try a smaller number for kSpecular (maybe 0.3) and a bigger value for kSpecExponent (maybe 4.0)

edit: oh, i didn't notice that new screenshot - it looks like you've got it sorted! really lovely stuff!
User avatar
CaptKev
---- E L I T E ----
---- E L I T E ----
Posts: 519
Joined: Fri Jan 26, 2007 3:21 pm
Location: Shropshire, UK

Post by CaptKev »

Griff wrote:
Looking really good Captkev!
The lampcolor line (line 12 in the shader):

Code: Select all

vec4 LampColor = vec4(1.0, 0.9219, 0.6436, 1.0);
will just change what colour the 'window' lights on the hull are, i think the brownish tinge is coming from this line (line 50 in the shader):

Code: Select all

color += colorMap * 5.0 * specular * kSpecular;
you could remove the colorMap * 5.0 bit from it so it reads like this

Code: Select all

   color += specular * kSpecular;
That will stop the specular highlight colour being tinted by the colour of the texturemap and only be coloured by the light from the system sun.
you might want to tweak these lines too (lines 9 & 10 in the shader):

Code: Select all

const float          kSpecExponent = 2.0;
const float          kSpecular = 0.8;
the kSpecExponent value controls the size of the highlight and kSpecular controls the highlight strengthm try a smaller number for kSpecular (maybe 0.3) and a bigger value for kSpecExponent (maybe 4.0)

edit: oh, i didn't notice that new screenshot - it looks like you've got it sorted! really lovely stuff!
Thanks again Griff. :D

I've managed to get it looking a little bit better by only multiplying the ColorMap by 3 times and reducing the redness in the texture a wee bit.
Download Fighter HUD, Stingray and System Redux from the EliteWiki
User avatar
Vajo
Competent
Competent
Posts: 32
Joined: Thu Apr 05, 2007 10:12 am

Post by Vajo »

Good work Captkev :!:
Beam me up!
User avatar
DaddyHoggy
Intergalactic Spam Assassin
Intergalactic Spam Assassin
Posts: 8512
Joined: Tue Dec 05, 2006 9:43 pm
Location: Newbury, UK
Contact:

Post by DaddyHoggy »

Looking very good indeed - Oh - can't wait for v1.73 and all these normal textured wonders!
Selezen wrote:
Apparently I was having a DaddyHoggy moment.
Oolite Life is now revealed here
milinks
Deadly
Deadly
Posts: 164
Joined: Sun Jun 27, 2004 9:19 pm

WoW! what time blood tears and toil can bring :)

Post by milinks »

Hi to all, its been a year or more since i last spent sleepness nights programming n ship building here, so hi to all the names i remember, and its really good to see so many names new to me :) My son plays oolite (at least i introduced him to something positve lol) and apart from wanting me to update the customsounds oxp he wants me to make him his own ship, looking at Griffs work has been amazing, the specular mapping and use of shaders is just brilliant, normal textures were easy, but i'd never got to grips with alpha channels n things, this is the bit where im kneeling and whimpering in a "im not worthy but please teach me" kinda way :wink: would anyone be able to take it upon themselves to write a tutorial (if we need an idiot to stand up for the need for an idiots guide, im the one waving his hand in the air) that explains how to create the different channels of the texture, and how the shaders work. Ive read pretty much every post since i was last about (hence the pile of ironing and jobs todo list growing) and cant find anywehere which explains these things. Most probably not the best place to put this begging letter, but hoping someone can help fulfill a kids ambition (and then i'll let my son know :wink: )
The improvements have been fantastic, and its really good to see so many people keeping this so very much alive!!
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'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
User avatar
ramon
---- E L I T E ----
---- E L I T E ----
Posts: 346
Joined: Thu Jun 01, 2006 2:38 pm
Location: Tavistock
Contact:

Post by ramon »

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?
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6574
Joined: Wed Feb 28, 2007 7:54 am

Post by another_commander »

That Asp looks awesome even in its half-finished state. Great job ramon!
Post Reply