Page 11 of 15
Posted: Tue Mar 02, 2010 8:49 pm
by Thargoid
You don't need to specify a model in the like_ship if there is one in the original template (the ship that the like_ship refers to) for the new one to inherit. All you need is a role, but then if it didn't have that it would be rather pointless to do the exercise.
Posted: Tue Mar 02, 2010 10:34 pm
by Scarecrow
Blimey! Brain hurting!
Thanks everyone. Lots to think about. I'll come back to this in the morning.
Crow
Posted: Wed Mar 03, 2010 7:07 am
by Thargoid
Basically all like_ship does is takes the keys from the template ship (the one the like_ship key points to) and applies them to the ship in question (the one with the like_ship key in its shipdata). Then any other keys in that shipdata are applied, which can either add to or overwrite the ones from the like_ship.
It's a quick way of making very similar ships without having to write a lot of identical shipdata multiple times.
Posted: Wed Mar 03, 2010 9:31 am
by Scarecrow
Okay, it sounds as if Like_Ship will be handy. thanks.
Right then. Let's start off with something simple.
Before I get mired in shaders, I'll try and set up a simple material from the Shipdata.Plist first.
I had a read through the wiki which lists the commands and tells you what they're for, but doesn't really explain how to use them.
I've taken a stab in the dark and written this out as part of the viper data in the Plist:
Code: Select all
materials =
{
vertex_shader="oolite-default-shader.fragment";
fragment_shader="oolite-tangent-space-vertex.vertex";
diffuse_map="seraphim.png";
normal_map="seraphim_n.bmp";
};
Once I'd remembered to put a colon after the last bracket, the Seraphim showed up again, but doesn't seem to be using anything resembling a shader.
I tried removing the shader lines. I tried adding a specular map. Neither made any difference.
I am starting Oolite with the shift key to make sure it clears.
What am I doing wrong?
Crow
Posted: Wed Mar 03, 2010 9:52 am
by Scarecrow
Okay, following the example in Asteroid Storm I've set the materials up like this: I've had to convert from XML to Open Step but as far as I can see, I think this is right.
Code: Select all
materials =
{
diffuse_map="seraphim.png";
normal_map="seraphim_n.bmp";
specular_map="seraphim_s.bmp";
shininess=30;
};
Still no difference.
Crow
Posted: Wed Mar 03, 2010 9:52 am
by another_commander
When you have situations where changes involving shaders don't seem to work or produce a completely shaderless result, always have a look at the Latest.log. You will very likely have shader compilation errors which could contain hints and/or the actual line number in the shader where the errors occured.
From just a quick look, it seems that you have cross-set the vertex and fragment shaders. Also, I don't think you should be really invoking the default Oolite shaders there. I believe they are used internally whenever shaders are enabled.
Posted: Wed Mar 03, 2010 10:01 am
by Scarecrow
Okay, thanks. As I say, following the Asteroid Storm example, I've removed the references to the shaders. However this still makes no difference.
I've checked the latest.log and can't see anything obvious. I can't see the words 'error' or 'fail' anywhere. What should I be looking for?
As an aside, I'm checking the ships in the front end, where it cycles through all the ship types in the game. I'm assuming that the shaders would be working in this part of the game?
Crow
Posted: Wed Mar 03, 2010 10:17 am
by Scarecrow
I'm running 1.73.4 - I don't need to do something silly like edit a config file to enable shaders and materials do I?
Crow
Posted: Wed Mar 03, 2010 10:24 am
by Commander McLane
Just to point out the painfully obvious:
Are you restarting Oolite while holding down the SHIFT-key?
All shipdata-information are stored in Oolite's cache and not reloaded when you simply quit and restart the game. Oolite recognizes that something has changed only if you install or de-install a complete OXP, in which case it will trash its cache and build another one on game start, incorporating the changes.
However, if you only edit something within a OXP (and save your changes, of course), Oolite will continue to use the old version from its cache on game start, unless you flush the cache manually, which is achieved by pressing SHIFT as soon as you have clicked the icon, and hold it until you see "Loading shipdata..." on your screen.
Posted: Wed Mar 03, 2010 10:32 am
by Scarecrow
Yes, I am.
Also, I put in Griff's Krait and that's working perfectly in the front end, so I know shaders are implemented and working.
Crow
Posted: Wed Mar 03, 2010 10:50 am
by another_commander
Your earlier definition of material seems wrong to me. Taken straight out of Oolite's internal shipdata, here is how materials are defined (example for barrel):
Code: Select all
materials =
{
"barrel_metal.png" =
{
shininess = 10;
specular = ( 0.3, 0.3, 0.33, 1.0 );
};
"left_metal.png" =
{
shininess = 10;
specular = ( 0.3, 0.3, 0.33, 1.0 );
};
};
"materials" is a dictionary containing dictionaries.
Posted: Wed Mar 03, 2010 11:21 am
by Scarecrow
That doesn't seem to be the case on the Asteroids which are set out like this:
Code: Select all
<dict>
<key>astorm01.png</key>
<dict>
<key>normal_map</key>
<string>astorm01_normal.png</string>
<key>specular_map</key>
<string>astorm_specular.png</string>
<key>shininess</key>
<string>30</string>
</dict>
</dict>
Crow
Posted: Wed Mar 03, 2010 11:33 am
by Griff
i'm not sure, but how about writing out the specular_map like this?
specular_map = {name = "seraphim_s.bmp"; shininess = 30.0;}
edit: this is massive wrongness!
Also, is oolite happy using bmp's for textures, don't they have to be png's? i'm not sure about this either though, just guessing really.
If you'd much prefer to just concentrate on the art i can whip up a shader for you that would just use a diffuse, normal & specular map with the specular intensity tweakable using an uniform in the shipdata.plist, although it is fun sometimes getting these things working on your own
Posted: Wed Mar 03, 2010 11:35 am
by Eric Walch
Scarecrow wrote:That doesn't seem to be the case on the Asteroids which are set out like this:
It is the same as in asteroid storm. The first key is the name of the texture file used in your mod file. Within that key the effect maps are defined. So stick to the example of another_commander. Or look in the dredgers2.4.oxp. There I wrote the materials directory with speculars and normal maps all in open step.
(Asteroid storm has xml definitions to keep it compatible with old 1.65 Oolite)
Posted: Wed Mar 03, 2010 12:19 pm
by Scarecrow
Once again, thanks everyone. Griff, that is awfullytempting, but I think I would like to figure this out. If something works, I prefer to understand why
Okay, so now I've written it out like this:
Code: Select all
materials =
{
"seraphim.png" = {shininess=30;
normal_map="seraphim_n.png";
specular_map="seraphim_s.png";
};
};
And the Seraphim has stopped showing up, which usually means it's found something it doesn't like.
The log gave me this:
Code: Select all
[plist.parse.foundation.failed]: Failed to parse ../AddOns/seraphim.oxp/Config/shipdata.plist as a property list using Foundation. Retrying using homebrew parser. WARNING: the homebrew parser is deprecated and will be removed in a future version of Oolite.
Parse failed at line 52 (char 1657) - extra data after parsed string
[plist.homebrew.parseError]: Property list isn't in XML format, homebrew parser can't help you.
The line it's talking about is in a section directly after the materials which works normally usually, so I'm assuming that the problem is with the materials code. I can't see any missing colons though, and it's got the right number of brackets etc.
Crow