Home Crush your enemies... and create an EMPIRE!!! Space Empires V -- BUY NOW!!!

User login

  • Create new account
  • Request new password

Navigation

  • news
    • archive
    • blogs
    • books
    • forums
    • recent posts
    • groups
  • image galleries
  • projects & downloads
  • search
  • create content
  • news aggregator

Search

Who's online

There are currently 2 users and 163 guests online.

Online users

  • Randallw
  • crazydog

Languages

  • English English
  • French French

Browse archives

« Octobre 2008  
Lu Ma Me Je Ve Sa Di
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31    
Home » news » forums » Support & Feedback » Scenarios & Mods » SE:V MODs

A new way to texture your shipsets!

ekolis's picture
Submitted by ekolis on Tue, 2007-10-30 20:11. SE:V MODs

Hey, I found this cool software on the NVIDIA website called "Mental Mill Artist Edition" which lets you create "shaders" in a GUI. Shaders are basically like a fancy kind of texture built using a special programming language specific to graphics, so being able to create them in a GUI is really nifty! Eye-wink

Now I've run into Mental Mill before, but I'd never figured out a way to integrate it with, say, Wings, so that you could create the shaders in MM and export them to Wings, and "bake" them onto a ship model as regular textures for use in SE5 (since SE5 doesn't support shaders).

But I finally figured it out... it's a BIT complicated, but it seems to work pretty well! Laughing out loud (Assuming you have an OpenGL 2.0 compatible video card that is! But if you're running SE5 that's *probably* not a problem Sticking out tongue)

1. Create your shader in Mental Mill's GUI.
2. Export it to GLSL from the File menu. That's the OpenGL shader programming language. Yes, I know SE5 uses DirectX, but we're going through Wings here which uses OpenGL.

OK, now you have 2 files, "yourshader_f.gl" and "yourshader_v.gl". What to do with them? Copy them into your wings\plugins\autouv directory. (You'll need the Scorpius v0.98.37 version of Wings because the 0.98.36 version had a bug where these shaders don't work at all!)

Now there's still a few more steps - hang on, though, this will be pretty nifty! Eye-wink

3. Create a text file in the autouv directory where you just placed the shader files. Call it "wpc_yourshader.auv" - the "wpc" and "auv" are important, otherwise Wings won't recognize the shader!
4. Place the following text into your newly created text file:

{name, "My Shader"}.
{vertex_shader, "myshader_v.gl"}.
{fragment_shader, "myshader_f.gl"}.

5. Look in the "yourshader_f.gl" file for the following lines:

//
// The following are free parameters of the shader
// that should be set by the application at runtime.
//

Take note of any lines immediately following that begin with the word "uniform". Those are parameters for your shader, and you need to map those to items in Wings' UI for the shader to be as functional as it could be.

6. For each of those lines, add a line to your new file along the following format:

{uniform, type, variableName, DefaultValue, "StringInGUI"}.

For instance, if you see

uniform float msl_Generator_checker_1_checkerSize;

you need to put something like

{uniform, float, "msl_Generator_checker_1_checkerSize", 0.2, "Checker Size"}.

Note that if you see a "vec4" you need to put "color" instead in your file, not "vec4", as the vec4 type is used to represent a color in RGBA format.

Don't worry, we're almost there! Laughing out loud

7. Open up the "myshader_v.gl" file and insert the following text above the "void main()":

varying vec2 w3d_uv;
varying vec3 w3d_pos;

8. Also in the same file insert the following text before the closing curly brace:

w3d_uv = gl_Vertex.xy;
w3d_pos = gl_MultiTexCoord1.xyz;
vec4 Position = gl_Vertex;
gl_Position = gl_ModelViewProjectionMatrix * Position;

9. On the line that looks like this:

tex_coord0 = gl_MultiTexCoord0;

change the second zero to a one:

tex_coord0 = gl_MultiTexCoord1;

K, now we can open up Wings and try this baby out! Laughing out loud

10. Load your Wings model and run through the AutoUV functionality to create a texture mapping for your model, just like you normally would before exporting it to GIMP for that tedious editing process. But instead of exporting to GIMP, select the faces you want to apply your shader to (or all of them if you only want to use the one shader), right-click in the AutoUV window, and choose "Create Texture".

11. You are now presented with a list of options. Choose a size for your texture, and in the second dropdown box you *should* find the name of your shader! Select it, then click on Options.

12. In the second options dialog, presto! You should find all those parameters you spent that time setting up earlier, ready for customization! (See, I told you setting them up was worthwhile! Eye-wink) Set them to your heart's content, then click OK.

13. Click OK on the original options dialog, and wait a moment. WHOA! Is that... could that be?!? Did Wings just apply your *shader* to the model, and create a *texture* out of it??? And it looks so NICE on your ship! And you... you can REUSE the shader! On the other ships in your shipset! Instead of texturing them all again from scratch!!!

Isn't that just COOL???? Laughing out loud

Note: Once you have created a vertex shader (that's the "*_v.gl" file) you can *probably* reuse it for future shaders to save you the trouble of modifying the new generated shaders! Eye-wink

The software is bundled with NVIDIA's "FX Composer" software, which is a free download:

http://developer.nvidia.com/object/fx_composer_home.html

‹ Custimized Orders for Ships? Is there a script debugger?? ›
» login or register to post comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Isopsyco's picture
Mod Designer

Re: A new way to texture your shipsets!

Submitted by Isopsyco on Tue, 2007-10-30 20:54.

Sounds like something to try out!

I'll let you know how it works in Maya/3dsMax.

Its a 217 meg download, pretty serious 'free' software tool if you ask me Smiling

» login or register to post comments
ekolis's picture
Mod Designer

Re: A new way to texture your shipsets!

Submitted by ekolis on Wed, 2007-10-31 07:58.

Yes, it is a pretty spiffy tool! You might be able to get Mental Mill separately if you want - I haven't checked this out, but there's a link on the NVIDIA FX Composer page to the company that makes Mental Mill...

NVIDIA also has a free tool called Gelato, which is a renderer... it comes with a Maya plugin IIRC so if you're using Maya you may want to check that out as well...

~~~
The power of the ancients is now yours to command. You are truly the Master... of the obvious Sticking out tongue

» login or register to post comments
Romulus68's picture
Mod Designer

Re: A new way to texture your shipsets!

Submitted by Romulus68 on Wed, 2007-10-31 11:10.

Lots of Big talk and I see no Pics??? :>

Show us some before and after pics if you don't mind.

SE5 Files hosted on Filefront (Patches, Mods, Races, etc)

» login or register to post comments
ekolis's picture
Mod Designer

Re: A new way to texture your shipsets!

Submitted by ekolis on Wed, 2007-10-31 12:42.

All right, when I get home again I'll have to remember to show you some pics of the Frozo shipset I'm working on - remember the SE4 version, with the ice crystal ships?

http://wiki.spaceempires.net/index.php/Frozo

Inspired by the Mental Mill software (and also by my email conversation with Geo where Geo said that he'd *consider* installing the latets SE5 Shipset Megapack sets on PBW every so often so we can finally have custom shipset support in multiplayer!!!) I decided to make an SE5 version of the Frozo! Laughing out loud

So far I have models for the six main ships (frigate through dreadnought), a baseship, three sizes of carrier, and three sizes of freighter. I'm not going to try installing Mental Mill at work right now, so they're untextured. Left to do:

* the shader and baked textures
* the bases
* all of the units (fighters, drones, troops, weapons platforms, satellites, and mines - did I forget any?)
* the text files (ugh - might just copy the generic slot layout - and those firing arcs will be a pain!)
* the race portraits
* the flags
* the miscellaneous icons and stuff for combat and shiplist textures

~~~
The power of the ancients is now yours to command. You are truly the Master... of the obvious Sticking out tongue

» login or register to post comments
ekolis's picture
Mod Designer

Re: A new way to texture your shipsets!

Submitted by ekolis on Thu, 2007-11-01 07:12.

OK, I ran into a little problem here with the Frozo... one of the components of my "ice" shader (the "clouds generator") needs something of type "sampler1d" (a one-dimensional texture sampler), and it appears that Wings currently has no way to pass a sampler1d into a texture as a parameter, so the ice shader just comes out a solid color because it doesn't know how to sample the generated clouds pattern. The odd thing is, I really needed a 3D sampler (I had to do some fiddling with the inputs to the clouds generator following some instructions on the Mental Mill forum, because I wanted a 3D procedural shader, not a 2D one which is what the clouds generator creates on its own!), and Wings has a 3D sampler built in, but the clouds generator requires a 1D sampler as input, and I don't know if it's possible to convert a 3D sampler into a 1D sampler or extract a dimension out of it or what... I guess I'll have to do some reading on GLSL, or look for a "sampler extractor" module in Mental Mill, or something...

Another idea I had, though, is to write my own GLSL generator program, to take the place of Mental Mill, which would be specific to Wings (i.e. with no functionality in it that Wings doesn't support, and with extra functionality to generate the "*.auv" file). I know that I have very little knowledge of GLSL, but I figure that if I gather enough "code snippets" from tutorials and documentation and such, and represent each snippet by a "shader block" like Mental Mill uses, and add in code to connect the snippets' inputs and outputs by encapsulating them in functions, that I *should* be able to do this! Smiling Now the question is, do I try to write it in Erlang (which I haven't used in a while, but which should result in code that would integrate nicely into Wings as a plugin, as well as mesh perfectly with the idea of "functional programming" that I'm using here - building programs not out of classes representing types of objects like "colors" but out of individual functions representing processes like "extract RGBA values from a color") or in C# (which I'm much more familiar with, but would not integrate into Wings and - unless I use the beta C# 3.0 - would not mesh well with "functional programming")...

~~~
The power of the ancients is now yours to command. You are truly the Master... of the obvious Sticking out tongue

» login or register to post comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Now on STEAM

Now on STEAM!Space Empires V via STEAMSpace Empires IV via STEAMSTEAM online by Valve Corporation

Popular content

Today's:

  • Star Wars SEV ship set available
  • No Point Defence in Technology in Balance mod
  • New Engine System
  • Research By Percentage SUCKS
  • Space Empires V and VI: Expansions and the Future: Tell the Company What's on Your Wish List

All time:

  • Space Empires V and VI: Expansions and the Future: Tell the Company What's on Your Wish List
  • Space Empires V
  • Gritty Galaxy Fleet Clash
  • Damn Dirty Bugs/Annoyances
  • Space Empires V: General Thoughts, Observations, and Suggestions

Last viewed:

  • SE5_20060929-58.jpg
  • Removing engine limit on hulls - Ramifications?
  • Possible Space Yard Rate Modifier Bug
  • ? on effect with 2 scopes
  • Are there still issues with GeForce 8 cards?
(c) Strategy First, Inc. All rights reserved.