Posted: Tue Mar 02, 2010 3:07 pm
If -nosplash doesn't work, then it's likely that you will need a driver update to fix it.
For information and discussion about Oolite.
https://bb.oolite.space/
Code: Select all
// Information from Oolite.
uniform sampler2D tex0; // Difuse map
uniform sampler2D tex1; // Glow map (always on)
uniform sampler2D tex2; // effects map
Code: Select all
<key>shaders</key>
<dict>
<key>griff_rocket_unshaded_diffuse.png</key>
<dict>
<key>textures</key>
<array>
<string>griff_rocket_shaded_diffuse.png</string>
<string>griff_rocket_permaglowmap.png</string>
<string>griff_rocket_effects.png</string>
</array>
<key>vertex_shader</key>
<string>ahruman-generic.vertex</string>
<key>fragment_shader</key>
<string>griff_rocket.fragment</string>
</dict>
</dict>
</dict>
Code: Select all
<key>griff_rocket_unshaded_diffuse.png</key>
The original files (eg. Ahruman's examples from which I think Griff based most of his original work) were in XML as you have indicated - the newer codes are in OpenStep - I think somebody has written a converter to go from one to the other - I think it was done for Lestradae when he was porting OXPs across to O(S)E.Scarecrow wrote:Okay, let's start at the beginning.
I'm looking at Griff's rocket example. The first section in the Fragment file is this:
It appears to be assigning the various textures to variable slots, but I couldn't figure out how. How does it know, for example that tex0 is the Diffuse map? I noticed that the line at the top says, 'information from oolite' so I guessed that maybe the textures are set up in the ship's config file.Code: Select all
// Information from Oolite. uniform sampler2D tex0; // Difuse map uniform sampler2D tex1; // Glow map (always on) uniform sampler2D tex2; // effects map
I jumped over to the Rocket's Plist and sure enough, there's a shader setup:
It does appear to be listing the three textures used in the shader and in the order that they are listed in the Fragment file. I assume that this is true: That if the diffuse texture is listed first then it will automatically become tex0 in the Fragment file?Code: Select all
<key>shaders</key> <dict> <key>griff_rocket_unshaded_diffuse.png</key> <dict> <key>textures</key> <array> <string>griff_rocket_shaded_diffuse.png</string> <string>griff_rocket_permaglowmap.png</string> <string>griff_rocket_effects.png</string> </array> <key>vertex_shader</key> <string>ahruman-generic.vertex</string> <key>fragment_shader</key> <string>griff_rocket.fragment</string> </dict> </dict> </dict>
The other big stumbling block is that this code is in HTML and I've no idea what this code should look like in script which is what the rest of my Plist is written in.
Comments? Answers? yes? no?
Crow
I think this is possible, you'd write out one subentity object in the shipdata.plist with all its shader definitions, then for all the other subentites you'd just like_ship = "the original subentity"; them all and they will inherity the original subentitys stats and shader settings without you having to write them all out.Scarecrow wrote:Okay, so it appears that I need to set up shaders for each and every sub object too.
As I'll be using the same textures for all parts of the ship, is it possible to set the shader up just once in the Shipdata.Plist file and if so, where would I put it?
Code: Select all
shaders =
{
"griff_boa_mainhull.png" =
{
vertex_shader = "ahruman-generic.vertex";
fragment_shader = "Griff_Boa_Mainhull_g_channel_decals.fragment";
textures = ("griff_boa_mainhull.png", "griff_boa_engines_effects.png", "griff_boa_engines_diffuse.png", {name = "griff_decals_set1.png"; repeat_s = "yes";});
uniforms =
{
uTime = "universalTime";
nearly_dead = "throwingSparks";
hull_heat_level = "hullHeatLevel";
engine_power = "speedFactor";
blinkrate = { type = "float"; value = 0.8; };
PaintColor = { type = vector; value = "0.0 0.0 0.0"; };
DecalColor = { type = vector; value = "1.0 0.9794 0.4736"; };
uDecalSelect = { type = "float"; value = 0.95; };
};
};
};
Oh. Actually that looks much more like the sort of thing I'm after. I might try playing with that first. I'd definately like to learn to use shaders properly though. We use them a lot in work and it's something I need to really understand properly.Griff wrote:Have a look at this page too: http://wiki.alioth.net/index.php/Materials_in_Oolite you can use materials to provide texture for Oolites built in shaders, then you don't have to worry about creating vertex & fragment shaders, your ship will use the built in oolite ones.
I'm not sure which oxp's use materials so i can't link you to any examples at the moment, hopefully somebody will pass by with some links
I have never used the shader directory, but I think uniforms are essential. The uniforms are the things that make the texture dynamical based on ship properties. (e.g. engine glow, based on the ships speed) When you just want static textures, you can just as well use the materials directory. See wiki-materials.Scarecrow wrote:I'm used to Material editors in 3D programs that give me slots. All I need to do is tell it which diffuse texture to use, which normal map texture to use, which specular texture (or value) to use. Sadly, it doesn't seem that simple in Oolite
....
Finally, Uniforms appear to be entirely optional, will default if not specified here and not something I need to worry about right now.
Cool. Can you link me, a search threw up nothing obvious.Eric Walch wrote:See for instance the latest asteroids.oxp were specular and normal maps are only added by the material directory.
I used the wrong name. I mend asteroid storm.oxp not asteroidsScarecrow wrote:Cool. Can you link me, a search threw up nothing obvious.
This is correct: tex0, tex1 etc. correspond to the ordering in the textures array.Scarecrow wrote:It does appear to be listing the three textures used in the shader and in the order that they are listed in the Fragment file. I assume that this is true: That if the diffuse texture is listed first then it will automatically become tex0 in the Fragment file?
Code: Select all
uniforms =
{
uDiffuseMap = { type = texture; value = 0; };
uPermaGlowMap = { type = texture; value = 1; };
uRocketEffectsMap = { type = texture; value = 2; };
};
This is the material key, which is used to distinguish between multiple materials in the DAT file. Usually this is the name of a texture, but it doesn’t have to be. If there is no shaders or materials entry for a given material key, it’s treated as a diffuse map texture name (as explained in Materials in Oolite).Scarecrow wrote:Also, what's this line for:Code: Select all
<key>griff_rocket_unshaded_diffuse.png</key>
Code: Select all
materials =
{
"griff_rocket_unshaded_diffuse.png" =
{
diffuse_map = "griff_rocket_unshaded_diffuse.png";
};
};
yep, it's a shipdata.plist commandScarecrow wrote:Also, is 'Like_Ship' an actual command or are you just using a stand-in?
Code: Select all
"wreckage-component" =
{
ai_type = "nullAI.plist";
cargo_type = "CARGO_NOT_CARGO";
energy_recharge_rate = 0;
forward_weapon_type = "WEAPON_NONE";
fragment_chance = 0.2;
max_energy = 2000;
max_flight_pitch = 2;
max_flight_roll = 2;
max_flight_speed = 500;
model = "wreck1.dat";
name = "Wreckage";
roles = "wreckage oolite-wreckage-component";
scanClass = "CLASS_CARGO";
thrust = 0;
};
"more-wreckage2" =
{
like_ship = "wreckage-component";
model = "wreck2.dat";
roles = "wreckage oolite-more-wreckage2";
};