XNA Creators Club Online
Page 1 of 1 (3 items)
Sort Posts: Previous Next

effect.Alpha & Spotlights

Last post 03/11/2007 15:56 by Byron Nelson. 2 replies.
  • 03/11/2007 10:03

    effect.Alpha & Spotlights

    Dear Group,

    Can someone give me a quick overview of what effect.Alpha is supposed to do?

    I have two spheres, one drawn in front of the other.  I draw the second (the one in front) with alphablending enabled in the graphicsdevice and I get a very nice blending.  Exactly what I want.  From there, I tend to experiment with various settings to understand what they do.

    Effect.Alpha confuses me.  It takes a float, so I'm assuming it can be something set across a range of values, but it only seems to have two effects.  If it is zero, the alpha blended object does not appear.  Any other value, it does appear, yet the value of the setting does not seem to alter how it appears.

    A second question.  Is there anything like the openGL spotlight in XNA where you can set the origin, direction, and size of the spotlight?   I see the directional lights in basiceffect, but I don't believe they will do what I want based on the settings I can uncover (i.e., something like a flashlight in a dark room).

    Thanks in advance,

    Byron

    ..shaders make you feel... powerful, or very very stupid.
    http://drjbn.spaces.live.com/
  • 03/11/2007 12:01 In reply to

    Re: effect.Alpha & Spotlights

    Answer
    Reply Quote
    DrJBN:

    Effect.Alpha confuses me.  It takes a float, so I'm assuming it can be something set across a range of values, but it only seems to have two effects.  If it is zero, the alpha blended object does not appear.  Any other value, it does appear, yet the value of the setting does not seem to alter how it appears.

    What "any other value" did you try specifically?

    The alpha property ranges from 0 to 1. It controls the opacity of the output color.

    DrJBN:

    A second question.  Is there anything like the openGL spotlight in XNA where you can set the origin, direction, and size of the spotlight?   I see the directional lights in basiceffect, but I don't believe they will do what I want based on the settings I can uncover (i.e., something like a flashlight in a dark room).



    BasicEffect only supports directional lights, but you can do anything you want by writing a custom shader. Check out the Shader Series of samples on this site to help you get started.
    XNA Framework Developer - blog - homepage
  • 03/11/2007 15:56 In reply to

    Scaling and effect.Alpha & Spotlights

    Thanks Shawn, I appreciate it.  I tried 0, 1, and .5, then values greater than 1.  The difference between 1 & .5 with my spheres wasn't noticable, but I can see differences between 0 and .2.

    I'll delve into the Shader series shortly, and I'm sure I'll be crying for help.  

     

    Best,

    Byron

    ..shaders make you feel... powerful, or very very stupid.
    http://drjbn.spaces.live.com/
Page 1 of 1 (3 items) Previous Next