Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / a light that can illumine a big terrain

Author
Message
Alduce
23
Years of Service
User Offline
Joined: 26th Oct 2002
Location: Rama spaceship
Posted: 8th Nov 2012 13:45
Hi all, I made a really big X object as my terrain and I trying to put a light as the sun then a light that can to illumine all the terrain.

My attempts not working as I would and my light can illumine just a little portion of the terrain.
I tried to move the light source and to use some light commands but I can't obtain my light as a sun but just as a big lamp..

Here the code I am using:


I was trying to use the CREATE LIGHT MAPS command too but no better situation..
How I need to handle a sun light in DB?
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 8th Nov 2012 14:19
If you're using a point light then you need to make sure you're using sensible values for the light's range - the default values might not make sense in your project.

Check the set light range command.
Alduce
23
Years of Service
User Offline
Joined: 26th Oct 2002
Location: Rama spaceship
Posted: 8th Nov 2012 14:47 Edited at: 8th Nov 2012 14:48
In first thank you Green Gandalf.
I try to use the "set light range". This make me constrained to use the "make light" command too.

Now I have this code:


But when I add the "set light range" yes, I got a really much more illumination by the light but I get my object shadows disappear too...

I try to use the SET SHADOW LIGHT but I think it's not the right command to provide my objects the shadows back...
In fact when I change the light used number from 0 to 1 I can't get the object shadows..
why?

Ps: I am using "set point light" command but I am really NOT sure about.. I just would to get something near to be a sun for my 3D scene
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 8th Nov 2012 16:05 Edited at: 8th Nov 2012 16:56
Quote: "This make me constrained to use the "make light" command too."


No it doesn't. Light 0 is the default light and exists by default. It is initially set to a directional light but your command:



changes it to a point light and sets its position.

I'm not sure what your problem is. What exactly goes wrong with your original snippet when you add a suitable set light range value?

For a sun object you don't really need a positional light - the default directional light should be sufficient. All you need to do is set the light's direction correctly. For example, something like the following should work:



For shadows I think you need to do something similar but using light 1 (and probably hiding light 0). I'll post back with another demo soon.

Edit Simple demo with shadows. I get annoying self-shadowing on the sphere - and the shadow on the plain is too light in my opinion. But you do have shadows

Alduce
23
Years of Service
User Offline
Joined: 26th Oct 2002
Location: Rama spaceship
Posted: 8th Nov 2012 17:11
Ahh Green Gandalf you perfectly got it!
I changed your plain ground object with my BIG terrain object (an X object, really BIG, made using L3DT terrain creator) and I got my sun shining on my landscape and my object casting the shadow too.

Thank you!


Ps. Really cool how you handle vector for the light directions.. probably for you it's a easy trick but for me it's a little great code!
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 8th Nov 2012 17:14
Thanks for the feedback. Glad you got it working.

Login to post a reply

Server time is: 2026-07-09 01:51:36
Your offset time is: 2026-07-09 01:51:36