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 / 3D fade .. Nees a help !

Author
Message
Moaz
15
Years of Service
User Offline
Joined: 18th Jan 2011
Location:
Posted: 19th Jan 2011 02:25
Hi,
I am working in a new project and i need a help.
see this shot :

What I want is to make a lighting effect, so the end of the edge be darker and the player cant see what's at the end .. like this :



yes, i want to make an infinity path effect, and for the texture I'm gonna handle it later.

this is the code :


the whole project is attached !
thanks.
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 19th Jan 2011 10:51 Edited at: 19th Jan 2011 10:52
I'm going to guess that you are wanting to have the area around your player light (as if he's carrying a lantern?) but fading into darkness?

That being the case you just need to turn the ambient light off (light zero) and make a new light (maybe light 1) which has a range set to whatever distance you want visible. Then you just need to place the light wherever your player is positioned each loop.

If you get stuck with any of that post it here and I'll take another look

baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 19th Jan 2011 12:04
Here's an edit to your code but your world object will need to be made from more polygons for lighting to work properly as light is calculated based on distance from vertices:


Moaz
15
Years of Service
User Offline
Joined: 18th Jan 2011
Location:
Posted: 19th Jan 2011 19:19
Thanks baxslash for replying .
well, I did the changes but i got some strange results !
So, I increased the world's segments and it got better, but not that great, it stills awful!!



i want a result like this :

(from Peter's photostream )
Mobiius
Valued Member
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 19th Jan 2011 19:27
Turn fog on?

My signature is NOT a moderator plaything! Stop changing it!
Moaz
15
Years of Service
User Offline
Joined: 18th Jan 2011
Location:
Posted: 19th Jan 2011 21:24
Quote: "Turn fog on?
"

it works .. but i had to put a black plane at the end .

Thank you both for your help .
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 19th Jan 2011 22:49
Fog will have the same result unless you increase the number of polys even more. At least that's my experience.

Moaz
15
Years of Service
User Offline
Joined: 18th Jan 2011
Location:
Posted: 20th Jan 2011 00:11
Quote: "Fog will have the same result unless you increase the number of polys even more. At least that's my experience.
"


yes, but i must increase polys too much to have a neat smooth effect, but with fog i can get a better result without the need to increase polys which take the fps down!
Mobiius
Valued Member
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 20th Jan 2011 01:42
Quote: "it works .. but i had to put a black plane at the end "

Color the backdrop black (And turn it on of course)

My signature is NOT a moderator plaything! Stop changing it!
Moaz
15
Years of Service
User Offline
Joined: 18th Jan 2011
Location:
Posted: 20th Jan 2011 01:50


yeah of course, i did that but i forgot to mention
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 20th Jan 2011 10:00
Quote: "Color the backdrop black (And turn it on of course)"

Doesn't "color backdrop" turn it on by default? It worked in the code I posted...

Moaz
15
Years of Service
User Offline
Joined: 18th Jan 2011
Location:
Posted: 20th Jan 2011 12:58
Quote: "Doesn't "color backdrop" turn it on by default? It worked in the code I posted...
"

It does.
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 20th Jan 2011 16:23
But it's nicer to turn it on anyway, just in the event Windows 8 doesn't turn it on when using that command...

TheComet

baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 20th Jan 2011 16:26
I guess it's only one line of code

Indicium
18
Years of Service
User Offline
Joined: 26th May 2008
Location:
Posted: 20th Jan 2011 19:14
Would it be better to use a shader for the light?

Moaz
15
Years of Service
User Offline
Joined: 18th Jan 2011
Location:
Posted: 21st Jan 2011 00:42
Of course it would be better, but the problem is , i don't know how .
Moaz
15
Years of Service
User Offline
Joined: 18th Jan 2011
Location:
Posted: 21st Jan 2011 00:45
but for now, i thinks it's okay, just few touches on the textures and some normal maps with couple of light maps .. it'll be awesome !

Login to post a reply

Server time is: 2026-07-18 02:09:06
Your offset time is: 2026-07-18 02:09:06