Direct3D IM Ambient Lighting Problems

Started by
5 comments, last by Andy S 23 years, 11 months ago
Hi! I''m currently developing a terrain renderer using Direct X6.1 and coming across some problems related to the Ambient Lighting parameters whilst rendering. I''m using a Diamond Monster 3DII (Voodoo2) graphics card. If I''m using multi-texturing and blending two textures together then it appears that changes in the general ambient Lighting level do not affect the colour of the final polygons. However, if I''m only using single texture rendering (i.e. one stage in the rendering pipeline) then changes to the ambient lighting level directly affect the final polygon colour. When multi-texturing, I''m using DIFFUSE / TEXTURE as the arguments for the 1st stage and CURRENT / TEXTURE as the arguments for the 2nd stage. If I change the diffuse colour of the material used in the 1st stage then I''m pretty sure it would affect the colour of the rendered polygons, but I would have expected a change in the general ambient colour to also have an effect. Can anyone offer any pointers as to what''s happening ? Many thanks.
Advertisement
(I''m not using DX6.1 anymore and they have changed the lighting code for DX7 so I''m not sure if this applies.)

I think that if you change the ambient color of the material you''ll notice some difference.

What blending function do you use for you second texture? If you''re not careful the second texture might hide the color from the material and lighting.

- WitchLord

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Voodoos 1/2/3 can only apply diffuse to the last texture stage. Voodoos have a third stage that can be used only for adding duffuse. For the affect you want try using something like this (this if off the top of my head so I hope it''s right).

Stage0 Arg1: Texture
Stage0 Op: Select Arg One

Stage1 Arg1: Texture
Stage1 Arg2: Current
Stage1 Op: Modulate

Stage2 Arg1: Diffuse
Stage2 Arg2: Current
Stage2 Op: Modulate

It''s kind of a pain having different setup code for different cards...
What mechanism do you use for differentiating onr card form another?

---
Rob

See other worlds at http://www.silverfrost.com
---RobSee other worlds at http://www.silverfrost.com
I Don''t really. I just set it up the normal way, then call ValidateDevice. If that fails, then I set it up the Voodoo way, then call ValidateDevice. If that fails...

BTW - make sure to have a Texture selected in both Stages when ValidatingDevices, otherwise ValidateDevice may pass for the normal setup for a Voodoo (I got hung up on that for a long time)
You may be able to use IDirectDraw7::GetDeviceIdentifier to retrieve information about a video card. Here''s the structure it stores info in (as from the SDK):

typedef struct tagDDDEVICEIDENTIFIER2 {
char szDriver[MAX_DDDEVICEID_STRING];
char szDescription[MAX_DDDEVICEID_STRING];
LARGE_INTEGER liDriverVersion;
DWORD dwVendorId;
DWORD dwDeviceId;
DWORD dwSubSysId;
DWORD dwRevision;
GUID guidDeviceIdentifier;
DWORD dwWHQLLevel;
} DDDEVICEIDENTIFIER2, * LPDDDEVICEIDENTIFIER2;
Thanks Don, that's a very crucial piece of information to know when multi-texturing with light on a Voodoo card !

The stages / operations you suggested worked exactly how I intended.

Thanks also to all who replied.

Edited by - Andy S on May 27, 2000 4:33:37 AM

This topic is closed to new replies.

Advertisement