Page 38 of 139

Posted: Tue Mar 23, 2010 8:40 pm
by snork
I am seeing scripts where trumbles (or flies, see Pirx adventures) by nesting cause short circuits inside docking computers and then it gets interesting. :D

It is really a pleasure to see how much Oolite is really developped and extended. all the time.

Posted: Wed Mar 24, 2010 12:37 pm
by Killer Wolf
what version do we need to start playing w/ the HUDs etc? is it just the trnk thing at the mo?

Posted: Wed Mar 24, 2010 12:59 pm
by another_commander
Killer Wolf wrote:
what version do we need to start playing w/ the HUDs etc? is it just the trnk thing at the mo?
Yes, all this new stuff is contained in the latest trunk builds, available from the nightly builds pages' downloads.

Posted: Wed Mar 24, 2010 3:33 pm
by Killer Wolf
cheers
how far's it off being a proper release?

Posted: Sun Apr 04, 2010 11:01 pm
by JensAyton
As of r3121, Oolite supports cube map textures.

A cube map texture consists of six images, representing the sides of a cube. Instead of associating colours with 2D points on a plane, it associates colours with 3D vectors from the centre of the cube. As such, it has a colour for every possible direction.

There are two major uses for cube map textures:
  • Mapping textures onto roughly spherical shapes, such as planets or asteroids. At some point, this will be supported for planets in Oolite.
  • Representing the environment, for reflection and refraction effects. Griff has already experimented with fake reflections using normal textures; cube maps can help do it better.
For the first case, cube maps can be used for diffuse maps in non-shader mode, in which case vertex normals are used as texture coordinates. The model must be smooth (or use explicit vertices) for this to be even vaguely useful.

Cube maps can also be used for any texture in a custom shader. However, they are currently not supported in the default shader, so any model using a cube map for the diffuse map must also have a custom shader.

In a shader, a cube map is used much like a 2D texture, except:
  • The sampler must be of type samplerCube instead of sampler2D.
  • The texture lookup is done with the function textureCube() instead of texture2D().
  • The texture coordinates must be a vec3 instead of a vec2.
Here is a minimal cube mapping fragment shader, once again using normals as texture coordinates:

Code: Select all

varying vec3            vNormal;
uniform samplerCube     uCubeMap;

void main()
{
    gl_FragColor = textureCube(uCubeMap, vNormal);
}
To specify a cube map in shipdata.plist, use the new cube_map boolean attribute:

Code: Select all

diffuse_map = { name = "ahruman_earth_cube_map.png"; cube_map = yes; };
In order for a texture to be loaded as a cube map, its height must be exactly six times its width (which should be a power of two). If it isn’t, it will be treated as a 2D texture, and your shader won’t work. The six faces are stacked on top of each other in the following order: +X, -X, +Y, -Y, +Z, -Z (see example).

Example OXP (requires trunk, dur)

Posted: Sun Apr 04, 2010 11:08 pm
by DaddyHoggy
Fantastic Ahruman - it's just getting better and better!

Posted: Sun Apr 04, 2010 11:09 pm
by JensAyton
Other stuff from this weekend:
  • Oolite will now complain about polygons with more (or less) than three sides, instead of just ignoring all but the first three vertices (and potentially crashing if there were more than 16).
  • Debris models are once again resized randomly.
  • Dictionary-form texture specifiers are now supported in diffuse_map, etc. in shader mode. (Previously the code erroneously required them to be strings, and dropped them if they weren’t.)
  • (As mentioned elsewhere) Colours that are considered insufficiently bright for lasers now get the right hue when brightened.
  • (As mentioned elsewhere, Mac-specific) No longer freeze when attempting to control iTunes while it’s showing a modal dialog.

Posted: Sun Apr 04, 2010 11:17 pm
by JensAyton
Oh, I forgot something: there is currently no graceful fallback for cube maps on systems that don’t support them; they will simply be loaded as 2D textures. This only affects the non-shader case, since cube maps are a requirement for GLSL support. My intended fix for this is to convert the texture to a lat/long map, and provide a python script to generate appropriate texture coordinates.

Posted: Mon Apr 05, 2010 12:28 pm
by JensAyton
Because of Oolite’s whacky coordinate system, the texture in the example was mirrored. Flipping the coordinates about when converting the model isn’t helpful in this case, so I’ve updated the example. (To flip a cube map, flip the entire image horizontally, then swap the +X and -X parts.)

Posted: Mon Apr 05, 2010 2:33 pm
by JensAyton
As of r2123, cube maps are supported in the default shader (for diffuse_map only).

Posted: Tue Apr 06, 2010 7:30 am
by Killer Wolf
i dumped that cube map test into my trunk but it's not working for me. I used a script to spawn a couple of them on exit from the station. they were on the scanner but i couldn't see anything visually, although my missile manage to lock onto one :-/

Posted: Tue Apr 06, 2010 7:34 am
by another_commander
Killer Wolf wrote:
i dumped that cube map test into my trunk but it's not working for me. I used a script to spawn a couple of them on exit from the station. they were on the scanner but i couldn't see anything visually, although my missile manage to lock onto one :-/
I had no problems with the cubemap test. I could see an asteroid with the world map wrapped seamlessly around it.

Posted: Tue Apr 06, 2010 9:38 am
by Griff
they worked OK for me too, pc spec: windows, nvidia graphics card.
There's a 'carpaint' example shader in Rendermonkey's advanced examples that uses a cubemap for environment mapping, i'll have a go at transplanting the necessary bits into an oolite shader unless somebody beats me to it

Posted: Wed Apr 07, 2010 8:53 pm
by JensAyton
Killer Wolf wrote:
i dumped that cube map test into my trunk but it's not working for me. I used a script to spawn a couple of them on exit from the station. they were on the scanner but i couldn't see anything visually, although my missile manage to lock onto one :-/
Please paste the [rendering.opengl.extensions] report from your log.

Posted: Thu Apr 08, 2010 6:28 am
by Killer Wolf
far too late for that.
got the 3131 trunk and it's working now tho.