Hi there!
Well, I was searching for some lighting examples in wii-examples and gc-examples, but I couldn't find anything related. The only thing was this Hermes 3D manual, but I can't get lighting to work.
Whenever I try to set up a light in GX_LIGHT0, I end up messing up and get a dark red cube with two faces a bit clearer. (The cube is actually multicolored)
¿Do you know where can I find a comprehensive example, just the basic lighting?
Thanks for your help
Some HW lighting examples
Re: Some HW lighting examples
Hi,
i can't really show you a comprehensive example, but maybe this will help you too:
http://code.google.com/p/wiirrlichtcust/
It's a port of the IrrLicht engine i'm working on. Have a look into gxdriver.cpp for lightning.
Hope this helps.
regards
shagkur
i can't really show you a comprehensive example, but maybe this will help you too:
http://code.google.com/p/wiirrlichtcust/
It's a port of the IrrLicht engine i'm working on. Have a look into gxdriver.cpp for lightning.
Hope this helps.
regards
shagkur
Re: Some HW lighting examples
I have seen your code and more or less your code and I have more or less the same thing. But nope, still dark red....
¿what am I doing wrong?
¿What channels do i need to set?¿Maybe I have to do something with the Texture Enviroment?
I am not multiplying light_pos because I am using an orthogonal view, ¿do I have to multiply it by something?¿If so, what with?
So many questions... I'm so sorry
Thanks in advance
¿what am I doing wrong?
¿What channels do i need to set?¿Maybe I have to do something with the Texture Enviroment?
Code: Select all
GXLightObj light;
GXColor clight = {L->GetColor()[0]*255, L->GetColor()[1]*255, L->GetColor()[2]*255, L->GetColor()[3]*255};
Vector light_pos = {L->GetPosition()[0]*255,L->GetPosition()[1]*255,L->GetPosition()[2]*255};
GX_InitLightPosv(&light,&light_pos);
GX_InitLightColor(&light,clight);
GX_LoadLightObj(&light,GX_LIGHT0);
GX_SetNumChans(1);
GX_SetChanCtrl(GX_COLOR0A0, GX_ENABLE,GX_SRC_REG,GX_SRC_VTX,GX_LIGHT0,GX_DF_CLAMP,GX_AF_NONE);
GXColor Ambiente = {128,128,128};
GX_SetChanAmbColor(GX_COLOR0A0, Ambiente);
So many questions... I'm so sorry
Thanks in advance
Re: Some HW lighting examples
Hi,
do you use Normals in your vertex data? As this is needed for lightning calculations. Also you've to retrive the inverse-transposed matrix of the model-view matrix (which you loaded into the Position Matrix slot) and load it into the Normal Matrix slot.
Furthermore it's kinda hard to tell, from this small code snippet what's going wrong. This snippet seems okay to me so far.
regards
shagkur
do you use Normals in your vertex data? As this is needed for lightning calculations. Also you've to retrive the inverse-transposed matrix of the model-view matrix (which you loaded into the Position Matrix slot) and load it into the Normal Matrix slot.
Furthermore it's kinda hard to tell, from this small code snippet what's going wrong. This snippet seems okay to me so far.
regards
shagkur
Re: Some HW lighting examples
Well, I use normals directly exported from blender.Hi,
do you use Normals in your vertex data? As this is needed for lightning calculations. Also you've to retrive the inverse-transposed matrix of the model-view matrix (which you loaded into the Position Matrix slot) and load it into the Normal Matrix slot.
Furthermore it's kinda hard to tell, from this small code snippet what's going wrong. This snippet seems okay to me so far.
regards
shagkur
What I didn't coded is to load the inverse of the Model-view matrix in the normal matrix (first time hearing about this :S)
Reading the code I have seen this func:
GX_LoadNrmMtxImm (Mtx mt, u32 pnidx)
¿I guess that's where I load the inverse right?
Thanks a lot, I will try it as soon as I can
Who is online
Users browsing this forum: No registered users and 4 guests