Author Topic: How do you get the fade out to invisible, and come back, script to work? (preset  (Read 4703 times)

Offline Bayo.Nettan

  • Curious Wanderer
  • *
  • Posts: 36
  • Floof-O-Meter: 2
  • Floof~
    • View Profile
Hey, Im making a preset, and im confused on how the the fade invisible and coming back scrip works. Can anyone show me how?

Offline OreoHeroz

  • Taco-Hat
  • Elder Grey Pelt
  • ****
  • Posts: 3,225
  • Country: 00
  • Floof-O-Meter: 142
    • View Profile
Ruby has a topic for Glowing, Metallic, Transparent, Animated, & more for Material Coding - click me. I hope that's what you mean.

Offline Bayo.Nettan

  • Curious Wanderer
  • *
  • Posts: 36
  • Floof-O-Meter: 2
  • Floof~
    • View Profile
Nope. Already looked at that. None of them have fading script.

Offline OreoHeroz

  • Taco-Hat
  • Elder Grey Pelt
  • ****
  • Posts: 3,225
  • Country: 00
  • Floof-O-Meter: 142
    • View Profile
Stumped by this then. I don't know if there is a tutorial about that yet, but I'll keep looking till a smarter person comes along.

Offline Bayo.Nettan

  • Curious Wanderer
  • *
  • Posts: 36
  • Floof-O-Meter: 2
  • Floof~
    • View Profile
haha, thanks for the help. ^.^

Offline Ruby1234

  • Mean Tutorial Queen
  • Elder Grey Pelt
  • ****
  • Posts: 2,794
  • Country: us
  • Floof-O-Meter: 297
  • aka Phloxenfree.
    • View Profile
There are a couple of ways to do this.
Usually, I enable semi-transparency, and then make several different images of 1 image, with less opacity every time, usually in increments of 5 or 10. For example, if I want the body to fade in and out of transparency, I'll make 11 images;
preset_#body100.png
preset_#body90.png
preset_#body80.png
and so on, with the numbers representing the opacity I've set that specific image to.
Then in the code, I would make the textures animated, meaning switching between all eleven, at a rate in which I can set.
Example;
Code: [Select]
material preset_#_bodyMatL
{
technique
{
pass
{
depth_check on
depth_write off
scene_blend alpha_blend
texture_unit
{
anim_texture preset_#body100.png preset_#body90.png preset_#body80.png preset_#body70.png preset_#body60.png preset_#body50.png preset_#body40.png preset_#body30.png preset_#body20.png preset_#body10.png preset_#body0.png 0.5
}
}
}
}
material preset_#_bodyMatR
{
technique
{
pass
{
depth_check on
depth_write off
scene_blend alpha_blend
texture_unit
{
anim_texture preset_#body100.png preset_#body90.png preset_#body80.png preset_#body70.png preset_#body60.png preset_#body50.png preset_#body40.png preset_#body30.png preset_#body20.png preset_#body10.png preset_#body0.png 0.5
}
}
}
}
This code goes through all of my images on the preset's body, making it appear to fade, at a rate of 0.5 seconds per image.
Of course, you can edit this and change it to your needs, maybe only a certain layer of your preset needs this, or whatnot.
But this is just a little something to help you use it.
If you were looking for a different way of doing it, let me know? c:

Offline OreoHeroz

  • Taco-Hat
  • Elder Grey Pelt
  • ****
  • Posts: 3,225
  • Country: 00
  • Floof-O-Meter: 142
    • View Profile
There are a couple of ways to do this.
Usually, I enable semi-transparency, and then make several different images of 1 image, with less opacity every time, usually in increments of 5 or 10. For example, if I want the body to fade in and out of transparency, I'll make 11 images;
preset_#body100.png
preset_#body90.png
preset_#body80.png
and so on, with the numbers representing the opacity I've set that specific image to.
Then in the code, I would make the textures animated, meaning switching between all eleven, at a rate in which I can set.
Example;
Code: [Select]
material preset_#_bodyMatL
{
technique
{
pass
{
depth_check on
depth_write off
scene_blend alpha_blend
texture_unit
{
anim_texture preset_#body100.png preset_#body90.png preset_#body80.png preset_#body70.png preset_#body60.png preset_#body50.png preset_#body40.png preset_#body30.png preset_#body20.png preset_#body10.png preset_#body0.png 0.5
}
}
}
}
material preset_#_bodyMatR
{
technique
{
pass
{
depth_check on
depth_write off
scene_blend alpha_blend
texture_unit
{
anim_texture preset_#body100.png preset_#body90.png preset_#body80.png preset_#body70.png preset_#body60.png preset_#body50.png preset_#body40.png preset_#body30.png preset_#body20.png preset_#body10.png preset_#body0.png 0.5
}
}
}
}
This code goes through all of my images on the preset's body, making it appear to fade, at a rate of 0.5 seconds per image.
Of course, you can edit this and change it to your needs, maybe only a certain layer of your preset needs this, or whatnot.
But this is just a little something to help you use it.
If you were looking for a different way of doing it, let me know? c:

Sorry - i'm interested in making one as well, so I hope you don't mind me asking: Where would I put the code for the material file?

Offline Ruby1234

  • Mean Tutorial Queen
  • Elder Grey Pelt
  • ****
  • Posts: 2,794
  • Country: us
  • Floof-O-Meter: 297
  • aka Phloxenfree.
    • View Profile
I'm not certain I understand your question entirely, so forgive me if I repeat what you already know:
This code would replace the two body sections in whatever preset's .material you would want to use.
You can copy/paste it into there, then press Ctrl & H in notepad to bring up the Replace menu. Type in _# and have it replace it with an underscore _ and then whatever number that preset is. (Ex. _2)
Or, you can use this same format, and your own image names. Most of this code is simplified to only what is essential to the desired effect, but the image names can be changed.
« Last Edit: October 06, 2013, 08:15:08 pm by Ruby1234/xRubyx »

Offline Bayo.Nettan

  • Curious Wanderer
  • *
  • Posts: 36
  • Floof-O-Meter: 2
  • Floof~
    • View Profile
But ruby, on my preset, I want a picture of a sun to fade away then come back, but on the base body. How do I do that, because on your code, it has nowhere to place a base.

Offline Ruby1234

  • Mean Tutorial Queen
  • Elder Grey Pelt
  • ****
  • Posts: 2,794
  • Country: us
  • Floof-O-Meter: 297
  • aka Phloxenfree.
    • View Profile
As I said, that code was just a basic idea of how the effect works, and it will take some editing to get it to work properly.
If you want a base image, just layer that in above the rest of it.
Code: [Select]
material preset_#_bodyMatL
{
technique
{
pass
{
texture_unit
{
texture baselayeryay.png
}
}
pass
{
depth_check on
depth_write off
scene_blend alpha_blend
texture_unit
{
anim_texture preset_#body100.png preset_#body90.png preset_#body80.png preset_#body70.png preset_#body60.png preset_#body50.png preset_#body40.png preset_#body30.png preset_#body20.png preset_#body10.png preset_#body0.png 0.5
}
}
}
}