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 / stopping light from passing through terrain or walls?

Author
Message
Lost Coder
16
Years of Service
User Offline
Joined: 6th Aug 2009
Location: Lost in Space.
Posted: 30th Apr 2010 07:29
I'm new to dbp and have few posts on the forums. As I like to
figure things out, read posts and try the methods that others
have, but this has me baffold. Plus I have seen a post that asked
this same question but did not get an anwser.

As my sun moves in the sky and drops below the terrain, the light
of the sun treats the terrain as if its transparent and the light
shines through it.

I need to keep the sun on constant but may allow for it's
brightness to deminsh as it sets and then increase as the sun
rises. Im not good at finding a way to code this,
( dumb thought -I like 360 as the number of degrees - insted of sin/cosin )

Also - I would like to have shadows of all items on / above terrain
show globaly insted of adding :



On every object.


My full code:



Thank you
Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 30th Apr 2010 15:15
Standard lighting doesn't allow for shadow casting, so really I think you need a shadow shader, or something like that. It's pretty advanced stuff, but I think the best example is Evolved's terrain and water system, cast shadows, even from transparent textures, and it looks great:

http://www.youtube.com/user/EVOLVEDUK#p/u/5/sAaIFUMfEuM

Most of Evolved stuff was uploaded with source on his website, well worth checking out if you can find it.


Health, Ammo, and bacon and eggs!
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 30th Apr 2010 15:29
Quote: "Most of Evolved stuff was uploaded with source on his website, well worth checking out if you can find it."


Here you go:

http://www.evolved-software.com/
Lost Coder
16
Years of Service
User Offline
Joined: 6th Aug 2009
Location: Lost in Space.
Posted: 1st May 2010 21:32 Edited at: 4th May 2010 07:15
Thank you for shadow shader links, shadows are a big part for outside realism.

As to the first part of my question, and mian part, How to stop
the standard lighting from go though the terrain mesh / texture?

As the sun ( light 0 )passes below the terrain mesh on it's
rotation path, the light penitrates passed the terrain mesh and lights the bottom of the sphere (Sphere 3)

Is there a way to keep the light from pennitrating trough the
terrain?

Thank You.

Login to post a reply

Server time is: 2026-07-26 21:43:46
Your offset time is: 2026-07-26 21:43:46