Ruining the classics (screenshot heavy thread)

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

Moderators: another_commander, winston

User avatar
Griff
Oolite 2 Art Director
Oolite 2 Art Director
Posts: 2476
Joined: Fri Jul 14, 2006 12:29 pm
Location: Probably hugging his Air Fryer

Post by Griff »

I've uploaded the glowing alloy oxp here (it's 274 Kb)
Edit: Link removed - i've updated the oxp, see below
it doesn't replace the standard alloy object but sometimes appears instead of one when a ship gets destroyed.

I might make some more versions of the alloy object for a bit of variety and i'll try and write out some stuff about what the various textures do, how to draw them in photoshop and how the shader works with them to make the glow effect.
Last edited by Griff on Thu May 10, 2007 8:40 pm, edited 3 times 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 »

Initial comments:
1) Nice.
2) The line “specular = mix(specular, specular * diffuse, 0.0);” has no effect. (This is probably inherited from when I was trying out variations on specular effects in the Krait.)
3) You’ve got the value 1.51 repeatedly in the code. Good practice here is to use a constant, i.e. “const float kHeatLevel = 1.51;” (I’d put it at the top with the uniforms) and then use kHeatLevel as appropriate - this lets you change it in one place and also makes it more obvious what it’s for. This also makes it trivial to change it to a uniform so you can twiddle it interactively in a GLSL editor. The “k” prefix is a convention used in Mac programming to differentiate between constants and variables; use whatever convention you want.
User avatar
Griff
Oolite 2 Art Director
Oolite 2 Art Director
Posts: 2476
Joined: Fri Jul 14, 2006 12:29 pm
Location: Probably hugging his Air Fryer

Post by Griff »

Hi Ahruman, thanks for picking through the shader code! the 1.51 value was the metal_temperature variable which i was controlling with a slider in rendermonkey, i didn't know the correct way to give it a value but i noticed that replacing metal_temperature with a number seemed to work so i chose an easily spottable value so i could quickly do a find & replace when changing between '1.51' & 'metal_temperature' when testing out the shader, i'll make the changes you suggest and re-up the oxp.

i was wondering why the specularity effects don't appear in rendermonkey, is it something to do with "gl_LightSource[idx]", is this making a reference to the 'sun' in oolite.
when (if?) my brain is up to it it'll have a look at the examples in rendermonkey, there's some phong lighting examples in there that i might be able to bring your lighting code into so i can preview specular maps.

Edit: I've made the changes to the shader and re-uploaded it. I've edited the link in my post to go to the new version.
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 »

Hmm. It’s basically impossible with this shader for the specular lighting not to show up if diffuse lighting is (assuming tex0 and tex1 are set up correctly, i.e. you can see the glow effect). However, the specular map is rather subtle since the specular intensity channel (green) is rather dim. Here’s the shader with specular lighting on and off (by commenting out the “specular +=” line in LIGHT):
Image
That’s on one of the parts of the texture where the effect is most noticable. However, I do see it when I put it on a plane and turn it towards the light.

If you want to make it less subtle, the best approach would be to use the full dynamic range of the green channel (i.e., make it less dim from the start), then adjust overall intensity with the tweak factor (currently 1.2) in the code. Change that 1.2 to 20.0 and you should have no problem seeing the effect is there. :-)

Another issue: while testing on a MacBook (with Intel GMA 950 graphics) over the weekend, I discovered that the Pulse function used in many of my shaders and in your glowing alloy one cause it to fall back to software. To avoid/work around this in future versions of Oolite, I suggest providing a low-definition version of it which removes the pulse/flicker effects but allows hardware rendering on GMA 950s:

Code: Select all

#ifdef OO_REDUCED_COMPLEXITY
#define Pulse(v, ts) ((v) * 0.95)
#else
float Pulse(float value, float timeScale)
{
    float t = time * timeScale; // multiplier on end of this line increases the flicker effect  
    
    float s0 = t;
    s0 -= floor(s0);
    float sum = abs( s0 - 0.5);
    
    float s1 = t * 1.7 - 0.05;
    s1 -= floor(s1);
    sum += abs(s1 - 0.5);
    
    float s2 = t * 2.3 - 0.3;
    s2 -= floor(s2);
    sum += abs(s2 - 0.5);
    
    float s3 = t * 5.09;
    s3 -= floor(s3);
    sum += abs(s3 - 0.5);
    
    return (sum * 0.25) * value;
}
#endif
You can test this by adding the line “#define OO_REDUCED_COMPLEXITY” before this code. I intend to have Oolite predefine OO_REDUCED_COMPLEXITY when the user selects simple shaders in preferences, and also to try realoading shaders with it defined if they fall back to software rendering with full complexity (although it may only be possible to detect this under OS X).
User avatar
Griff
Oolite 2 Art Director
Oolite 2 Art Director
Posts: 2476
Joined: Fri Jul 14, 2006 12:29 pm
Location: Probably hugging his Air Fryer

Post by Griff »

heh, wow that specular effect really is subtle, i spent ages trying to spot it, it's about 4 pixels slightly brighter in one image and not the other!
mind you, i quite like that texture wrapped around a sphere as in your example, it looks like some sort of volcano planet!
about the lighting in rendermonkey, i had to add a * 20.0; multiplier to the end of this line in the LIGHT(1); macro part of the shader to 'brighten' up the lights otherwise the objects appear so dark it's as if there's no lighting in the scene at all with just the glow maps appearing:-

diffuse += gl_FrontMaterial.ambient * gl_LightModel.ambient

I wonder if this is canceling out the calculations that add the specular effects?
i guess what i need to do is to write a shader specifically for previewing specular maps in render monkey, setting fixed values for variables in lines like these:-
vec3 lightVector = normalize(gl_LightSource[idx].position.xyz); \
edit: oh hang on, that's not going to work is it, it's going to make the light shine onto the object from all possible directions at once
i suppose to be fair, the shader is relying on information from the Oolite game engine that doesn't exist when running the shader in rendermonkey so the gl_LightSource doesn't exist or has zero value.
Edit: I've added the changes to the pulse function to the oxp and updated the link in the post above
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 »

Griff wrote:
about the lighting in rendermonkey, i had to add a * 20.0; multiplier to the end of this line in the LIGHT(1); macro part of the shader to 'brighten' up the lights otherwise the objects appear so dark it's as if there's no lighting in the scene at all with just the glow maps appearing:-

diffuse += gl_FrontMaterial.ambient * gl_LightModel.ambient
Ahh, right. In that case, you haven’t set up ligh #1 in RenderMonkey. Changing LIGHT(1) to LIGHT(0) is a hack solution, but the correct way is to work out how to set up lights. :-) (Or you could #define OO_LIGHT_0_FIX)
User avatar
Griff
Oolite 2 Art Director
Oolite 2 Art Director
Posts: 2476
Joined: Fri Jul 14, 2006 12:29 pm
Location: Probably hugging his Air Fryer

Post by Griff »

wow, thanks man! i took the easy option and changed light(1) to light(0) :)
it's great being able to quickly preview the specular maps in rendermonkey, i've gone back to working on the krait for a moment to work on giving it a more dull metal like look.
Edit: ooh, shiny!
Image
Last edited by Griff on Tue May 08, 2007 7:03 pm, edited 1 time in total.
User avatar
Uncle Reno
---- E L I T E ----
---- E L I T E ----
Posts: 648
Joined: Mon Apr 24, 2006 12:54 pm
Location: UK

Post by Uncle Reno »

Ahruman wrote:
Image
I think it looks like a planet with centres of habitation illuminated. 8)
"Get back or I unleash my lethal spotted batoid!!"

What I do when not reading the Oolite bulletin board!
User avatar
Arexack_Heretic
Dangerous Subversive Element
Dangerous Subversive Element
Posts: 1878
Joined: Tue Jun 07, 2005 7:32 pm
Location: [%H] = Earth surface, Lattitude 52°10'58.19"N, longtitude 4°30'0.25"E.
Contact:

Post by Arexack_Heretic »

That is really pretty! 8) (I need my shades for that specular glow)

If you are looking for a quick alternates, feel free to browse:
Wrex_OXP_DEV which has several lowpoly debris-sized alloy models.

http://home.tiscali.nl/arexack/arexack/ ... ks/models/
Riding the Rocket!
User avatar
Griff
Oolite 2 Art Director
Oolite 2 Art Director
Posts: 2476
Joined: Fri Jul 14, 2006 12:29 pm
Location: Probably hugging his Air Fryer

Post by Griff »

Edit:
Cool models A_H, i grabbed a few and added the glowing metal shader to them, i'll add them into the glowing_alloys.oxp if that's ok :-
Image
User avatar
Griff
Oolite 2 Art Director
Oolite 2 Art Director
Posts: 2476
Joined: Fri Jul 14, 2006 12:29 pm
Location: Probably hugging his Air Fryer

Post by Griff »

I've uploaded a newer version, this one features some great new debris models by Arexack_Heretic (see above) as well as some tweaks to the specularity maps.
Edit: added the 'smooth' option to the models and Ahrumans new cooling effect shader. Note: this .oxp now needs at least version 1.69 of Oolite to work.
http://www.box.net/shared/ha4vs8ntkb
Last edited by Griff on Sun Jul 08, 2007 1:40 pm, edited 2 times in total.
User avatar
Arexack_Heretic
Dangerous Subversive Element
Dangerous Subversive Element
Posts: 1878
Joined: Tue Jun 07, 2005 7:32 pm
Location: [%H] = Earth surface, Lattitude 52°10'58.19"N, longtitude 4°30'0.25"E.
Contact:

Post by Arexack_Heretic »

Wow!
I just love glowing metal.

Looks awesome as always Griff!
:thumbsup:
Riding the Rocket!
User avatar
Griff
Oolite 2 Art Director
Oolite 2 Art Director
Posts: 2476
Joined: Fri Jul 14, 2006 12:29 pm
Location: Probably hugging his Air Fryer

Post by Griff »

it's the turn of the poor old boa
Image

good job you upped the model vertex and face limits Ahruman!
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 »

Mmmm… light maps. :-)
User avatar
Cmdr. Maegil
Sword-toting nut-job
Sword-toting nut-job
Posts: 1294
Joined: Tue Feb 27, 2007 10:28 pm
Location: On the mend in Western Africa

Post by Cmdr. Maegil »

The word "awesome" is getting beaten up, but still holds true. Unfortunately, regardless of how much I love the model (and I do, a lot), I can't see the Boa in it...
You know those who, having been mugged and stabbed, fired, dog run over, house burned down, wife eloped with best friend, daughters becoming prostitutes and their countries invaded - still say that "all is well"?
I'm obviously not one of them.
Post Reply