Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.

Mark Duffill

Lighting Problems, Additive Dynamic Lights

This topic is 5879 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Lighting Problems. What I require is the following:- RGB = (VertexRGB * GlobalAmbientRGB) + (MaterialDiffuseRGB * Lights[n]) A = (VertexA * MaterialDiffuseA); or RGB = (VertexRGB * GlobalAmbientRGB) + (1 * Lights[n]) A = (VertexA * MaterialDiffuseA); [Note: Texture RGBA are just modulated into this] So the vertex colour is modulated with the global ambient colour. Then the dynamic lights are added in on top. The Alpha component is modulated with either the MaterialDiffuse.Alpha or the TFactor.Alpha; The purpose is so you can have additive lights (which to my mind is the correct light model), example: Black poly with white texture will appear black until a dynamic light is effecting it. The closest I can get is the following:
	DXDisplay->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );
	DXDisplay->SetTextureStageState( 0, D3DTSS_COLOROP,   D3DTOP_MODULATE2X );
	DXDisplay->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE );

	DXDisplay->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );
	DXDisplay->SetTextureStageState( 0, D3DTSS_ALPHAOP,   D3DTOP_MODULATE  );
	DXDisplay->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE );

All works fine and dandy except the VertexA is lost due to the diffuse comming from the material, not the vertex. However if I do :- DXDisplay->SetRenderState( D3DRS_DIFFUSEMATERIALSOURCE, D3DMCS_COLOR1 ); I get my VertexA, (= VertexA * TFactorA), but loose the additive lights.ie Black Poly with white texture remains black when a dynamic light affects it. Any ideas other than a vertex shader? Or simply can you have a vertex alpha which would be a bit pants! (Shame global alpha cant come from ambient material ;( [The views stated herein do not necessarily represent the view of the company Eurocom ] Eurocom Entertainment Software www.Eurocom.co.uk The Jackal [edited by - mark duffill on June 10, 2002 12:08:03 PM]

Share this post

Link to post
Share on other sites
As far as I can tell from the directx sdk lighting equation you can either have additive lights with no vert alpha, or vert alpha with modulated lights.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!