The Dream Team - Revisited

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

Moderators: winston, another_commander

User avatar
Selezen
---- E L I T E ----
---- E L I T E ----
Posts: 2530
Joined: Tue Mar 29, 2005 9:14 am
Location: Tionisla
Contact:

Post by Selezen »

Hmm... Chitin plates. I like that. I'll give that a whirl...
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 »

Since we’re talking about chitin and stuff, I should probably point out that the next Windows release (like the 1.67 Mac releases) will support pixel shaders. When I get home I’ll post the freaky-thargoids demo OXP somewhere for reference. I’ll try to throw together a specular map example, too.
User avatar
Killer Wolf
---- E L I T E ----
---- E L I T E ----
Posts: 2278
Joined: Tue Jan 02, 2007 12:38 pm

Post by Killer Wolf »

i have no idea how pixel shaders and such like actually work - is it just a case of the oxp having a texture map, a bump map etc etc all packaged in together and the code knowing what to do w/ 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 »

Nope, in the current implementation you must code the shader in GLSL… or copy and paste from someone else.

A simpler approach – where you specify a number of effect maps, and Oolite builds an appropriate shader, scaling down complexity to what the hardware can handle if necessary – is on my “things I’d like to do” list. It comes after “Operation Major Surgery”, and isn’t likely to materialize for at least several months. When/if it does, existing custom shaders will continue to work.
User avatar
Star Gazer
---- E L I T E ----
---- E L I T E ----
Posts: 633
Joined: Sat Aug 14, 2004 4:55 pm
Location: North Norfolk, UK, (Average Agricultural, Feudal States,Tech Level 8)

Post by Star Gazer »

ooooooo... ....starting to shows signs of uncontrollable twitching and drooling in anticipation...
Very funny, Scotty, now beam down my clothes...
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 »

I’ve posted the Freaky Thargoids OXP to the wiki. I’m working on an overview of fragment shaders as they apply to Oolite.
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 »

Overview thingy done (with a terse explanation of the Freaky Thargoids shader code). In the process, I found (via Wikipedia) an article on normal mapping for artists, which might be considered somewhat depressing since (I believe) the current shader implementation is not usable for that form of normal mapping, but it begins with a good description of how lighting in 3D works, which should help understand how smoothing currently works in Oolite.

I’m actually about to modify the way shader loading works, in a way that breaks compatibility; the current version of freaky-thargoids, or anything based on it, will not use shaders in future releases. However, modifying it to work will be easy, so if you want to start playing with shaders, don’t let this put you off.
User avatar
Killer Wolf
---- E L I T E ----
---- E L I T E ----
Posts: 2278
Joined: Tue Jan 02, 2007 12:38 pm

Post by Killer Wolf »

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 »

I wasn't aware it already worked ingame. this is great.
edit: Ah I see from the next (1.67) release it will work.

Also if I understand correctly, what the code does is replacing a given texture file for the described shader version?
ie Giles mentioned the Thargorn looked pretty freaky, BECAUSE it used the standard in-game thargoid.png.
This could mean one could suffice with defining a shader once in a shipdata....(but also that it would be advisable to copy-rename textures if creating custom shayders based on standard textures)
Or just define a fictitious texture to be 'replaced'.

Don't forget the PPC25.oxp which utilises shayders coupled to engine-level.
PPC25:

Code: Select all

<key>shaders</key>
		<dict>
			<key>pccv25hull.png</key><!-- replace this texture -->
			<dict>
				<key>textures</key>
				<array>
					<string>pccv25hull.png</string><!-- passed as tex0 -->
					<string>pccv25-hullg.png</string><!-- passed as tex1 -->
					<string>pccv25-hulleg.png</string><!-- passed as tex2 -->
				</array>
				<key>glsl</key><!-- fragment shader code - adds tex1 as a glowmap and tex2 as an engine level glow -->
				<string>
				uniform sampler2D tex0;
				uniform sampler2D tex1;
				uniform sampler2D tex2;
								
				uniform float engine_level;
								
				void main()
				{
					vec4 base =		texture2D(tex0, gl_TexCoord[0].st);
					vec4 glow1 =	texture2D(tex1, gl_TexCoord[0].st);
					vec4 glow2 =	texture2D(tex2, gl_TexCoord[0].st);
					gl_FragColor = gl_Color * base + glow1 * glow1.a + glow2 * glow2.a * engine_level;
				}
				</string>
			</dict>
			<key>pccv25engine.png</key><!-- replace this texture -->
			<dict>
				<key>textures</key>
				<array>
					<string>pccv25engine.png</string><!-- passed as tex0 -->
					<string>pccv25-engineeg.png</string><!-- passed as tex1 -->
				</array>
				<key>glsl</key><!-- fragment shader code - adds tex1 as an engine level glow -->
				<string>
				uniform sampler2D tex0;
				uniform sampler2D tex1;
								
				uniform float engine_level;
								
				void main()
				{
					vec4 base =		texture2D(tex0, gl_TexCoord[0].st);
					vec4 glow2 =	texture2D(tex1, gl_TexCoord[0].st);
					gl_FragColor = gl_Color * base + glow2 * glow2.a * engine_level;
				}
				</string>
			</dict>
Last edited by Arexack_Heretic on Thu Mar 22, 2007 8:50 pm, edited 1 time in total.
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 »

I was mistaken. The modifications I needed to make have been completed without breaking backwards compatibility. Future versions of Oolite will be able to use shaders embedded in shipdata.plist or in an external file (which should be more efficient when using the same shader for multiple ships, although this is not yet the case).

I’ve updated freaky-thargoids to support lighting. (The previous one essentially had two glow maps mixed together, rather than a colour map + glow map.) This version also uses vertex shaders.
Arexack_Heretic wrote:
Don't forget the PPC25.oxp which utilises shayders coupled to engine-level.
Really? Where can I find that?
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:
Also if I understand correctly, what the code does is replacing a given texture file for the described shader version?
ie Giles mentioned the Thargorn looked pretty freaky, BECAUSE it used the standard in-game thargoid.png.
A shader replaces a texture for a specific ship. It doesn’t replace every use of a given texture. Oh, and there’s no “y” in “shader”. :-)
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 »

ppc25.

not on oosat(2)?
I'll upload it from my HDD if it needs replacing.
uploading now...
hmm...no longer instantaneous.
Where did the wrex teaser v1.2 go BTW? There's only an old version posted by LB there. I'm sure I updated it not too long ago....:(



It is one of the last works of Giles.
(Famous last works) ;)

Shayders: yes, i know you pedantic...:p it is a personal joke. I misheard Giles the first time I saw his shader-movie.

If the shaders are entry specific, then he must have spliced the freaky-texture-code into my shipdata.
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 »

Hmm… perhaps they’re not. They’re just specified on a per-ship basis to confuse people.

This is part of a complex set of issues that needs dealing with (I believe I’ve alluded to it before…) I reccomend not relying on this behaviour.
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 »

Do uploads to OOsat2 now need special clearance from someone?
I uploaded PPC25 and wrex_teaser1.2, but cannot see them. (nor do the pictures work. strange)

edit:
I updated the wiki as well.
Last edited by Arexack_Heretic on Thu Mar 22, 2007 10:43 pm, edited 2 times in total.
Riding the Rocket!
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 »

Yes, Oosat2 uploads need to be approved by Winston. The idea is that we migrate over to the Wiki but I'm encountering a file size limit at the moment.
"Get back or I unleash my lethal spotted batoid!!"

What I do when not reading the Oolite bulletin board!
Post Reply