Page 1 of 1

Problem with 3d lights

Posted: Sat Jul 16, 2005 1:43 am
by SoulReaper
Hello all :)

I have some kind of strange problem that is a brain teaser for me,
it happens when i set up a light for a sphere at z -1500 distance from the camera.

when i use the robot mesh it works fine, but when i use the sphere mesh
nothing happens... :cry:

maybe there is something that I dont know about meshs as i am still a bit new to the 3d stuff - but i am getting there slowly :wink:

I have included the test program
http://purebasic.myftp.org/?filename=files/76/Demo.zip

Thankyou for any help on this :)
Kevin

Posted: Sat Jul 16, 2005 8:25 am
by fweil
SoulReaper,

Nice to get some executable, but maybe for more help it would be better to send sources.

Otherwise, I (only my concern), can't help. Really sorry.

Rgrds

Posted: Sat Jul 16, 2005 9:04 am
by SoulReaper
Sorry about that some how the source file got omitted :lol:

The Link above has the updated file :wink:

to err is human :shock: :roll: :lol:

Posted: Sat Jul 16, 2005 3:13 pm
by Comtois
try this

Code: Select all

  D=600
  CreateLight(0, RGB(0,0,255), EntityX(1)-D, EntityY(1)-D,EntityZ(1)+D)
  CreateLight(1, RGB(255,0,0), EntityX(1)+D, EntityY(1)+D, EntityZ(1)+D)
Distance Light/Entity must be less than 1000

Posted: Sat Jul 16, 2005 4:50 pm
by SoulReaper
Thankyou very much Comtois :)

Sadly it did not help you see i have a sphere e.g. the moon but it has to be at a certain distance so the 3d objects that are in the foreground, dont get light up from the moons light source :cry:

maybe its me :? is there a better way of doing this ?
any comments welcome :wink: :)

Thankyou again in advance for your time :wink:
Kevin

Posted: Sat Jul 16, 2005 5:32 pm
by MadMax
You need to set the normals, if not lights will not affect the mesh.

Posted: Sat Jul 16, 2005 5:35 pm
by SoulReaper
Thankyou MadMax :)

I bet that is my problem :lol:
Thankyou all again for your time :wink: :) :lol:

Posted: Sat Jul 16, 2005 10:03 pm
by Comtois
MadMax wrote:You need to set the normals, if not lights will not affect the mesh.

Code: Select all

  D=600
  CreateLight(0, RGB(0,0,255), EntityX(1)-D, EntityY(1)-D,EntityZ(1)+D)
  CreateLight(1, RGB(255,0,0), EntityX(1)+D, EntityY(1)+D, EntityZ(1)+D)
If i do this small change in his code ,i can see light on his sphere , so i suppose normals are ok ?