Problem with 3d lights

Advanced game related topics
SoulReaper
Enthusiast
Enthusiast
Posts: 372
Joined: Sun Apr 03, 2005 2:14 am
Location: England

Problem with 3d lights

Post 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
fweil
Enthusiast
Enthusiast
Posts: 725
Joined: Thu Apr 22, 2004 5:56 pm
Location: France
Contact:

Post 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
My avatar is a small copy of the 4x1.8m image I created and exposed at 'Le salon international du meuble à Paris' january 2004 in Matt Sindall's 'Shades' designers exhibition. The original laminated print was designed using a 150 dpi printout.
SoulReaper
Enthusiast
Enthusiast
Posts: 372
Joined: Sun Apr 03, 2005 2:14 am
Location: England

Post 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:
User avatar
Comtois
Addict
Addict
Posts: 1432
Joined: Tue Aug 19, 2003 11:36 am
Location: Doubs - France

Post 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
Please correct my english
http://purebasic.developpez.com/
SoulReaper
Enthusiast
Enthusiast
Posts: 372
Joined: Sun Apr 03, 2005 2:14 am
Location: England

Post 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
MadMax
Enthusiast
Enthusiast
Posts: 237
Joined: Mon Oct 06, 2003 11:56 am

Post by MadMax »

You need to set the normals, if not lights will not affect the mesh.
SoulReaper
Enthusiast
Enthusiast
Posts: 372
Joined: Sun Apr 03, 2005 2:14 am
Location: England

Post by SoulReaper »

Thankyou MadMax :)

I bet that is my problem :lol:
Thankyou all again for your time :wink: :) :lol:
User avatar
Comtois
Addict
Addict
Posts: 1432
Joined: Tue Aug 19, 2003 11:36 am
Location: Doubs - France

Post 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 ?
Please correct my english
http://purebasic.developpez.com/
Post Reply