This project is read-only.

Light Opacity

Jan 26, 2011 at 10:37 AM
Edited Jan 26, 2011 at 2:40 PM

Any plans for being able to alter a light's opacity? I was assuming passing an alpha to Light.Color would work:



light1.Color = new Color(255, 255, 255, 50);


... but it makes no difference. Would be really helpful; obviously I can manually change the opacity of a texture, but it's not ideal. Setting a light's alpha would allow some nice simple effects at game time (flickering lights, searchlights that get stronger, etc)



EDIT: rather than starting a new thread - just wanted to say this is an awesome project. Really nice work, well done and thanks :D

Jan 26, 2011 at 7:26 PM
Edited Jan 26, 2011 at 7:26 PM

I'll add it in later this evening and post back here. I guess I forgot to include that :)

Jan 27, 2011 at 3:06 AM


Also, thanks :) I didn't notice your edit before...

Jan 27, 2011 at 4:55 AM

Ha, I started on this, then realized you updated the file. Whoops!

Jan 27, 2011 at 8:22 AM
Edited Jan 27, 2011 at 9:25 AM

Awesome stuff, thanks :D

Jan 27, 2011 at 11:07 AM

Lights created with:

helper.Effect.CurrentTechnique = helper.Effect.Techniques["LightTexture"];

... instead of SimpleTexture, which is the current default, don't seem to cast shadows, they're just laid on top of the game scene.... Am I missing something?

Jan 27, 2011 at 2:04 PM

Weird... sounds like a difference in GPUs... I'll take a look at it later and see what I can find. What GPU are you using?

Jan 27, 2011 at 2:09 PM


when you get a chance, can you see if the update is working for you?

Jan 27, 2011 at 4:07 PM

Sure, I'm testing it out today. I'll go back over what you added to see if there is any difference from my local copy.

Jan 27, 2011 at 6:49 PM

The only difference between the SimpleTexture and LightTexture techniques is that alpha blending is enabled. I've confirmed that this worked on my box, so back to xixonia's question, what GPU are you using?

Jan 27, 2011 at 7:38 PM

An Nvidia GTX470... that's weird. I'm going to retry now, see if I can narrow down what's going on more...

Jan 27, 2011 at 7:45 PM

Huh, weird. Now I'm investigating, it's only newly-created PointLights that are having an issue; my old pre-existing one works fine (casts shadows + alpha). That makes no sense, since a 'saved' light is just the position/ RGBA that gets created according to those factors.

Am assuming this is a problem my end, sorry guys...

Jan 27, 2011 at 7:49 PM
Edited Jan 27, 2011 at 7:50 PM

Ah... actually. Have narrowed it down; it's a multiple lights issue. Only one light source at a time casts shadows, under LightTexture... I'm pretty sure this isn't my end anymore ;)

Edit: to confirm, under 'simpleTexture', multiple lights on the scene at once still cast shadows perfectly...

Jan 27, 2011 at 9:08 PM

Thanks for the research! I didn't mean to point fingers, just wanted to get to rule out any problems and I was able to reproduce the situation this afternoon. We found the bug in the shader file, turns out we should have disabled the alpha blend state before drawing the shadows. The effect file is definitely on our to-do list for cleanup and more features :)

Try out change set 2450 that I just posted, and see if that works any better for you.

Jan 28, 2011 at 8:16 AM

Awesome stuff, thank you guys. Plugging in the latest changeset now.


 I didn't mean to point fingers, 

Ha ha, not at all! I'm really digging the project, it's lifted my engine immeasurablty, I'm keen to help out any way I can. Unfortunately at the moment that means poking when stuff goes squiffy ;)


Jan 28, 2011 at 8:21 AM

Latest changeset seems to work swimmingly. Ta :)

Jan 28, 2011 at 9:16 AM

Awesome! Glad you're enjoying it. :)