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 / can i make light affect a mesh only from the top?

Author
Message
PAGAN_old
19
Years of Service
User Offline
Joined: 28th Jan 2006
Location: Capital of the Evil Empire
Posted: 2nd Feb 2009 04:18 Edited at: 2nd Feb 2009 04:28
lets say i have a land plane, i have a light circling vertically to simulate day/ night. and a blue skysphere.

i really like this system because the light that reflects from the sky sphere makes a very realistic effect. like for example, after the sun goes beyond the horizon, you can still see some light reflecting from the sky sphere for a while before it gets totally dark, just like in real life. And i do not want by any means to turn this light off.



The problem lies after the sun is under the terrain and its already dark , some of the surfaces of the terrain and the bottoms of all the objects is lit up and it makes thing look wrong and weird.



I have not been able to solve this problem. Van B told me i could use intersect object from the lightsourse through every vertex can solve this problem. but for some reason (even with sparkys collision) intersecting several hundred vertexes will ultimately kill my game. I guess this is a limitation of the DBP engine

I was thinking for a long time and came up with an idea. I just want a consultation on how possible is my idea and how may i get it to work.

my idea is to make it so the light only affects a certain object from the top. Something like affecting the faces that are from 0 to 180 degrees? and not affecting the faces that are facing away from the light.




finally there is a problem of faces that do end up facing the lightsourse (sun) even after the sun went all the way down (nighttime) These would be steep mountains. So pretty much it would end up with my mountains glowing in the middle of the night. This is one of the problems that i cant think a solution for.

.

I think it would be ok for the mountains to light up a for a short time after the sunset and before the sunrise because that's how it works in real life.

Once again, a reminder that turning off the light for this thing would not be a solution because i still need the lightsourse to light up a possible moon that ill stick in there (because it looks so cool, i tried it before some time ago and want to include it later on) as well as the reflection of light off the skysphere after the sunset/ before the sunrise makes it very realistic.

This is a very abstract solution to this, and my drawings are not 100% accurate to how my thing actually works, (more like 80% accurate) but they get the idea across.

I am asking for any suggestions/ critisism and help to polish this thing up and any other help anyone can offer

I know this idea is a little abstract, but i tried my best explaining it through my drawings


Thanks.

dont hate people who rip you off,cheat and get away with it, learn from them
Todd Riggins
20
Years of Service
User Offline
Joined: 29th Oct 2004
Location: Texas, USA
Posted: 2nd Feb 2009 04:57 Edited at: 2nd Feb 2009 04:57
Can you use 'Set Object Light" to turn your terrain object light off when the sun goes below a certain horizon level and then use 'Set Object Ambient' on the terrain to have some ambient lighting? Just guessing out loud...

Inspirational Music: Descent ][ Redbook Audio CD Soundtrack
PAGAN_old
19
Years of Service
User Offline
Joined: 28th Jan 2006
Location: Capital of the Evil Empire
Posted: 2nd Feb 2009 05:20
i was considering that. This would be way to sudden, like someone just suddenly turned off the light (on the certain object), the problem i am facing is making this transition smooth.

dont hate people who rip you off,cheat and get away with it, learn from them
Todd Riggins
20
Years of Service
User Offline
Joined: 29th Oct 2004
Location: Texas, USA
Posted: 2nd Feb 2009 05:42
Have you tried 'Set Shadow Setting On' on your terrain?

Inspirational Music: Descent ][ Redbook Audio CD Soundtrack
PAGAN_old
19
Years of Service
User Offline
Joined: 28th Jan 2006
Location: Capital of the Evil Empire
Posted: 2nd Feb 2009 06:27
yes, i did it kills my fps from 100 down to 5

dont hate people who rip you off,cheat and get away with it, learn from them
dark coder
22
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 2nd Feb 2009 08:49
Just use a shader, multiply the lighting term by ( worldNormal.y > 0.0f ), or if you want a slightly better transition then same as above but ( saturate( worldNormal.y * scaleFactor ) ), where scaleFactor is some number like 50.0f.

Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 2nd Feb 2009 12:37
Quote: "Just use a shader"


I hate to say this but I'm sure you don't need a shader for this.

You could probably just use color light to make the light gradually darker as it approaches the horizon.
Sven B
20
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 2nd Feb 2009 12:41
I also agree with Green Gandalf. Color light might do the trick. Though I'd use a combination of color light, set light range and set/color ambient light to make the light/dark effects.

PAGAN_old
19
Years of Service
User Offline
Joined: 28th Jan 2006
Location: Capital of the Evil Empire
Posted: 2nd Feb 2009 14:04 Edited at: 2nd Feb 2009 14:16
I was leaning more toward the idea of manipulating which surfaces under which angles are affected by light and which are not.

if a face is angled at more than 180 degrees , its not affected by light and if the light source is past a certain point the amount of light reflected on certain objects would fade away.

dont hate people who rip you off,cheat and get away with it, learn from them
PAGAN_old
19
Years of Service
User Offline
Joined: 28th Jan 2006
Location: Capital of the Evil Empire
Posted: 9th Feb 2009 03:55 Edited at: 9th Feb 2009 06:28
well, this idea is stupid anyway, there is no way i can check every single polygon without raping my FPS.

is there a way to control how much light a certain object recieves (like i have the sky sphere that needs all the light, but a terrain object will need to respond less to that light) i think diffuse might do the trick but i am not sure.

like something that controls what color the light is on certain objects

dont hate people who rip you off,cheat and get away with it, learn from them
Chris K
21
Years of Service
User Offline
Joined: 7th Oct 2003
Location: Lake Hylia
Posted: 9th Feb 2009 11:10
What you are asking for is simulating shadows - there is not way of cheating that unfortunately. Each face needs to know where all the other faces are because they might be casting a shadow on it.

I would just fade the light level of the ground and moon based on the sun position.

-= Out here in the fields, I fight for my meals =-
PAGAN_old
19
Years of Service
User Offline
Joined: 28th Jan 2006
Location: Capital of the Evil Empire
Posted: 9th Feb 2009 21:08
yeah, i am doing that now. faiding the light is better than nothing

dont hate people who rip you off,cheat and get away with it, learn from them

Login to post a reply

Server time is: 2025-06-18 07:51:01
Your offset time is: 2025-06-18 07:51:01