View Full Version : [UT200X]-Skinning : Making a good Spec Shader

8th Nov 2005, 01:50 PM
Tutorial for creating a good Specular Shader

This tutorial will briefly cover how to make a simple and quick Specular Shader with a Shader and a Final Blend.
I will base this tutorial around my recent creation, not yet finished(8/11-2005), Mariah.
I will use the head of my skin in this tutorial. I will also have masked some things out on this head. Look in the Masking tutorial if you don't know how to do that.
I resized the textures to keep thread loading time down. You can always look throug SkinCity to find the skin, when it is finished.

First you need the Photoshop DXT Compression tool for creating .dds files. You can, As far as I remember, also use targa files, but I use DXT Compressed files.
nVidia DXT Photoshop Plugin (http://developer.nvidia.com/object/photoshop_dds_plugins.html)
Or you can browse these tools (http://developer.nvidia.com/object/nv_texture_tools.html)
Install it into Photoshop if not allready.

To start of we need a head texture. I use mine for a Merc Female A model.

This is very simple now save this file with another name so you have two identical textures. I saved mine as Head_SpecAlpha so I know what it is and where it goes.
Open up this HeadAlpha and mark out what you want to be affected by the Specular Shader. In Photoshop use the Lasso tool(Shortcut "L"). Mark everything and be careful not to mark anything not to be shaded. They WILL become shaded if you are not careful here. I marked my selection in red here.

Now copy this selection(Shortcut "Ctrl+C") and go to the "Channels" tab in the layers menu.

Now press the "Create New Channel" button if there is not allready an Alpha channel.
Now select the Alpha 1 Channel and paste in the selection(Shortcut "Ctrl+V").

Now you have something like this.

This is not all wrong but you need to have in mind that White = 100% Opacity and Black = 0% Opacity. This means that around your selection you need to invert the colors.
Do this by inverting your selection(Shortcut "Ctrl+Shift+I") and inverting the colors(Shortcut "Ctrl+I").
Now you should have something like this.

Now you are ready to edit this for optimal looks. Invert your selection again and edit the lightness of the selection(Example use this tool "Ctrl+L").
Don't deselect until you completely satisfied with the look IN THE UNREAL EDITOR. You can easily Export the texture to UEditor without deselecting.

Now to getting it into the UEditor.

First you need to save the texture as a .dds file(DXT Compression). Do this by selecting File->Save As and select D3D/DDS as the file format. Choose a name and save. I Chose Head_SpecAlpha.dds.
Now you get a menu box for setting the DXT Compression settings. Here you only need to alther the rolldown menu and select DXT3 Compression.
Then click Save.

To import it into the UEditor you need to launch the editor and open up the texture browser(Starts as default with the editor).

If you allready have a package this skin belongs to open it up first.
When done you need to import the texture. Select File->Import and select the .dds file you saved.
Now a little menu will appear here you need to hack off "Alpha Texture". And fill in the blanks where you want the texture to be placed. I placed mine in my Mariah package and under the sub menu Alpha.

Now you have the texture in the editor now do the same with the original texture if it's not allready there.

Now we need to create the effect that need to be on top of the texture we just created.
Jump to Photoshop and create something you want or use an allready existing cubemap. You can also use my texture I used. It's only a Lens flare on a black background(Filter->Render->Lens Flare).

Save this texture as dds or somthing the UEditor can read as well. If you choose the dds format select DXT1 compression when exporting from Photoshop, this will limit the filesize and it can't be seen on your skin/texture.
Simply import the texture you want as described before.
I placed mine in the Mariah package and under sub menu Alpha.

Now you need this to be somehow animated.
As we want something the looks like it's reflecting light realtime you should make a TexEnvMap. To do this you go to File->New and select TexEnvMap.
I named my new TexEnvMap "temmap" and placed it under the alpha sub menu.

Now you have the settings for the new TexEnvMap up you need to select the material it's going to use, in this case temmap. Do this by selecting temmap, in the background so it's highlighted, and go to the settings for temmap again here you select the area right from "Material" and select use. This will create you TexEnvMap. For best looks make the settings as mine.

Close this down, and create a new material. A Shader. Do the excact same as last time but this time select to create a Shader.
Now you have the shader properties up select the menu Diffuse and use the same procedure as last time you selected a material. Yet this time you need to select the head texture.
Should now look something like this.

Next thing you need to do is select the area "Specular" and use the same procedure as with the TexEnvMap to select your effect you will use. In my case "temmap".
It will look like this a first but this will be fixed.

Next we need to put the alpha channel texture we created in the "SpecularityMask" option. Use the same procedure as before, now you will have something looking a little like this.

If you notice I have a texture specified in "Opacity" as well. Disregard this if you don't have masked some things out(see the maksing tutorial).

Next thing you can put it one a model to look what it will be like ingame. Open up the "Animations" tab and open up the model you are skinning/editing. To the right you can put on the texture under the Skin->Material options. This won't affect anything as long as you keep your hands of the "Save" button/menu when in the "Animations" tab. Go back to the texture browser and save the texture package from there.

As mine has Masking in it you can see why I need a Final Blend.
The masking parts combined with the spec shader screws it up a bit.

If you have the same problem create a new Material and choose "Final Blend". Select the "Shader" you created for the Material and use these setting I used here.

Now this looks much better ay?

End of Tutorial.

Søren 'the_rex' Falk aka DaLoonie