Feral Heart

Help & Guidance => Game Help => Topic started by: ApeEscape92 on August 22, 2016, 12:48:27 pm

Title: Help On Preset Coding
Post by: ApeEscape92 on August 22, 2016, 12:48:27 pm
I'm clear on how to do coding for presets to add special effects (i.e. moving textures, transparency, ect.), however what I am not familiar with is how to apply 'more than one' special effect coding. Do I place one code above another? If not, what should I look for in the coding material file so that I can apply extra coding affects?

Thank you for reading through my question, I appreciate it.
Title: Re: Help On Preset Coding
Post by: Kynvuu on August 22, 2016, 02:19:35 pm
Which two effects codes are you trying to use? I believe there is a way to blend them so that they work together but I would have to know which ones you are using in order to show you how c:
Title: Re: Help On Preset Coding
Post by: ApeEscape92 on August 22, 2016, 02:25:54 pm
I would really like to use the transparency code, the moving texture code, the glowing marking code, and the code which allows you to have flashing textures outside of the texture wall. It's going to be a complex preset...


but if I can AT LEAST get the transparency coding and the moving texture coding working together, I'll be satisfied.
Title: Re: Help On Preset Coding
Post by: Kynvuu on August 22, 2016, 02:29:42 pm
Hmm, logically thinking through this, the moving texture(If you are talking about the scrolling one, and not the animation one) as well as the transparency texture might not work together. The only reason I say this is because in order for the preset to scroll, you have to create a transparent part on the parent preset and then underlay a texture that scrolls wherever it is transparent. So if you intend to make a part invisible, the scrolling texture would override it. Personally I have not combined these two before nor do I know if its possible, but I'll dabble around a bit and see if I can get something that works c:

EDIT: Also do you want the whole preset to be scrolling or just one section under a fixed texture?
Title: Re: Help On Preset Coding
Post by: ApeEscape92 on August 22, 2016, 03:15:07 pm
Preferably one section under a fixed texture. I've done this before on multiple occasions. However, I can see where you're coming from. If those two fail to mesh, perhaps the transparent code and the glow marking code together would do just fine.
Title: Re: Help On Preset Coding
Post by: Kuri on August 22, 2016, 07:51:09 pm
i don't know what i'm doing but i've made 2 kinds before, one that had a scrolling texture that showed under a top layer with transparent holes in it.  If one particular transparent region wasn't supposed to have the scrolling or rotating texture you could possibly fake it by using animated layers that all have the same region that should remain transparent removed.
Title: Re: Help On Preset Coding
Post by: Whisperingwaves on August 22, 2016, 08:18:26 pm
Basically, you're trying to add multiple effects, correct?
(http://img12.deviantart.net/1625/i/2016/235/4/1/screenshot_04232016_013105938_by_whisperingwaves-daf10ko.png)

In order to do this, you'll need to mask off the different 'markings' or places you want each effect. These masks will need to be on a separate layer in your art program and transparent underneath.
Gonna use the mask to my IT preset as an example:
(http://pre14.deviantart.net/57f0/th/pre/f/2016/235/d/e/noxdot1mask_by_whisperingwaves-daf11ge.png)
I recommend using black for masking.
Now that you're masking is done, your material is next.

Let's have a look at Nox's preset code:
Code: [Select]
material NoxMat/BodyMat
{
receive_shadows on
technique
{
pass
{
ambient 1.000000 1.000000 1.000000 1.000000
diffuse 1.000000 1.000000 1.000000 1.000000
specular 0.050000 0.050000 0.050000 1.000000
emissive 0.000000 0.000000 0.000000 1.000000
cull_hardware none
cull_software none
scene_blend alpha_blend
alpha_rejection greater_equal 128
texture_unit
{
texture NoxBody.png
alpha_op_ex source1 src_texture src_texture
colour_op_ex blend_diffuse_alpha src_texture src_current
tex_address_mode wrap
filtering trilinear
}
}
pass
{
ambient 1.000000 1.000000 1.000000 1.000000
diffuse 1.000000 1.000000 1.000000 1.000000
specular 0.050000 0.050000 0.050000 1.000000
emissive 0.000000 0.000000 0.000000 1.000000
cull_hardware none
cull_software none
scene_blend alpha_blend
alpha_rejection greater_equal 128
texture_unit
            {
                texture NoxDot1Mask.png
                alpha_op_ex source1 src_texture src_texture
                colour_op_ex source2 src_texture src_texture
            }
            texture_unit
            {
              texture DotFlash1.png
scroll_anim 0.4 0.4
                colour_op_ex blend_diffuse_alpha src_texture src_current
}
}
pass
        {
ambient 1.000000 1.000000 1.000000 1.000000
diffuse 1.000000 1.000000 1.000000 1.000000
specular 0.010000 0.010000 0.010000 1.000000
emissive 0.000000 0.000000 0.000000 1.000000
cull_hardware none
cull_software none
scene_blend alpha_blend
alpha_rejection greater_equal 128
texture_unit
            {
                texture NoxDot2Mask.png
                alpha_op_ex source1 src_texture src_texture
                colour_op_ex source2 src_texture src_texture
            }
            texture_unit
            {
              texture DotFlash2.png
scroll_anim .1 .1
                colour_op_ex blend_diffuse_alpha src_texture src_current
}
}
pass
        {
ambient 1.000000 1.000000 1.000000 1.000000
diffuse 1.000000 1.000000 1.000000 1.000000
specular 0.010000 0.010000 0.010000 1.000000
emissive 0.000000 0.000000 0.000000 1.000000
cull_hardware none
cull_software none
scene_blend alpha_blend
alpha_rejection greater_equal 128
texture_unit
            {
                texture NoxLeafMask.png
                alpha_op_ex source1 src_texture src_texture
                colour_op_ex source2 src_texture src_texture
            }
            texture_unit
            {
              texture NoxChrome.png
scroll_anim .1 .1
                colour_op_ex blend_diffuse_alpha src_texture src_current
}
}
}
}

This is three different scroll codings. Just replace each pass with your own effect. Also, do not make marks on the actual body/head/tail texture, just masks on separate layers or it won't work.
Hopefully this helps out a little~ If you have any other questions, don't be afraid to ask.
Code Lines for Effects: Click Me (http://www.feral-heart.com/smf/index.php?topic=5665.0)

~ Whisper
Title: Re: Help On Preset Coding
Post by: Ruby1234 on August 22, 2016, 10:13:53 pm
I would like to note that this section

Code: [Select]
ambient 1.000000 1.000000 1.000000 1.000000
diffuse 1.000000 1.000000 1.000000 1.000000
specular 0.010000 0.010000 0.010000 1.000000
emissive 0.000000 0.000000 0.000000 1.000000

is simply the default render script, and can be removed without effecting the results.

Also, depending on your scrolling, it may look better to simply put the scrolling down first, then the actual texture over it. Types of masking can leave black/white edges, if you choose to use those colours, so I prefer to use this method, at least when it comes to scrolling.

For example, this:

(https://i.gyazo.com/7599008d5193dc2e96555eb529c0aef0.gif)

Is achieved by layering these on top of each other via coding, in this order:

(https://i.gyazo.com/d19ed17046ac40451d6662b3c2992f9c.png)

(https://i.gyazo.com/7f80d15767af138c9d57a8609e106bc7.png)

(https://i.gyazo.com/73e8029f3a9fea66b2a41e3ea89c07b8.png)

The basic structure of this code looks like this
Code: [Select]
material EXAMPLEMAT
{
technique
{
pass
{
ambient 0.5 0.5 0.5 1
texture_unit
{
texture scroll.png
scroll_anim 1.0 1.0
}
}
pass
{
ambient 0.5 0.5 0.5 1
scene_blend alpha_blend
texture_unit
{
texture body.png
}
}
pass
{
emissive 1.0 1.0 1.0 1
scene_blend alpha_blend
texture_unit
{
texture glow.png
}
}
}
}

If it turns out that you need to layer scrolling ON TOP of something, then the only way to do this is via the masking method which Whisper has provided. (+Fluff for Whis)
Title: Re: Help On Preset Coding
Post by: ApeEscape92 on August 23, 2016, 02:49:37 am
Thank you everyone for your help. I really appreciate it. :) I think I'm going to toy around with all of your suggestions, and see if I can figure it out. If I can, I'll post my solutions and results so others may indulge if they have the same problem.
Title: Re: Help On Preset Coding
Post by: Kerriki on August 23, 2016, 03:11:02 am
I think it is actually possible to get scrolling and transparency

There is a way to get scrolling on a mane with none of the blocky looking things (manes usually require transparency if you don't want the blocky look)

I'll link to this tutorial, and I think it could be translated back to non-mane body parts

http://www.feral-heart.com/smf/index.php?topic=53773.0

That's as far as I know, honestly xD Someone else will have to take a look at that tutorial and come up with a transparency and scrolling code for you
Title: Re: Help On Preset Coding
Post by: Ruby1234 on August 23, 2016, 12:35:28 pm
Went through my PMs right quick, since I knew I had sent one on masking before.
This may help you @EscapeReality, and maybe even @HidenShadow.

Here I illustrated the difference between using your actual texture and making it double as the mask, versus black/white masking, which usually leaves edges. (I promise I'm not trying to overwhelm you aaa)

Hullo, hullo!

No worries, a scrolling mane is possible without looking all gross!

All you need to do is split your scrolling texture into two separate textures, one will serve as a mask, the other as the actual scrolling source.

Copy your scrolling texture and cut it out according to fmanemask, found in:
FeralHeart > media > textures

(https://i.gyazo.com/9edd453bc2dc8cf7b5336fe60bd93019.png)

Save the new cutout version as whatever you want, I just use preset_#manemask.png

Use this code:
Code: [Select]
material preset_1_maneMat
{
technique
{
pass
{
cull_hardware none
cull_software none
alpha_rejection greater_equal 200
texture_unit
{
texture preset_1manemask.png
}
texture_unit
{
texture preset_1manemask.png
colour_op alpha_blend
}
texture_unit
{
texture preset_1scroll.png
scroll_anim 1.0 1.0
colour_op_ex blend_current_alpha src_texture src_current
}
}
}
}

Make sure you use the first two texture spots for the MASK, then only the last one is for the original scrolly texture.

Boom.
Done. c:

(https://i.gyazo.com/1b65990a31148f266f2c04daa2caf7f2.gif)

((ignore the fact that that is someone else's preset who also needed help. shhh.))

So you can see on the last .gif, the mane is using this method, and the head is using white masking.

Hope that also gives some insight. ;n;
Title: Re: Help On Preset Coding
Post by: ApeEscape92 on August 23, 2016, 06:50:47 pm
Thank you ^_^ Yes, it does help...  8)
Title: Re: Help On Preset Coding
Post by: Kerriki on August 24, 2016, 01:16:22 am
I'll go ahead and lock this up now since the issue appears to be solved