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 / torch and spotlight

Author
Message
smallg
Valued Member
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location: steam
Posted: 15th Apr 2006 19:25
i want to make a torch (and a spotlight) in my first person shooter and i have been trying to figure out how to do it using the 'spot light ' command but i just can't get it to work at all.

note;
i'm looking for an effect like on quake 4 when u switch ur torch on

life's one big game
spec= 2ghz, 1gb ram, 512mb gpu, directx 9.0c, dbpro and classic
Teh Go0rfmeister
21
Years of Service
User Offline
Joined: 17th Aug 2003
Location:
Posted: 16th Apr 2006 01:56
perhaps you could give us a screenshot of the torch in quake 4 being used, for us who would like to help but dont know what you're on about

Agent Dink
21
Years of Service
User Offline
Joined: 30th Mar 2004
Location:
Posted: 16th Apr 2006 03:24
Brits call flashlights torches

You won't get quite as nice of an effect with just the spotlight command in DB. And I'm not entirely sure of how to achieve an effect like they have.

www.badpicsofmatt.tk
www.silver-dawn.net
Xander
22
Years of Service
User Offline
Joined: 3rd Mar 2003
Location: In college...yeah!
Posted: 16th Apr 2006 05:02
Hmm...the spot light command uses vertex lighting. Anyone know how to do "projected" lighting? I can't remember the proper name for it right now...

Xander Moser - Bolt Software - Firewall
dark coder
22
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 16th Apr 2006 05:03
per pixel lighting, only possible via a shader.

Halowed are the ori.
Heckno
20
Years of Service
User Offline
Joined: 8th Sep 2004
Location: Palm Coast, FL
Posted: 16th Apr 2006 05:23
you should talk to lukas about this, he has something similar to what your talking about in his fps over on the WIP threads
bosskeith
19
Years of Service
User Offline
Joined: 5th Dec 2005
Location:
Posted: 16th Apr 2006 11:46 Edited at: 16th Apr 2006 11:49
actualy the spotlight will work after the upgrade it was mentioned on bugfixes...ill see if i can find link to it


and here it is

http://forum.thegamecreators.com/?m=forum_view&t=67139&b=15

Ink all over the screen...and dang it! Signature still does not show.
smallg
Valued Member
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location: steam
Posted: 19th Apr 2006 13:51 Edited at: 19th Apr 2006 14:32
Quote: "Brits call flashlights torches"

lol, didn't even think about that... well it seems like it would make a really neat addition to a fps (especially with all the new first person shooters around that are meant to be scary) so i'll look into the fix and see if i can get anything working, thanks for the help.

[edit]
ok using the other thread i managed to get this...


it works well enough but the light looks alittle square most of the time and doesn't register at some of the points (mostly the pillars) like it should, anyone got any input on how to improve it?

life's one big game
spec= 2ghz, 1gb ram, 512mb gpu, directx 9.0c, dbpro and classic

Attachments

Login to view attachments
dark coder
22
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 19th Apr 2006 16:17
per pixel lighting using a phong shader or normal maps or paralax mapping or relief mapping, with softshadows and reflections and 0.01fps.

Halowed are the ori.
adr
22
Years of Service
User Offline
Joined: 21st May 2003
Location: Job Centre
Posted: 19th Apr 2006 16:47
How did Half Life 1 do it? I'm sure it didn't use pixel shaders or vertex lighting. Real time lightmapping seems a little heavy ...

[center]
iv tryed everything!!!!!!!!!! could u please just add The gun and shooting Code thats All!!!!!!!!!
bosskeith
19
Years of Service
User Offline
Joined: 5th Dec 2005
Location:
Posted: 19th Apr 2006 17:42
like dark coder said probably shaders...the graphics card handles shaders so "real time" lighting is not going to impact your game as much as you think it would...there is a slight drop...but still within reason to be cosidered "realtime"

Ink all over the screen...and dang it! Signature still does not show.
dark coder
22
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 19th Apr 2006 19:02
well your right, hl1 and ut didnt use shaders, but i believe they either remapped a small light texture to a seperate uv layer in realtime which might be a bit overkill, but i think thats what the hl2 engine does now, but the other method is to make upto about 3 plains and position them on any possible sides you could extend this to maybe 6plains depending on where your shining the light, and shift verts so they dont go off the edges and re uv map them in realtime, both methods are a pain to code tho :p.

Halowed are the ori.
Uncle Sam
19
Years of Service
User Offline
Joined: 23rd Jul 2005
Location: West Coast, USA
Posted: 19th Apr 2006 22:07
Quote: "Brits call flashlights torches"


See! Just by reading your post, we have discovered some of your personal information! We've narrowed it down to England. Next step, street address.

Uncle Sam
Nvidia Geforce 6600 GT 128MB PCIEx, 2.66 GHZ Pentium 4 proccessor, 768MB RAM
Want a real FPS? Click here!
RUCCUS
20
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 19th Apr 2006 23:08 Edited at: 19th Apr 2006 23:08
This probably wouldnt be the most efficient way but you could always have a circular plain-type model infront of you, and manipulate the vertex data so it wraps onto whatever object it's hitting. That would only be half the battle though as the plain would just be... a plain In order to get it to light things up you could...

- Manipulate the colour intensities of the UV map where the plain is on (pretty hard)
- Experiment with the light commands, but then again you said they're not working fairly correctly so thats probably out of the quesion...
- (Im pretty sure there's a command for this); set the plain object to not be affected by any light sources except for the main ambient light, and then ghost the object so you'd still retain some of the material of the actual model underneath it (this is probably the best route to go).

<EDIT>

Ah my bad I just noticed a similar method was suggested above. Ohwell, the more the marrier.

monotonic
19
Years of Service
User Offline
Joined: 24th Mar 2006
Location: Nottinghamshire, England
Posted: 20th Apr 2006 01:48
Like dark coder said hl1 uses decal lighting, but use shaders to get the best result.

Homey the Clown
21
Years of Service
User Offline
Joined: 4th Apr 2004
Location:
Posted: 20th Apr 2006 02:53
You can use like memblocks or decals. Then you could make diffuse map or something to make it brighter. Kind of like multitexturing to the level.

Homey

"I don't think so... Homey don't play that."
-Homey D. Clown
Intel Pentium 4 2.4Ghz processor,512MB Ram,GeForce4 MX 4000
Pricey
22
Years of Service
User Offline
Joined: 22nd Feb 2003
Location:
Posted: 23rd Apr 2006 17:34 Edited at: 23rd Apr 2006 17:36
put this in your
in your init

set point light 1, 0,0,0
set light range 1, 10000

then put this in your loop

position light 1,player position
rotate light 1,player angle



:: 3Ghz Pentium 4 / Hyper Threading, 1024mb RAM, 250GB HDD, 256mb Radeon 9600XT Graphics ::


dark coder
22
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 23rd Apr 2006 20:11
voila! crappy lights that look like ass

Halowed are the ori.
Phaelax
DBPro Master
22
Years of Service
Recently Online
Joined: 16th Apr 2003
Location: Metropia
Posted: 23rd Apr 2006 20:50
You could texture a plane with a black image with a white circle in the middle, lock it to the screen's center, the ghost it. The white ghosted will make things a bit brighter on the screen. Cheap way, but its worked for me in the past.


headcrab 53
19
Years of Service
User Offline
Joined: 14th Jul 2005
Location:
Posted: 26th Apr 2006 03:37 Edited at: 26th Apr 2006 03:39
Although I don't think a ghosted object will actually make a pitch black object light up. It'll just show a lighter shade of gray, like if you were looking through a window into a pitch black room. But if the object isn't completely dark, it'll help. You could try to increase the ambient light, then use an alpha mapped object to make the area outside the flashlight darken to it's original brightness.

"Not again!" - A Grunt
dark coder
22
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 26th Apr 2006 05:13
which is what i think those engines do, they somehow seem to exclude the lightmap, however the hl2 engine is different as it both excludes and lightens.

Hallowed are the ori.
monotonic
19
Years of Service
User Offline
Joined: 24th Mar 2006
Location: Nottinghamshire, England
Posted: 26th Apr 2006 12:43 Edited at: 26th Apr 2006 12:52
You could use decal lighting (just a white circle) then project that onto the geometry and blend it with the lightmap so that, that region of light map becomes white thus lighting the geometry.

EDIT: this I think, would have to be done in multiple passes, well 2 one to render the lightmap and the decal light, then the second to render the textured objects, this layer is just added to the first.

Fornit some fornus.
indi
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 26th Apr 2006 14:05
umbra and penumbra joy

If no-one gives your an answer to a question you have asked, consider:- Is your question clear.- Did you ask nicely.- Are you showing any effort to solve the problem yourself &#63743;
monotonic
19
Years of Service
User Offline
Joined: 24th Mar 2006
Location: Nottinghamshire, England
Posted: 26th Apr 2006 14:14
@Indi
Indeed , some nice depth testing code will be needed, oh yes.

Fornit some fornus.

Login to post a reply

Server time is: 2025-06-24 04:42:28
Your offset time is: 2025-06-24 04:42:28