Skinner’s Den

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

Moderators: winston, another_commander

Post Reply
Big Bene
Above Average
Above Average
Posts: 19
Joined: Tue Mar 15, 2011 11:49 am
Location: Edenkoben / Germany
Contact:

Re: Skinner’s Den

Post by Big Bene »

Big Daddy wrote:
If you look at the shady billboard oxp and shady thargoid oxps that Ahruman created you can see how "animated" textures work (Griff's done an amazing job on the YAH constores - so that would be another good example to see how the shader fragment works)
Ok, I'll have a look.
Big Daddy wrote:
I think you can switch textures inside an oxp for a ship using the materials setting
That's not what I intended in in my question. I wanted to know if I can use different pngs for different polygones of the same entity. But still, interesting information.
Pumpkinhead wrote:
You can't use more than one texture per ship
Now, that puts an answer to this.
evil Mantis from outer space wrote:
one texture per ship isn't completely always true - if the ship has sub-entities they will have their own individual textures distinct from the mother entity's
And this may be a solution...
Pumpkinhead wrote:

Code: Select all

"adder" =
   {
...
...
   };
Thanks, will give it a read-through.
evil Mantis from outer space wrote:
My Butterflies OXP might give you a taster both of physical animation
That's another topic, of course, but still very interesting!
evil Mantis from outer space wrote:
That can be used to simulate animation without shaders
So I assume true animation is possible with shaders?
evil Mantis from outer space wrote:
The other way for true animation is the already mentioned shader option (as championed by Griff and Ahruman) with several fine examples already mentioned.
Ah, yes.

So it all boils down to shaders for true animation.
But how to?
Guess I'll have to read through Griff's and Ahriman's OXPs. That's quite a reading...
:roll:

Thanks, guys. This really is the most helpful forum this side of Tionisla.
User avatar
Killer Wolf
---- E L I T E ----
---- E L I T E ----
Posts: 2278
Joined: Tue Jan 02, 2007 12:38 pm

Re: Skinner’s Den

Post by Killer Wolf »

think you can have multiple textures for a ship, you just need to set it up in your modeller to assign the different polys to the different maps
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Re: Skinner’s Den

Post by Eric Walch »

Big Bene wrote:
...... I wanted to know if I can use different pngs for different polygones of the same entity. But still, interesting information.
Pumpkinhead wrote:
You can't use more than one texture per ship
Now, that puts an answer to this.
It is an answer, but not a correct one. When you look inside Oolite itself you will already find ships using more than one texture.
e.g. a simple object like the barrel uses both "barrel_metal.png" and "left_metal.png".
User avatar
Ironfist
Commander
Commander
Posts: 218
Joined: Tue Jun 28, 2011 2:16 pm
Location: London

Re: Skinner’s Den

Post by Ironfist »

Guys,
Just to confirm you can have more than 1 texture, here is a piece of the dat file of a ship I am currently working on.

cockpit_mat.png 1.0 1.0 0.93426 0.43684 0.93445 0.49746 0.96655 0.49746
cockpit_mat.png 1.0 1.0 0.93426 0.43684 0.96655 0.49746 0.96682 0.43684
draven_gunship_mat.png 1.0 1.0 0.66213 1.00000 0.69482 0.96509 0.65662 0.75167
draven_gunship_mat.png 1.0 1.0 0.66213 1.00000 0.65662 0.75167 0.64386 0.75167

The file names are directly from the material names in the wings3d file, although you could easily edit the dat file with a good text editor if you needed to.
This dat file was generated in the usual way exported in obj format then converted with Obj2DatTex.py.

Hope this helps
Ironfist
64bit Mint 10 and Win 8 64bit on E8400 at 3.6GHz - ATI HD5750 graphics.
Concentration is the ability to think of absolutely nothing when it is absolutely necessary.
User avatar
Smivs
Retired Assassin
Retired Assassin
Posts: 8408
Joined: Tue Feb 09, 2010 11:31 am
Location: Lost in space
Contact:

Re: Skinner’s Den

Post by Smivs »

OK, so I was talking in simplistic terms.
You can apply more than one texture to a model if the various faces have different diffuse maps specified in the model (.dat) file, and as has been pointed out several core ships use this. The rock hermit actually uses several for example.
What I meant (again in simple terms) was that you cannot apply more than one 'skin' to a specific ship other than by creating a 'like_ship' and specifying the alternative texture in shipdata (although this can be changed 'on the hoof' using the materials attribute in js).
For example if you look in the Textures folder for the core ships you will see 2 different textures for the Cobra Mk3, called cobra3_redux.png and cobra3_redux1.png. These are used for different varieties of the Mk3, and only one of these skins can be applied to the model at any given time. What you can't do is take the same variety of Cobra3, say the 'trader', and sometimes apply one skin and other times apply the other skin.
The 'trader' gets cobra3_redux.png every time, because that is the diffuse_map specified in the model (.dat file). If you want to use the other skin, like the Cobra3-alternate does, then this has to be specified in the 'materials' section of shipdata, thus

Code: Select all

"cobra3-alternate" =
	{
		like_ship = "cobra3-trader";
		energy_recharge_rate = 3;
		has_ecm = 0.95;
		max_cargo = 35;
		max_energy = 250;
		max_flight_speed = 320;
		materials =
		{
			"cobra3_redux.png" = { diffuse_map = "cobra3_redux1.png"; };
		};
		roles = "hunter pirate trader hermit-ship sunskim-trader cobra3-alternate";
		thrust = 32;
		weapon_energy = 15;
	};
which the sharp-eyed amongst you will notice is essentially the same as the Adder example from my shipset I gave earlier.
So if you want three or four different types of any particular ship, you can't just somehow apply a 'random' texture from a list to it, you have to have each variety detailed in shipdata, and like_ship is the easiest way to do this.
Commander Smivs, the friendliest Gourd this side of Riedquat.
User avatar
CaptSolo
---- E L I T E ----
---- E L I T E ----
Posts: 909
Joined: Wed Feb 23, 2011 10:08 pm
Location: Preying Manta
Contact:

Re: Skinner’s Den

Post by CaptSolo »

I have a question for Griff or SimonB: How do you produce your effects maps? Most of the original diffuse texture is now green.

edit: hmmm okay, later that day the idiot (me) stumbles upon SimonB's excellent tutorial and saves a copy to his intelligent computing device (looking skyward mumbling). Now off to see if I can replicate somewhat similar results.
User avatar
CaptSolo
---- E L I T E ----
---- E L I T E ----
Posts: 909
Joined: Wed Feb 23, 2011 10:08 pm
Location: Preying Manta
Contact:

Re: Skinner’s Den

Post by CaptSolo »

Am I missing something or do I require better hardware? I have GIMP for Windows version 2.6.11 and do not seem to have a "mode" menu under "Layers". Trying to follow SimonB's tutorial on making an effects map from the diffuse texture. Got as far as duplicate layer, desaturate top layer etc., but could not proceed past the point where I am supposed to change the layer mode to "addition".
User avatar
Smivs
Retired Assassin
Retired Assassin
Posts: 8408
Joined: Tue Feb 09, 2010 11:31 am
Location: Lost in space
Contact:

Re: Skinner’s Den

Post by Smivs »

Hi Solo,
This is in the layers dialogue box (Cont-L) not the layers drop-down from the main bar.

Image
Commander Smivs, the friendliest Gourd this side of Riedquat.
User avatar
CaptSolo
---- E L I T E ----
---- E L I T E ----
Posts: 909
Joined: Wed Feb 23, 2011 10:08 pm
Location: Preying Manta
Contact:

Re: Skinner’s Den

Post by CaptSolo »

Thanks Smivs. I never knew about this command. Opens a whole new world of possibilities.
User avatar
Smivs
Retired Assassin
Retired Assassin
Posts: 8408
Joined: Tue Feb 09, 2010 11:31 am
Location: Lost in space
Contact:

Re: Skinner’s Den

Post by Smivs »

CaptSolo wrote:
Thanks Smivs. I never knew about this command. Opens a whole new world of possibilities.
You wouldn't believe it. Enjoy! :)
Commander Smivs, the friendliest Gourd this side of Riedquat.
User avatar
Smivs
Retired Assassin
Retired Assassin
Posts: 8408
Joined: Tue Feb 09, 2010 11:31 am
Location: Lost in space
Contact:

Re: Skinner’s Den

Post by Smivs »

When using the 'setMaterials' js method you can switch a ship's texture 'on the fly'. What I would like to do though is switch texture A to texture B, but keep the same emission_map, and I don't know how to do this. Currently texture B is displaying, but without the emission_map.
I've tried several things, such as trying to 'set' the emission_map using the 'setMaterials' command, and have also tried various ways of specifying both texture/emission_map combinations in shipdata, but with no success.
Can this be done, and if so, how?
Commander Smivs, the friendliest Gourd this side of Riedquat.
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Re: Skinner’s Den

Post by JensAyton »

Smivs wrote:
When using the 'setMaterials' js method you can switch a ship's texture 'on the fly'. What I would like to do though is switch texture A to texture B, but keep the same emission_map, and I don't know how to do this. Currently texture B is displaying, but without the emission_map.
I've tried several things, such as trying to 'set' the emission_map using the 'setMaterials' command, and have also tried various ways of specifying both texture/emission_map combinations in shipdata, but with no success.
Can this be done, and if so, how?
Something like:

Code: Select all

ship.setMaterials(
    {
        "smivs_supership_base_texture.png":
        {
            diffuse_map: "smivs_supership_alt_texture.png",
            emission_map: "smivs_supership_emission_map.png"
        }
    });
User avatar
Smivs
Retired Assassin
Retired Assassin
Posts: 8408
Joined: Tue Feb 09, 2010 11:31 am
Location: Lost in space
Contact:

Re: Skinner’s Den

Post by Smivs »

Excellent...that works a treat. Many thanks :)
Commander Smivs, the friendliest Gourd this side of Riedquat.
User avatar
Smivs
Retired Assassin
Retired Assassin
Posts: 8408
Joined: Tue Feb 09, 2010 11:31 am
Location: Lost in space
Contact:

Re: Skinner’s Den

Post by Smivs »

I've hit an unexpected problem with this. It is working, but only for the 'main' ship. For example take the python. It works fine for "python" where the diffuse_map is switching nicely and the emission_map is remaining applied as intended. However if you use this for "python-trader" it doesn't work. Instead the texture is switching to the default python texture, and without the emission_map.
In other words if the ship in question is the main or base version (the one whose texture is specified in the .dat file) everything is fine, but if the ship in question is an alternative and has a different texture specified in the shipdata materials, things break down.
There is a connection here with the model file and the diffuse_map specified in the .dat file, and I have confirmed this with a bit of testing. In other words I can resolve the problem by using a seperate model for the individual varieties of these ships, but this seems a bit inelegant. Is there a better way of overcoming this problem?

Edit:- For now I've gone for the extra models option. :)
Commander Smivs, the friendliest Gourd this side of Riedquat.
User avatar
Capt. Murphy
Commodore
Commodore
Posts: 1127
Joined: Fri Feb 25, 2011 8:46 am
Location: UK South Coast.

Re: Skinner’s Den

Post by Capt. Murphy »

A question closely related to Smivs' above -- :wink:

I'm trying to make a generic ship script that will do texture switching for a whole set of Smivs ships.

I've got some texture names defined as script_info keys.

e.g.

Code: Select all

script = "smivs-generic-ship-script.js";
	 script_info = {
				smivs_texture = "smivs'-anaconda.png";
				smivs_diffuse = "smivs'-anaconda-damaged.png";
				smivs_emission = "smivs'-anaconda_em-map.png";
			  };  
The models normal diffuse texture is "smivs'-anaconda.png"

In the script I've got

Code: Select all

this.shipEnergyIsLow = function()
{
    var texture = this.ship.scriptInfo.smivs_texture; // uses scriptInfo key to build texture name
	var diffuse = this.ship.scriptInfo.smivs_diffuse; // uses scriptInfo key to build diffuse map name
	var emission = this.ship.scriptInfo.smivs_emission; // uses scriptInfo key to build emission map name
    this.ship.setMaterials({texture: {diffuse_map: diffuse, emission_map: emission}}); // sets textures
}
This isn't throwing any errors, but it's not doing what I expect it too. The diffuse still appears to be "smivs'-anaconda.png", whilst the emission_map is going completely. Am I being dense or is it problematic for setMaterials to deal with strings as variables?

Edit to add, I've also tried this with the same result:

Code: Select all

this.shipEnergyIsLow = function()
{
    var texture = this.ship.scriptInfo.smivs_texture.quote(); // uses scriptInfo key to build texture name
	var diffuse = this.ship.scriptInfo.smivs_diffuse.quote(); // uses scriptInfo key to build diffuse map name
	var emission = this.ship.scriptInfo.smivs_emission.quote(); // uses scriptInfo key to build emission map name
    this.ship.setMaterials({texture: {diffuse_map: diffuse, emission_map: emission}}); // sets textures
}
Edit to add, sussed it.... :D (with a little peek at Svengali's MaterialsFinder1.0)

This works...

Code: Select all

this.shipEnergyIsLow = function()
{
    var texture = this.ship.scriptInfo.smivs_texture; // uses scriptInfo key to build texture name
	var diffuse = this.ship.scriptInfo.smivs_diffuse; // uses scriptInfo key to build diffuse map name
	var emission = this.ship.scriptInfo.smivs_emission; // uses scriptInfo key to build emission map name
	var material = new Object();
	material[texture] = {diffuse_map:diffuse, emission_map: emission};
    this.ship.setMaterials(material); // sets textures
}
[EliteWiki] Capt. Murphy's OXPs
External JavaScript resources - W3Schools & Mozilla Developer Network
Win 7 64bit, Intel Core i5 with HD3000 (driver rev. 8.15.10.2696 - March 2012), Oolite 1.76.1
Post Reply