Join us at the Oolite Anniversary Party -- London, 7th July 2024, 1pm
More details in this thread.

Shaders’ Outpost

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

Moderators: winston, another_commander

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

Post by Griff »

fixed the problem with the models origin, i've just started playing oolite all over again and didn't have a targetting scanner onstalled so i couldn't see the green box thing. i've just edited a savefile to stuff a load of money into my account so i could buy a scanner then i'm not sure if this happened or not but i believe the game just told me off for cheating!

i've edited the link in my the post above to point to the latest version, but here it is again http://www.box.net/shared/85jm82oz5r
TGHC the idea for the outside toilet is great! i'm definately going to go back and add one of those in, and possibly a small asteroid floating alongside with a designated outside smoking area on it.
Last edited by Griff on Thu Oct 18, 2007 7:50 pm, edited 2 times in total.
User avatar
Griff
Oolite 2 Art Director
Oolite 2 Art Director
Posts: 2479
Joined: Fri Jul 14, 2006 12:29 pm
Location: Probably hugging his Air Fryer

Post by Griff »

A_H, i've uploaded some versions of Ahrumans animated neon shader with the specularity code from his others shaders all horribly grafted together to make some sort of Frankenstein Monster of a shader.

The "animated & non animated" version combines an animated texture with a non-animated texture but the colours mix though so something red appearing over something blue gives a purple colour where the two colours overlay, which probably isn't correct.

anyway, get it here: http://www.box.net/shared/87okmdxa5a

If you haven't already checked it out, have a look at ahrumans shady billboard oxp, with some tweaking of the kDisplayTime & kFadeTime variables in the fragment shader you can make it act a lot like a neon sign shader, plus it has lots of brainy stuff happening in it to control the specular effects etc, the examples i've just posted have come about through trial and error with no real understanding of the code!
User avatar
Arexack_Heretic
Dangerous Subversive Element
Dangerous Subversive Element
Posts: 1876
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 »

hehe. :lol:
T&E would be my approach as well, so I'm glad you are doing it instead. ;)

Anyway, I uploaded a more complex (26frames) animation of wormhole sign.
wormhole

As well as a simple (4frames) neon sign based on a nice Jugendstill-style image I found on the web.
CobraStarship


edit: added links,
I'll go look at your monstershader now.
Looks like alot of non functioning animation tests...but the with specular is working it seems (I can see a black background).

edit2: finally found a test with the animated/non-animated textures.

I think the see-through effect is OK, only...I know I should be fixing this myself...the diffuse texture should not light up on the shadow side of the object. I think there may have been a miscommunication.
Riding the Rocket!
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:
The "animated & non animated" version combines an animated texture with a non-animated texture but the colours mix though so something red appearing over something blue gives a purple colour where the two colours overlay, which probably isn't correct.
It is in fact exactly correct for glowing stuff.

However, there is a problem with the shader: you don’t do anything with the diffuse component. The line color += nonanimatedMap; should be color += nonanimatedMap * diffuse;.

Putting the animation work in the vertex shader in the example was not done on a whim; doing the calculations once for each vertex (four or six times per frame) instead of once or more for each pixel is a significant win. The way to do this while also keeping the non-animated co-ordinates is to use a "varying vec2" variable to store the altered/animated co-ordinates.

A_H: the extended animation looks nice, but the texture is unacceptably big; many graphics cards don’t accept textures with dimensions greater than 4096 pixels. Also, the height of the texture is not a power of two. Oolite should be able to scale it to a workable size (I haven’t tested), but it’s an increased workload on the client. With a bit more work in the shader, frames could be laid out in the texture in two dimensions. Another technique <engages scary programmer mode> would be to have one or more textures with different elements of the animation, and another, one-dimensional texture with one pixel per frame, whose colour specifies how to combine the components.

A specular map to make the glass tubes glossier than the background would be a nice addition.
User avatar
Arexack_Heretic
Dangerous Subversive Element
Dangerous Subversive Element
Posts: 1876
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 »

EEEK! :shock:
That sounds exceedingly complex!
But hey, I won't stop you from showing your mighty powers.
(It's certainly beyond mine, I can only dream of functional code.)

That 'colour-code-punchcard-operated'-shader sounds suspiciously much like the way I create textures...in photoshop.

@texturesize/anim-length:
To how many frames do you suggest I reduce this wormhole animation?
hmmm....^2...you used 5frames in the example, that would be one too much ore 3 short of 2^2 and 2^3 respectively.
I use 26, I could add some more frames of pulsing wormhole up to 32.
But then the texture is still too long.
drat.
16 could be done if I return to a sequence without the pause.
~4000pix max length is seriously restricting. :(


@glasstubes:
I was thinking of adding a bit of a glow from neighbouring tubes to non-lighted tubes, but at anly a few pixels wide I feared creating a mess.
I do have some highlights on the tubes suggesting shinyness, adding a specular map would be fairly simple. (intentionally disregarding editing the shadercode)
I'll add specularity too.
Riding the Rocket!
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 »

Arexack_Heretic wrote:
@texturesize/anim-length:
To how many frames do you suggest I reduce this wormhole animation?
hmmm....^2...you used 5frames in the example, that would be one too much ore 3 short of 2^2 and 2^3 respectively.
I use 26, I could add some more frames of pulsing wormhole up to 32.
But then the texture is still too long.
drat.
16 could be done if I return to a sequence without the pause.
~4000pix max length is seriously restricting. :(
The number of frames doesn’t actually have to be a power of two. The frames don’t have to be at a 1:1 aspect ratio. For instance, to test your animation, I rescaled it to 512x4096. This works fine, but results in a “creeping” effect because the individual frames are a non-integer height (157.53846153846 pixels high – ouch). The frames should have integer dimensions. For instance, if you rescaled it so that the frames were each 157 pixels high, you’d get 4082 pixels in total; then an adjustment factor in the shader could use the co-ordinate range 0..(4082/4096) instead of 0..1.
User avatar
Arexack_Heretic
Dangerous Subversive Element
Dangerous Subversive Element
Posts: 1876
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 »

Ah yeah I got a bit confused with frames and texturesize.
As I was using a square frame of 512, I erroneously thought the ratio would be a power2 number. (which would only be the case IF I used a power2 number of frames.)

Won't rescaling 26 frames (26*512=13312) into effectively (4096/512=) 8 distort the images terribly?
Riding the Rocket!
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 »

It will stretch them. The shader will then unstretch them.
User avatar
Arexack_Heretic
Dangerous Subversive Element
Dangerous Subversive Element
Posts: 1876
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 »

but rescaling by 1/8...most of the details are 2 pixels wide!
Riding the Rocket!
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 »

Actually, it’s a factor of 157/512 = 1/3.26114649682. Why don’t you try it instead of whining? ;-)

Image

The necessary adjustment to the shader is:

Code: Select all

const float kFrameScale = 4082.0/4096.0;
...
// Scale texture co-ordinates to 0..1
animatedcoord.t /= kFrameCount / kFrameScale;
User avatar
Arexack_Heretic
Dangerous Subversive Element
Dangerous Subversive Element
Posts: 1876
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 »

OK.

I'm thoroughly chided. :oops:

Actually, I hadn't bothered testing this ingame, as it was just a fun little gift for Griff to start with. (I was going to have him do the hard work) :P

edit:
Did you notice that the shadyCobra shipdata.plist lacks the opening and closing plist-tags ( {, } )?
b. Thargoids are not freaking out (in 1.69.1.): AFAIK I have the most recent version of FT.oxp (3).
Riding the Rocket!
User avatar
Griff
Oolite 2 Art Director
Oolite 2 Art Director
Posts: 2479
Joined: Fri Jul 14, 2006 12:29 pm
Location: Probably hugging his Air Fryer

Post by Griff »

A_H you might be able to reduce the number of frames in your animation but keep the timing by maybe combining two animated maps together running at different speeds? IE, have the worm hole running a 4 frame animation and the rocket running an 8 frame animation over it - hmm, stuff might go out of sync though i suppose ..i'll try and have cut & paste session with some of ahrumans shaders and see if i can get it working.

also, just had a thought, using the discard function and a suitable texture map it might be possible to get a proper see-through wireframe look to the ships, 1 one fell stroke undoing all the hard work that's gone into the graphice engine over the years!
User avatar
Arexack_Heretic
Dangerous Subversive Element
Dangerous Subversive Element
Posts: 1876
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 »

lol

I'd love to have you do the work!

Have been thinking of a wireframe neon sign last weekend;
there is this storage facility next to the highway, close to Rotterdam, that is called 'the cube' (actually Kubus). They have this red neon cube as a sign, really nice. I was thinking of copying this in oolite, calling it cuboid-storage or something.

My initial approach would be:
1-model flat strip of red 'neon', copy model in wings and rotate 90deg, so it's now a + on crosssection.
2-shaders: maybe Ahrumans cutt-off code, but maybe diffuse+permaglow will suffice.
3-use subentities to model a cube standing on one corner from this length of 'tubing'
4-add blue CUBE neon lettering inside.
...
alternatively, model a tube around this length and apply (a)-a black texture to A's seethrough-animation shader (-animation) (b)-use glowmaps for the + inside.

First I'm gonna animate you some WORMHOLE Griff.
Riding the Rocket!
User avatar
Griff
Oolite 2 Art Director
Oolite 2 Art Director
Posts: 2479
Joined: Fri Jul 14, 2006 12:29 pm
Location: Probably hugging his Air Fryer

Post by Griff »

'Wireframe' Cobra3
well, this didn't work out very well, it's hideous.
Image

http://www.box.net/shared/eku0d35g15
User avatar
Arexack_Heretic
Dangerous Subversive Element
Dangerous Subversive Element
Posts: 1876
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 »

nice malfunctioning cameleon'ware effect though
Riding the Rocket!
Post Reply