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 / Light's glare hide / show, depending on visibility

Author
Message
Quel
17
Years of Service
User Offline
Joined: 13th Mar 2009
Location:
Posted: 6th Sep 2010 00:51
This is not necessarily a "HELP!!!" kinda thread, i may say some new things to somebody, at least would be cool

I've been thinking about this one for a couple weeks, and can't say i haven't come up with solutions, but of course, i would need the most reliable still the fastest way.

Two solutions i came up with and feel they would somewhat work:

1.: Give the light source (or its center / or a limb attached, whatever...) some not so common color, then check the pixel's color at 'object screen X,Y' and if it is that special color it means the light source is visible, otherwise hide the glare. Downsides are like if something also with the 'special color' comes in front of the light, it will still be visible. Also the pixel color checking commands are horribly slow.

2.: Been thinking of the built in "intersect object" command to check any collision from the light to the camera's position, and it would hide the glare, if anything crosses its way.

Have been struggling with a hidden matrix to be used as a collision surface under my 3dMax made level, but then left it alone for a while when i realized there was a command like it. However i quickly came back to my collision matrix since the slowdown was horribly massive, on the other hand with the matrix i can check thousands of height datas without slowing, which let's me make some awesome ground effects around my characters.

Uh this became a little long. Anyway, so this intersect object command seems slow as hell, however with some tricks like 'only used once in a second' or a timed usage of 'one light source per one frame' could help it out, and seems for now i'm gonna stick to it, but if anybody has other solutions and experiences, could you share it please?..

(are the 'intersect' kinda commands in user made DLL's faster than the built in command?)

Also, the method for displaying the actual glare, what do you suggest would be the most beautiful (assuming i use a nice glare texture of course, so i mean here, a method which doesn't decrease the quality) and speedy? If i recall correctly once i rushed over the forum just for fun and i spotted somebody talking about sprites to be used for this. Is this a good idea? Are sprites basically 3d elements now?

If you know a shader for this topic, that's nice and well appreciated to be shared, but i'm making my game for a large audience having low-end to high-end machines, and i want to give the most in the non-shader scene as well.
Mobiius
Valued Member
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 6th Sep 2010 09:13
Cant you just use the object screen x/y commands?

My signature is NOT a moderator plaything! Stop changing it!
Quel
17
Years of Service
User Offline
Joined: 13th Mar 2009
Location:
Posted: 6th Sep 2010 10:13
How do you achieve hiding / showing with those only?
Mobiius
Valued Member
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 6th Sep 2010 10:39
You use them to see if the object is in screen, then hide/show accordingly.

For example:


My signature is NOT a moderator plaything! Stop changing it!
Quel
17
Years of Service
User Offline
Joined: 13th Mar 2009
Location:
Posted: 6th Sep 2010 12:47
I'm aware of this basic thingy thank you, the point is to hide the glare when something comes between it and you.
Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 6th Sep 2010 12:57
Evolved does a good job of this, I'm sure he checks the screen pixels at OBJECT SCREEN, but probably uses an alternative technique instead of POINT, as that is mighty slow.

The main benefit in using point, is if you scan a small area, it might be possible to adjust the transparency, so if you check a 3x3 area at the light source, and half of that is bright, then you might set the lens flare to 50% transparency. Because you would scan the actual screen though, trees for example would work great - if you used normal line-polygon collision, then the whole tree would appear to be solid.

I think you should take a look at Evolveds stuff, its not straightforward, but he might have come up with an easy method for this.

Health, Ammo, and bacon and eggs!
Quel
17
Years of Service
User Offline
Joined: 13th Mar 2009
Location:
Posted: 6th Sep 2010 16:30
What a cool idea that 'area scanning' thing is, surprised i didn't think about that one. Maybe because i was already nervous about that one and only point.

That Evolved guy seems like the god here other than Lee Bamber everybody just keeps saying that name all the time, and especially in the shader topic. However i found various links to his work (from various dates and years), but non were working, could you let me know what website or thread he is currently up on?
Sixty Squares
20
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 6th Sep 2010 16:51 Edited at: 6th Sep 2010 16:51
Evolved's site: http://www.evolved-software.com

@Van B: Which of his examples are you referring to? I'd like to know how to do this as well . Are you referring to the light rays shader he has up there, or something else?


Guns, cinematics, stealth, items and more!
Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 6th Sep 2010 17:20
Well there's this shader video...

http://www.youtube.com/user/EVOLVEDUK#p/u/16/o73QxJk3Urw

I'm thinking he's probably doing that with a bloom shader - like taking the image and exagherating the contrast etc, works great but no good for lens flares.

I was sure he had a lens flare video, but can't seem to find it - can't find the terrain and water video with the tree's, which is what I think had the flares.

Health, Ammo, and bacon and eggs!
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 6th Sep 2010 18:52 Edited at: 6th Sep 2010 18:57
I uploaded a lens flare example a while ago but the full code works better. It uses sparky's collision to check whether the "sun" is hidden. Here is the code and media from my game "The Waystation"...

Code:


EDIT: You'll have to make sprites from the images and set up a sun object in sparky's plus any other objects that might get in the way but it works pretty well in my WIP here:
http://forum.thegamecreators.com/?m=forum_view&t=169135&b=8

Login to post a reply

Server time is: 2026-07-24 23:11:53
Your offset time is: 2026-07-24 23:11:53