Help & Guidance > Presets & Markings Tutorials

Updated 9/16/16 Material Coding for Beginners! Glow, metal, transparent, more!

(1/33) > >>

Ruby1234:
EDIT January 31st, 2022: This tutorial is being updated and moved to Google! Please refer to the new version wherever possible, as it has better optimisation & overall clarity.
https://docs.google.com/document/d/1otpZc7OyhgXwbK8KPFEl4ogVCACvSptYVBNI-uuFdac/edit?usp=sharing
The lion preset
used in this tutorial
came with FH and
does not belong to me,
nor do I claim it as mine.
Yay, time for fun. Well I find this fun anyways, no guarantee you will.
Anyhow, I'm going to be showin' ya a few things about material codes. You know, those things that are found in the presets folders? If you dun know what materials are, you probably shouldn't be here. :3

Kayso, if I dun do a code that you want, you can request one as a comment or PM.
So let's get right to it~

The codes for Preset Mane Fix and Scrolling are located here in the first post. All other codes will be linked below:
How to: Add Wings to Your Preset (Works with all presets, not just 11 & 12)
Ghost Code
Glow & Shading (Emissive & Ambient - Does not cover glowing markings.)
Metallic Markings
Transparent & Semi-Transparent
Glowing Markings
Preset Mane Fix-The first thing I'm going to start off with is the mane fix for presets, since this seems difficult for people to find. You only need this code if you're using anything but the fluffy mane.

Go to your preset's material file, open it in notepad.
Scroll down to the mane code (should be the very bottom, and should read something like this:)


--- Code: ---material preset_#_maneMat
{
technique
{
pass
{
lighting off
cull_hardware none
cull_software none
scene_blend alpha_blend
depth_write off
texture_unit
{
texture preset_#mane.png
}
}
}
}
--- End code ---

Now all you do is select that section, copy this:


--- Code: ---material preset_#_maneMat
{
        technique
        {
                pass
                {
                        cull_hardware none
                        cull_software none
                        alpha_rejection greater_equal 128
                        texture_unit
                        {
                                texture preset_#mane.png
                        }
                }
        }
}
--- End code ---

and paste this over the previous selection. Then look for the # signs in the code, and replace it with the preset's number, which is found in the name of that preset's files. If done correctly, you would be going from this:


to this:



_______________________________________

Scrolling-This works for meshes and presets, and this just makes the texture flow across the entire thing, or, if you wanted, you could restrict the flow to a certain spot, and have it be a certain color. For this example, and all examples to follow, I will be using presets. Let's get started.

Go to your material file, and open it in notepad.
You'll have the basic codes, which look something like this:


--- Code: ---material preset_#_bodyMatL
{
technique
{
pass
{
texture_unit
{
texture preset_#body.png
}
}
}
}
material preset_#_bodyMatR
{
technique
{
pass
{
texture_unit
{
texture preset_#body.png
}
}
}
}
material preset_#_headMatL
{
technique
{
pass
{
texture_unit
{
texture preset_#head.png
}
}
}
}
material preset_#_headMatR
{
technique
{
pass
{
texture_unit
{
texture preset_#head.png
}
}
}
}
material preset_#_eyeMatL
{
technique
{
pass
{
cull_hardware none
cull_software none
texture_unit
{
texture preset_#eye.png
}
}
}
}
material preset_#_eyeMatR
{
technique
{
pass
{
cull_hardware none
cull_software none
texture_unit
{
texture preset_#eye.png
}
}
}
}
material preset_#_tailMat
{
technique
{
pass
{
texture_unit
{
texture preset_#tail.png
}
}
}
}
material preset_#_maneMat
{
technique
{
pass
{
cull_hardware none
cull_software none
alpha_rejection greater_equal 128
texture_unit
{
texture preset_#mane.png
}
}
}
}
--- End code ---

I recommend that, like this code above, you change all your image formats to .png. It's just easier to work with materials that way.
Now, to get your textures to scroll, all you need to do is add the line:
scroll_anim 1.0 1.0
underneath the texture names, like so:


--- Code: ---material preset_#_bodyMatL
{
technique
{
pass
{
texture_unit
{
texture preset_#body.png
scroll_anim 1.0 1.0
}
}
}
}
material preset_#_bodyMatR
{
technique
{
pass
{
texture_unit
{
texture preset_#body.png
scroll_anim 1.0 1.0
}
}
}
}
material preset_#_headMatL
{
technique
{
pass
{
texture_unit
{
texture preset_#head.png
scroll_anim 1.0 1.0
}
}
}
}
material preset_#_headMatR
{
technique
{
pass
{
texture_unit
{
texture preset_#head.png
scroll_anim 1.0 1.0
}
}
}
}
material preset_#_eyeMatL
{
technique
{
pass
{
cull_hardware none
cull_software none
texture_unit
{
texture preset_#eye.png
scroll_anim 1.0 1.0
}
}
}
}
material preset_#_eyeMatR
{
technique
{
pass
{
cull_hardware none
cull_software none
texture_unit
{
texture preset_#eye.png
scroll_anim 1.0 1.0
}
}
}
}
material preset_#_tailMat
{
technique
{
pass
{
texture_unit
{
texture preset_#tail.png
scroll_anim 1.0 1.0
}
}
}
}
material preset_#_maneMat
{
technique
{
pass
{
cull_hardware none
cull_software none
alpha_rejection greater_equal 128
texture_unit
{
texture preset_#mane.png
scroll_anim 1.0 1.0
}
}
}
}
--- End code ---

Now, this will probably create a very weird looking preset, but might be okay on a mesh.
However, you can choose to restrict the flow, and have it be any texture you want. How you ask? Well, by layering it of course! Now, if you've ever tried to make layers on an image and use it in FH, it probably didn't work all that well. However, it is possible to layer images onto presets/meshes, using the material coding:



Let's get started.

Open your material and start with the basic coding again, but with .png formats again also.


--- Code: ---material preset_#_bodyMatL
{
technique
{
pass
{
texture_unit
{
texture preset_#body.png
}
}
}
}
material preset_#_bodyMatR
{
technique
{
pass
{
texture_unit
{
texture preset_#body.png
}
}
}
}
material preset_#_headMatL
{
technique
{
pass
{
texture_unit
{
texture preset_#head.png
}
}
}
}
material preset_#_headMatR
{
technique
{
pass
{
texture_unit
{
texture preset_#head.png
}
}
}
}
material preset_#_eyeMatL
{
technique
{
pass
{
cull_hardware none
cull_software none
texture_unit
{
texture preset_#eye.png
}
}
}
}
material preset_#_eyeMatR
{
technique
{
pass
{
cull_hardware none
cull_software none
texture_unit
{
texture preset_#eye.png
}
}
}
}
material preset_#_tailMat
{
technique
{
pass
{
texture_unit
{
texture preset_#tail.png
}
}
}
}
material preset_#_maneMat
{
technique
{
pass
{
cull_hardware none
cull_software none
alpha_rejection greater_equal 128
texture_unit
{
texture preset_#mane.png
}
}
}
}
--- End code ---

Now, we'll need two textures here.
1, your preset's actual texture:



and 2, the texture that will be scrolling. Normally, one picks a gradient to be scrolling, like my preset above:



Get your two textures and then come back.




Back? Okie.
Well, I'mma have to send you away again real quick. What you need to do now, is get your preset's actual texture, and take your /eraser/ tool, to make the markings, the place where you want the scrollyness to go. :3



So go do that if you dun have it done.




Back again? Okay.
Now it's time to layer it in with the coding.
Go to your code, and replace it with this one:


--- Code: ---material preset_#_bodyMatL
{
technique
{
pass
{
texture_unit
{
texture preset_#scroll.png
scroll_anim 1.0 1.0
}
}
pass
{
scene_blend alpha_blend
texture_unit
{
texture preset_#body.png
}
}
}
}
material preset_#_bodyMatR
{
technique
{
pass
{
texture_unit
{
texture preset_#scroll.png
scroll_anim 1.0 1.0
}
}
pass
{
scene_blend alpha_blend
texture_unit
{
texture preset_#body.png
}
}
}
}
material preset_#_headMatL
{
technique
{
pass
{
texture_unit
{
texture preset_#scroll.png
scroll_anim 1.0 1.0
}
}
pass
{
scene_blend alpha_blend
texture_unit
{
texture preset_#head.png
}
}
}
}
material preset_#_headMatR
{
technique
{
pass
{
texture_unit
{
texture preset_#scroll.png
scroll_anim 1.0 1.0
}
}
pass
{
scene_blend alpha_blend
texture_unit
{
texture preset_#head.png
}
}
}
}
material preset_#_eyeMatL
{
technique
{
pass
{
texture_unit
{
texture preset_#scroll.png
scroll_anim 1.0 1.0
}
}
pass
{
scene_blend alpha_blend
texture_unit
{
texture preset_#eye.png
}
}
}
}
material preset_#_eyeMatR
{
technique
{
pass
{
texture_unit
{
texture preset_#scroll.png
scroll_anim 1.0 1.0
}
}
pass
{
scene_blend alpha_blend
texture_unit
{
texture preset_#eye.png
}
}
}
}
material preset_#_tailMat
{
technique
{
pass
{
texture_unit
{
texture preset_#scroll.png
scroll_anim 1.0 1.0
}
}
pass
{
scene_blend alpha_blend
texture_unit
{
texture preset_#tail.png
}
}
}
}
material preset_#_maneMat
{
technique
{
pass
{
cull_hardware none
cull_software none
alpha_rejection greater_equal 128
texture_unit
{
texture preset_#mane.png
scroll_anim 1.0 1.0
}
}
}
}
--- End code ---

Now in notepad press Ctrl+H and it'll come up with replace (or just do Edit>Replace..)
and type in
_#
in the first box, then in the second type
_
and then after the underscore, put the number of your preset.
Then click replace all.
Now you may need to do some manual editing with the image names, because you might not have selected the same names as me.
But once you have everything pieced together, you should end up with a pretty nice result. :3


(Sorry, it came out low quality for some reason, I'll redo it later. xD)

Now, the line
scroll_anim 1.0 1.0
can be edited.
The numbers can be changed to even negative integers.
Just to create some other effects. :3

animals_rock:
Thanks for posting this. This will be very helpful c:

Ruby1234:

--- Quote from: animals_rock on August 25, 2012, 03:04:24 pm ---Thanks for posting this. This will be very helpful c:

--- End quote ---

You're welcome and thanks! :3

greystar:
AWESOMESAUCE
      Thy SO much i was wondering how 2. Now all i need to know is how to put pics in my FH acc >_>....

greystar:
Ok got it to work... how i make things INVISABLE? >:3

Navigation

[0] Message Index

[#] Next page

Go to full version