Author Topic: Combining codes in preset material files?  (Read 1387 times)

Offline cattails

  • ✨ mom said it's my turn on the xbox ✨
  • Curious Wanderer
  • *
  • Posts: 44
  • Country: 00
  • Floof-O-Meter: 11
  • bee movie was okay
    • littlefelines.deviantART.com
    • View Profile
Combining codes in preset material files?
« on: July 07, 2016, 02:25:13 am »
Hello!

I'm trying to create a preset for a character of mine that happens to be a fluffy white cat. The whole preset was created with ambient shading in the coding, as I'd like the shading to be more pronounced than FH's default coding will allow. This has worked out perfectly so far, but I'm running into problems with the mane. The code for transparency and the code for ambient shading would need to be combined in order to allow both effects to show properly. (Otherwise I'll have to choose between a glowing mane at night or a blocky mane 24/7)

I've tried dropping the ambient shading code in beneath "pass" and above "texture unit," but that didn't seem to work. Neither did tuning "lighting off" to "lighting on."

Here's what my mane code currently looks like:
Quote
material preset_1_maneMat
{
   technique
   {
      pass
      {
         lighting on
         cull_hardware none
         cull_software none
         scene_blend alpha_blend
         depth_write off
         ambient  0.75 0.74 0.73 1.0
         texture_unit
         {
            texture Preset1Mane.png
         }
      }
   }
}

Here's the two codes separately:
Transparency:
Quote
material preset_1_maneMat
{
   technique
   {
      pass
      {
         lighting off
         cull_hardware none
         cull_software none
         scene_blend alpha_blend
         depth_write off
         texture_unit
         {
            texture Preset1Mane.png
         }
      }
   }
}

Ambient:
Quote
{
   technique
   {
      pass
      {
        ambient  0.75 0.74 0.73 1.0
         texture_unit
         {
            texture Preset1Mane.png
         }
      }
   }
}

EDIT: Forgot to mention that I will be using the 'forward' or 'side' manes, not the 'fluffy' mane. It's probably not important, but I thought I'd mention it just in case it is. <3

Also, is it possible to combine animation (Gif/frame-by-frame style) with ambient shading? If you could help me out, that would be super neat. :y
« Last Edit: July 07, 2016, 02:46:50 am by CattaiIs »

Offline FreakAccident

  • Curious Wanderer
  • *
  • Posts: 30
  • Country: ca
  • Floof-O-Meter: 6
  • Avatar (c) me
    • http://tophatlady.deviantart.com
    • TortDoll
    • FilthyDrood
    • View Profile
    • Primitive Call
Re: Combining codes in preset material files?
« Reply #1 on: July 07, 2016, 03:45:35 am »

Combing code is possible, but not in the way you may think.

- These two codes can be combined, however, I don't know why you'd want ambiance on something transparent, since you won't really be able to see it. Ambient will control the light hitting the body, but since it'll be transparent... it won't be hitting anything.

- With that kind of code and the fact it's a mane, there are two different types of "transparency" codes.

          scene_blend alpha_blend


and

                       alpha_rejection greater_equal 128


Try this.


                                    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

You may change the line in orange to w/e your ambient numbers were set to.
No, I'm not new.
DeviantArt | TopHatLady
Connection Issues? Click me!
Sig By Arborath

Offline cattails

  • ✨ mom said it's my turn on the xbox ✨
  • Curious Wanderer
  • *
  • Posts: 44
  • Country: 00
  • Floof-O-Meter: 11
  • bee movie was okay
    • littlefelines.deviantART.com
    • View Profile
Re: Combining codes in preset material files?
« Reply #2 on: July 07, 2016, 04:02:47 am »
Unfortunately, that isn't working.


This is the reason I'd like ambient shading on the mane, by the way. As you can see in the picture, it appears to glow at night. :c 

Offline Kynvuu

  • #Grimstagram
  • Elder Grey Pelt
  • ****
  • Posts: 2,538
  • Country: us
  • Floof-O-Meter: 212
  • I'm not saying that it was aliens but...
    • View Profile
Re: Combining codes in preset material files?
« Reply #3 on: July 07, 2016, 05:03:42 am »
Not sure if it would work when combining the two, but I've heard that to solve the ugly blocky mane problem, you're going to want to delete the line of code that says "lighting on". I could be wrong as I'm not sure if it will apply with these two codes that your combining, but it may be worth a try c:

EDIT: Just realized you said you tried that already XD Sorry about that. Perhaps making the Alpha rejection greater than or equal to 128 would work?
« Last Edit: July 07, 2016, 05:06:12 am by Kynvuu »
On a temporary leave. Please contact other members of staff if you need assistance.

Offline FreakAccident

  • Curious Wanderer
  • *
  • Posts: 30
  • Country: ca
  • Floof-O-Meter: 6
  • Avatar (c) me
    • http://tophatlady.deviantart.com
    • TortDoll
    • FilthyDrood
    • View Profile
    • Primitive Call
Re: Combining codes in preset material files?
« Reply #4 on: July 07, 2016, 12:02:03 pm »
Unfortunately, that isn't working.


This is the reason I'd like ambient shading on the mane, by the way. As you can see in the picture, it appears to glow at night. :c 

You'll have to re-color your mane into a grey-ish shade. Pure white won't cut it.

- Does your mane have a texture, or is it just a blank white?
No, I'm not new.
DeviantArt | TopHatLady
Connection Issues? Click me!
Sig By Arborath