addDynamicLight
addDynamicLight
i have:
rr::video::SLight DynamicLight1;
DynamicLight1.DiffuseColor = irr::video::SColorf(254.0f, 254.0f, 254.0f);
DynamicLight1.Radius= 200.0f;
DynamicLight1.CastShadows = true;
DynamicLight1.Position = irr::core::vector3df(0,0,10);
then i call
driver->addDynamicLight(DynamicLight1);
yet i see no light or shadows...what am i doing wrong?
rr::video::SLight DynamicLight1;
DynamicLight1.DiffuseColor = irr::video::SColorf(254.0f, 254.0f, 254.0f);
DynamicLight1.Radius= 200.0f;
DynamicLight1.CastShadows = true;
DynamicLight1.Position = irr::core::vector3df(0,0,10);
then i call
driver->addDynamicLight(DynamicLight1);
yet i see no light or shadows...what am i doing wrong?
-
- Posts: 360
- Joined: Tue Feb 10, 2004 2:20 am
- Location: Lubbock, TX
You have to set up a node's material to use dynamic light. You have to do this for each item that you want effected by dynamic ligt.
You do it like this:
You do it like this:
Code: Select all
node->setMaterialFlag(video::EMF_LIGHTING, true);
yah i checked that and still no dice.. the only way i can get lights in is to use:
levelNode = smgr->addLightSceneNode(0, irr::core::vector3df(100,0,0),
irr::video::SColorf(0.0f, 0.0f, 0.0f, 0.0f), 100.0f);
Yet I have no control over stuff lick cast shodows or not..thats why i was looking at addDynamicLight.. am i missing something??
levelNode = smgr->addLightSceneNode(0, irr::core::vector3df(100,0,0),
irr::video::SColorf(0.0f, 0.0f, 0.0f, 0.0f), 100.0f);
Yet I have no control over stuff lick cast shodows or not..thats why i was looking at addDynamicLight.. am i missing something??
-
- Posts: 602
- Joined: Sat Aug 23, 2003 2:03 am
- Location: Pottstown, PA
- Contact:
-
- Posts: 602
- Joined: Sat Aug 23, 2003 2:03 am
- Location: Pottstown, PA
- Contact:
-
- Posts: 50
- Joined: Tue Mar 09, 2004 9:53 pm
- Location: Spain
After you load the model, you must call addShadowVolumeSceneNode (see Irrlicht doc for more info), and you must change the ambient light with pVideoDriver->setAmbientLight(255,255,255);
I think it should work
I think it should work
There are only 10 types of people: those who understand binary and those who don't
--------------------------------------------
--------------------------------------------
let me explain what i'm trying to do..I want a dynamic light that does NOT cast shadows..but there will be others that will so just setting the flag on the model will not work..
after digging a little through the source i found the following..
in slight.h we have:
struct SLight
{
SLight() : AmbientColor, DiffuseColor,
SpecularColor,Position,Radius,
CastShadows
{};
but when the slight gets translated to directx in (CVideoDirectX9.cpp)
we get
D3DLIGHT9 light
in the D3DLIGHT9 structure there is no flag for cast shadows or not..so i think i'm going to have to look elsewhere... any clues niko??
after digging a little through the source i found the following..
in slight.h we have:
struct SLight
{
SLight() : AmbientColor, DiffuseColor,
SpecularColor,Position,Radius,
CastShadows
{};
but when the slight gets translated to directx in (CVideoDirectX9.cpp)
we get
D3DLIGHT9 light
in the D3DLIGHT9 structure there is no flag for cast shadows or not..so i think i'm going to have to look elsewhere... any clues niko??
-
- Posts: 50
- Joined: Tue Mar 09, 2004 9:53 pm
- Location: Spain
When you want to create a light that doesn't cast shadows, do this:
irr::video::SLight DynamicLight1;
DynamicLight1.DiffuseColor = irr::video::SColorf(254.0f, 254.0f, 254.0f);
DynamicLight1.Radius= 200.0f;
DynamicLight1.CastShadows = false; //<=== NO SHADOWS
DynamicLight1.Position = irr::core::vector3df(0,0,10);
driver->addDynamicLight(DynamicLight1);
For the other lights, you have to create them switching CastShadows to true, but although you need to call addShadowVolumeSceneNode (see the doc) every time you load an object, because if you don't do this, the objects won't cast any shadow. You have to know that the lights don't cast shadows, the objects cast shadows (I think I'm right xD).
Try that, I hope it works. Byee!!
irr::video::SLight DynamicLight1;
DynamicLight1.DiffuseColor = irr::video::SColorf(254.0f, 254.0f, 254.0f);
DynamicLight1.Radius= 200.0f;
DynamicLight1.CastShadows = false; //<=== NO SHADOWS
DynamicLight1.Position = irr::core::vector3df(0,0,10);
driver->addDynamicLight(DynamicLight1);
For the other lights, you have to create them switching CastShadows to true, but although you need to call addShadowVolumeSceneNode (see the doc) every time you load an object, because if you don't do this, the objects won't cast any shadow. You have to know that the lights don't cast shadows, the objects cast shadows (I think I'm right xD).
Try that, I hope it works. Byee!!
There are only 10 types of people: those who understand binary and those who don't
--------------------------------------------
--------------------------------------------
I think this is were the problem lies..I guess DynamicLight1.CastShadows is if the light ITSELF has a shadow..that would make since because when it gets translated to D3DLIGHT9 there is no option for shadows..I think i'll be able to achieve the effect i am after by looking at the ambient light settings..PadrinatoR wrote:You have to know that the lights don't cast shadows, the objects cast shadows