Progress

General discussion for players of Oolite.

Moderators: winston, another_commander

User avatar
snork
---- E L I T E ----
---- E L I T E ----
Posts: 551
Joined: Sat Jan 30, 2010 4:21 am
Location: northern Germany

Post 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.
User avatar
Killer Wolf
---- E L I T E ----
---- E L I T E ----
Posts: 2279
Joined: Tue Jan 02, 2007 12:38 pm

Post by Killer Wolf »

what version do we need to start playing w/ the HUDs etc? is it just the trnk thing at the mo?
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6683
Joined: Wed Feb 28, 2007 7:54 am

Post 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.
User avatar
Killer Wolf
---- E L I T E ----
---- E L I T E ----
Posts: 2279
Joined: Tue Jan 02, 2007 12:38 pm

Post by Killer Wolf »

cheers
how far's it off being a proper release?
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post 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)
Last edited by JensAyton on Mon Apr 05, 2010 2:34 pm, edited 1 time in total.
User avatar
DaddyHoggy
Intergalactic Spam Assassin
Intergalactic Spam Assassin
Posts: 8515
Joined: Tue Dec 05, 2006 9:43 pm
Location: Newbury, UK
Contact:

Post by DaddyHoggy »

Fantastic Ahruman - it's just getting better and better!
Selezen wrote:
Apparently I was having a DaddyHoggy moment.
Oolite Life is now revealed here
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post 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.
Last edited by JensAyton on Sun Apr 04, 2010 11:19 pm, edited 1 time in total.
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post 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.
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post 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.)
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

As of r2123, cube maps are supported in the default shader (for diffuse_map only).
User avatar
Killer Wolf
---- E L I T E ----
---- E L I T E ----
Posts: 2279
Joined: Tue Jan 02, 2007 12:38 pm

Post 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 :-/
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6683
Joined: Wed Feb 28, 2007 7:54 am

Post 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.
User avatar
Griff
Oolite 2 Art Director
Oolite 2 Art Director
Posts: 2483
Joined: Fri Jul 14, 2006 12:29 pm
Location: Probably hugging his Air Fryer

Post 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
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post 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.
User avatar
Killer Wolf
---- E L I T E ----
---- E L I T E ----
Posts: 2279
Joined: Tue Jan 02, 2007 12:38 pm

Post by Killer Wolf »

far too late for that.
got the 3131 trunk and it's working now tho.
Post Reply