Oolite Bulletins

For information and discussion about Oolite.
It is currently Fri Sep 22, 2017 9:55 am

All times are UTC




Post new topic  Reply to topic  [ 411 posts ]  Go to page Previous 122 23 24 25 2628 Next
Author Message
 Post subject: Re: Shaders’ Outpost
PostPosted: Thu May 05, 2011 8:42 pm 
Offline
Oolite 2 Art Director
Oolite 2 Art Director
User avatar

Joined: Fri Jul 14, 2006 12:29 pm
Posts: 2263
Location: Wales
Hi no, that won't work, you can't specify shaders in 'materials =' they have to go inside 'shaders =', something like this:-
edit: sorry, that was bad advice - see Ahruman's post below
Code:
shaders = 
	{ 
		"accipiter_no_shaders.png" = 
		{ 
			vertex_shader = "ahruman-generic-accipiter.vertex"; 
			fragment_shader = "accipiter-effects.fragment"; 
			textures = 
					(
						"accipiter_diffuse.png", 
						"accipiter_lights.png",
						"accipiter_effects.png"
					);
			uniforms =
					{
					tex0 = { type = texture; value = 0; };
					tex1 = { type = texture; value = 1; };
					tex2 = { type = texture; value = 2; };
					time = "universalTime";
					engine_level = "speedFactor"; 
					hull_heat_level = "hullHeatLevel";
					laser_heat_level = "laserHeatLevel";
					}; 	
		}; 
	};
although the rocket shader oxp is really old now and will need a re-write to work with the current Oolite so it's not worth bothering with it now and just using materials which have really come on in leaps and bounds since the rocket oxp was made, you can get nearly all the effects from the rocket shader oxp just using them (exceptions are the engine glow and laser gun heat glow effects - both generated using the effects_map texture, so if you leave the effects_map line out of your materials code you posted you should be set, you might also want to add in your materials some specularity settings eg:-
Code:
specular_color = ( 0.2, 0.2, 0.2 );  // Applies when specular map is not used (no shaders) 
shininess = 5;

_________________
Wiki homepage for my OXP: http://wiki.alioth.net/index.php/Griff_Industries


Last edited by Griff on Fri May 06, 2011 7:30 am, edited 1 time in total.

Top
   
 Post subject: Re: Shaders’ Outpost
PostPosted: Thu May 05, 2011 8:54 pm 
Offline
Grand Admiral Emeritus
Grand Admiral Emeritus
User avatar

Joined: Sat Apr 02, 2005 2:43 pm
Posts: 6657
Location: Sweden
Quote:
Hi no, that won't work, you can't specify shaders in 'materials =' they have to go inside 'shaders =', something like this:-
Griff, you really should read the fine manual some time. :-)

It is necessary to set up the textures the way Griff demonstrated if you’re using custom shaders, though.

_________________
E-mail: jens@oolite.org


Top
   
 Post subject: Re: Shaders’ Outpost
PostPosted: Fri May 06, 2011 10:20 am 
Offline
---- E L I T E ----
---- E L I T E ----
User avatar

Joined: Fri Feb 18, 2011 4:53 pm
Posts: 570
Location: Hatfield, Hertfordshire (poor industrial)
Thanks Griff and Ahruman,

although the rocket shader seems to work fine on my game.

_________________
Image


Top
   
 Post subject: Re: Shaders’ Outpost
PostPosted: Wed Nov 09, 2011 11:14 am 
Offline
Above Average
Above Average
User avatar

Joined: Tue Oct 11, 2011 12:14 pm
Posts: 19
I need a shader with diffuse, ilumination, specular and normal map support (can be spec baked to diffuse and illumination baked to normal)


Top
   
 Post subject: Re: Shaders’ Outpost
PostPosted: Wed Nov 09, 2011 1:58 pm 
Offline
---- E L I T E ----
---- E L I T E ----
User avatar

Joined: Sat Oct 20, 2007 2:52 pm
Posts: 2264
You could simply use the materials entries. All of the requested functionality is supported there.

Or should this shader do something special?


Top
   
 Post subject: Re: Shaders’ Outpost
PostPosted: Fri Jan 20, 2012 8:59 am 
Offline
Competent
Competent
User avatar

Joined: Mon Nov 14, 2011 1:03 pm
Posts: 39
Location: Madrid, España
Hi, I'm trying to add some engine heat effect through shaders to my ships. I have been following Griff and Ahruman's examples but I'm unable to understand how they work and i've failed. Should 3D models be normal mapped for the shaders to work? I thought they don't but now I've doubts about that.

Programing fragment vertex its beyond my possibilities because i'm not programer. I believed i will be able to tweak the examples' shaders but i've failed by now. Is there any DON'T PANIC, shaders for dummies, tutorial you can spare with me, please?

_________________
There is an art, it says, or rather, a knack to flying. The knack lies in learning how to throw yourself at the ground and miss. … Clearly, it is this second part, the missing, which presents the difficulties.
Blog http://mimoriarty.wordpress.com/


Top
   
 Post subject: Re: Shaders’ Outpost
PostPosted: Fri Jan 20, 2012 9:08 am 
Offline
Oolite 2 Art Director
Oolite 2 Art Director
User avatar

Joined: Fri Jul 14, 2006 12:29 pm
Posts: 2263
Location: Wales
Hi MiMoriarty
You don't need to have the model normalmapped for shaders to work - I think the problem here is that that rocket shader example is so old that it no longer works in the way that Oolite expects it to, the main problem being that nowadays Oolite needs a list of all your textures written out as 'Uniforms' in the shipdata.plist, when the rocket shader was written you didn't need to do this as Oolite automatically assigned the uniform names Tex0, Tex1 etc to your textures and the shader is written to use these names.
I can have a go at updating the rocket shader example to work again this weekend and i'll try and write out a guide that explains how i'm doing this engine heat effect in the shaders in my shipset, it's not a very complex effect, just a matter of mixing some extra glowmaps onto the ship

_________________
Wiki homepage for my OXP: http://wiki.alioth.net/index.php/Griff_Industries


Top
   
 Post subject: Re: Shaders’ Outpost
PostPosted: Fri Jan 20, 2012 9:15 am 
Offline
Competent
Competent
User avatar

Joined: Mon Nov 14, 2011 1:03 pm
Posts: 39
Location: Madrid, España
Quote:
I can have a go at updating the rocket shader example to work again this weekend and i'll try and write out a guide that explains how i'm doing this engine heat effect in the shaders in my shipset, it's not a very complex effect, just a matter of mixing some extra glowmaps onto the ship
Griff. That would be very nice from you. :o

_________________
There is an art, it says, or rather, a knack to flying. The knack lies in learning how to throw yourself at the ground and miss. … Clearly, it is this second part, the missing, which presents the difficulties.
Blog http://mimoriarty.wordpress.com/


Top
   
 Post subject: Re: Shaders’ Outpost
PostPosted: Fri Jan 20, 2012 9:48 am 
Offline
Oolite 2 Art Director
Oolite 2 Art Director
User avatar

Joined: Fri Jul 14, 2006 12:29 pm
Posts: 2263
Location: Wales
Seems to be a bit quiet at work so i had a quick look at the oxp, well, what a balst from the past! i grabbed the "Griff Rocket Shader Test - Engine Level Lights.zip file" from http://www.box.com/shared/h95rd0n25x (listed as Griff Rocket Example 2 in the first post of this thread), if you change the shipdata.plist to this
Code:
{
// ++++++           Griff Rocket Example               ++++++
"griff_rocket" = 
	{
	like_ship = "cobra3-trader";
	exhaust = ("0 0 -49.0 10.0 10.0 25.0");
	model = "griff_rocket.dat"; 
	name = "Griff Rocket";	
	roles = "griff_rocket";
	smooth = true;	
	shaders = 
		{ 
            "griff_rocket_unshaded_diffuse.png" = 
			{ 
                vertex_shader = "ahruman-generic.vertex"; 
                fragment_shader = "griff_rocket.fragment"; 
                textures = 
						(
							"griff_rocket_shaded_diffuse.png", 
							"griff_rocket_enginelevel_glowmap.png",
							"griff_rocket_effects.png"
						);
				uniforms =
						{
						tex0 = { type = texture; value = 0; };
						tex1 = { type = texture; value = 1; };
						tex2 = { type = texture; value = 2; };	
						time = "universalTime";
						engine_level = "speedFactor";	
						hull_heat_level = "hullHeatLevel";
						laser_heat_level = "laserHeatLevel";					
						}; 	
			}; 
		};
	};	
}
(Sorry, i had to change it from XML to Openstep format - i could't remember how to do the XML code)
and also change the script.js file in the Config folder to this:
Code:
// Configuration -- customize here 
this.role = "griff_rocket"; 
this.count = 3; 

// Standard attributes 
this.name           = "Spawn-" + this.role; 
this.author         = "Jens Ayton"; 
this.copyright      = "This script is hereby placed in the public domain."; 
this.version        = "1.0.1"; 
this.description    = "Script to make several ships of a given role appear at the witchpoint after every jump." 


this.shipWillLaunchFromStation = function() 
{ 
    system.legacy_addSystemShips(this.role, this.count, 1.0); 
    log("testscript.spawn", "Generated " + this.count + " " + this.role + " for testing purposes."); 
} 
it should get the oxp working again, although it still used the macro lighting code that we shouldn't be using!
When you launch the ammended script.js will spawn 3 rocket example ships near the station.
The next step i think will be to change the fragment shader to the normal map one that uses the Function to calculate lighting and re-post the oxp

How do you want to do the engine glows for your ship MiMoriarty, the current method is to just use the red and blue channels in a texture map recolour them orange and cyan in the shader and mix them into the texture - you don't have to do it this way - a simpler method would just be to paint out your final engine glow as a standard texture and add this onto the ship without having to mess around with single colour channels etc
here's a post where i seem to be trying to explain the single channel effects texture painting method
http://www.aegidian.org/bb/viewtopic.ph ... &start=285

_________________
Wiki homepage for my OXP: http://wiki.alioth.net/index.php/Griff_Industries


Top
   
 Post subject: Re: Shaders’ Outpost
PostPosted: Fri Jan 20, 2012 10:07 am 
Offline
Competent
Competent
User avatar

Joined: Mon Nov 14, 2011 1:03 pm
Posts: 39
Location: Madrid, España
Quote:
Seems to be a bit quiet at work so i had a quick look at the oxp, well, what a balst from the past! i grabbed the "Griff Rocket Shader Test - Engine Level Lights.zip file" from http://www.box.com/shared/h95rd0n25x (listed as Griff Rocket Example 2 in the first post of this thread), if you change the shipdata.plist to this
Code:
{
// ++++++ Griff Rocket Example ++++++
"griff_rocket" =
{
like_ship = "cobra3-trader";
exhaust = ("0 0 -49.0 10.0 10.0 25.0");
model = "griff_rocket.dat";
name = "Griff Rocket";
roles = "griff_rocket";
smooth = true;
shaders =
{
"griff_rocket_unshaded_diffuse.png" =
{
vertex_shader = "ahruman-generic.vertex";
fragment_shader = "griff_rocket.fragment";
textures =
(
"griff_rocket_shaded_diffuse.png",
"griff_rocket_enginelevel_glowmap.png",
"griff_rocket_effects.png"
);
uniforms =
{
tex0 = { type = texture; value = 0; };
tex1 = { type = texture; value = 1; };
tex2 = { type = texture; value = 2; };
time = "universalTime";
engine_level = "speedFactor";
hull_heat_level = "hullHeatLevel";
laser_heat_level = "laserHeatLevel";
};
};
};
};
}

(Sorry, i had to change it from XML to Openstep format - i could't remember how to do the XML code)
and also change the script.js file in the Config folder to this:
Code:
// Configuration -- customize here
this.role = "griff_rocket";
this.count = 3;

// Standard attributes
this.name = "Spawn-" + this.role;
this.author = "Jens Ayton";
this.copyright = "This script is hereby placed in the public domain.";
this.version = "1.0.1";
this.description = "Script to make several ships of a given role appear at the witchpoint after every jump."


this.shipWillLaunchFromStation = function()
{
system.legacy_addSystemShips(this.role, this.count, 1.0);
log("testscript.spawn", "Generated " + this.count + " " + this.role + " for testing purposes.");
}

it should get the oxp working again, although it still used the macro lighting code that we shouldn't be using!
When you launch the ammended script.js will spawn 3 rocket example ships near the station.
The next step i think will be to change the fragment shader to the normal map one that uses the Function to calculate lighting and re-post the oxp

How do you want to do the engine glows for your ship MiMoriarty, the current method is to just use the red and blue channels in a texture map recolour them orange and cyan in the shader and mix them into the texture - you don't have to do it this way - a simpler method would just be to paint out your final engine glow as a standard texture and add this onto the ship without having to mess around with single colour channels etc
here's a post where i seem to be trying to explain the single channel effects texture painting method
viewtopic.php?f=4&t=3460&start=285
Many thanks, Griff. I'm in the office too and some kind of busy now. I'll give it a try this evening.

_________________
There is an art, it says, or rather, a knack to flying. The knack lies in learning how to throw yourself at the ground and miss. … Clearly, it is this second part, the missing, which presents the difficulties.
Blog http://mimoriarty.wordpress.com/


Top
   
 Post subject: Re: Shaders’ Outpost
PostPosted: Fri Jan 20, 2012 3:44 pm 
Offline
Grand Admiral Emeritus
Grand Admiral Emeritus
User avatar

Joined: Sat Apr 02, 2005 2:43 pm
Posts: 6657
Location: Sweden
I’ve made a simplified version of the Griff Adder shader. It does everything the original does except decals, but with less and better-organized code, and lots of comments. It also does away with obsolete stuff like trying to deal with two light sources.

It doesn’t include the model or textures, so the Griff Adder or all-in-one OXP must be installed for it to be usable in-game.

_________________
E-mail: jens@oolite.org


Top
   
 Post subject: Re: Shaders’ Outpost
PostPosted: Fri Jan 20, 2012 5:37 pm 
Offline
Thargoid
Thargoid
User avatar

Joined: Thu Jun 12, 2008 6:55 pm
Posts: 5509
The shaders in Vortex OXP does simply the engine glow and a heat effect on the whole ship. It may be a simpler example than Griffs, as I stripped things right back to only those two items.

The colormap there is the texture (the diffuse map used by the main model) and the emission map is basically just the engine glow.

_________________
My OXPs via Boxspace or from my Wiki pages :D.

Thargoid TV
Dropbox Referral Link


Top
   
 Post subject: Re: Shaders’ Outpost
PostPosted: Mon Jan 23, 2012 1:08 pm 
Offline
Competent
Competent
User avatar

Joined: Mon Nov 14, 2011 1:03 pm
Posts: 39
Location: Madrid, España
Many Thankx, Ahruman, Thargoid and Griff.

I took the vortex.oxp's shaders and they worked pretty well in the engines of my OXP. Now that it works i'd start learning how IT really WORKS using Ahruman and Griff's code and try to make it on my own shaders for other effect.

_________________
There is an art, it says, or rather, a knack to flying. The knack lies in learning how to throw yourself at the ground and miss. … Clearly, it is this second part, the missing, which presents the difficulties.
Blog http://mimoriarty.wordpress.com/


Top
   
 Post subject: Re: Shaders’ Outpost
PostPosted: Mon Jan 23, 2012 1:51 pm 
Offline
Oolite 2 Art Director
Oolite 2 Art Director
User avatar

Joined: Fri Jul 14, 2006 12:29 pm
Posts: 2263
Location: Wales
Quote:
...Now that it works i'd start learning how IT really WORKS using Ahruman and Griff's code and try to make it on my own shaders for other effect.
It's best to use Ahruman's shaders to study as all the ones in my shipsets are just badly cobbled together versions of his originals. :D
The Adder shader Ahruman posted a few posts up is stuffed full of comments explaining what's going on in the code.
Shader .vertex and .fragment files can be opened and edited in a text editor program, some sort of shader development program can really help too - they're really handy for previewing your work without having to launch Oolite and finding your ship - if you're on a Windows PC, AMD have a really cool free program called Rendermonkey and i think there's something available for free from Apple if you're on a Mac (might be part of some sort of development suite of programs)

_________________
Wiki homepage for my OXP: http://wiki.alioth.net/index.php/Griff_Industries


Top
   
 Post subject: Re: Shaders’ Outpost
PostPosted: Mon Jan 23, 2012 3:19 pm 
Offline
Competent
Competent
User avatar

Joined: Mon Nov 14, 2011 1:03 pm
Posts: 39
Location: Madrid, España
Quote:
if you're on a Windows PC, AMD have a really cool free program called Rendermonkey and i think there's something available for free from Apple if you're on a Mac (might be part of some sort of development suite of programs)
No, I don`t :lol: . I will try with XCODE's OpenGL Shader Builder. It's the only one i've found.

_________________
There is an art, it says, or rather, a knack to flying. The knack lies in learning how to throw yourself at the ground and miss. … Clearly, it is this second part, the missing, which presents the difficulties.
Blog http://mimoriarty.wordpress.com/


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 411 posts ]  Go to page Previous 122 23 24 25 2628 Next

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 17 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