gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > Flashlight help wanted

#171639 - iainprice - Mon Dec 07, 2009 10:09 pm

Is there an easy way to turn down the ambient light and direct a light from the camera towards the looking direction to give a flashlight effect on the rotating cube example?

#171641 - TwentySeven - Mon Dec 07, 2009 10:51 pm

Not easy, no.

Theres no cone light (spotlight) built into the DS's 3d hardware, so you'd have to emulate it in some manner. At the very least you'll need more vertexes on your cube to pick up the cone lighting falloff.

If this is part of a more advanced bit of 3d rendering work, can you give more details?

#171643 - Dwedit - Mon Dec 07, 2009 11:53 pm

You can always stick on a 2D layer with a hole in it to cover up the 3D scene. Or even make a dark translucent 2D layer with a hole in it.
_________________
"We are merely sprites that dance at the beck and call of our button pressing overlord."

#171652 - iainprice - Tue Dec 08, 2009 8:29 pm

Fog set to black and layer of faded circle sounds like a good plan.... but will look at trying to get some sort of flashlight working........ if anyone gets any joy, please let me know......

#171657 - elwing - Wed Dec 09, 2009 10:16 am

there was a discussion on using the hardware for such effect, like it's done in the game "dementium: the ward" I think... will try to find it...

edit:
http://forum.gbadev.org/viewtopic.php?t=14339&highlight=flashlight
http://forum.gbadev.org/viewtopic.php?t=14780&highlight=flashlight

seems like the effect was made by abusing shadow volume and playing with fog

#171665 - iainprice - Wed Dec 09, 2009 9:12 pm

Both threads have good ideas and sound advice but I'm having problems getting it to work in practice.... as one comment said.. you can take ages trying to mess around with it and find it was one bit that was set wrong.... the theory is sound but has anyone got an nice simple example up and running... if so why is it not in the nds examples :)

#171671 - elwing - Fri Dec 11, 2009 8:23 am

dementium: the ward is a nice example... okay, not open source :) it proves it's possible at least...

#171673 - wintermute - Sat Dec 12, 2009 2:17 am

Perhaps the demo with source code linked to from the other posts may help a bit.

http://www.robs-basement.de/#RB_NDS_VSD

I haven't had a chance to take a look - it may need some updating for latest devkitARM/libnds. My current focus is on DSi related updates and I really need to get back to something I promised I would have done close to a year ago.

If anyone feels like taking a look at Silent Code's demo, updating if necessary and maybe breaking it down into a few examples for devkitPro it would be much appreciated. I'll give whatever assistance I can.
_________________
devkitPro - professional toolchains at amateur prices
devkitPro IRC support
Personal Blog

#172835 - silent_code - Sat Mar 06, 2010 3:45 pm

"I have returned." </Protoss Dragoon voice>

First of all: I know I'm positng this very late. I'm doing it anyways, just in case someone has the same question and decides to reads this.

I tested that in my demo the other day and it worked just like in "Dementium." Maybe I'll add that feature into the demo at some point.


On a personal side note:

It's been a while since I visited this forum, because I've been working a lot with next to no free time at all (I mean it: wake up, go to work, return, go to bed, sleep, wake up...). The game is nearly finished now, so I'm looking forward to continue my NDS homebrew when I finally get my well deserved vacation. :^)

I posted that I was working on something new quite a while ago. "Unfortunately," I got hired (see above). ;^)

Well, I've been updating my VSD project whenever I found a few hours to do so, but never got around to release anything. There was always some code to be cleaned up or small feature to be added, which got me into a troubled state.

More recently I had some big problems with loading files with libfat and getting a custom application logo to work. :^(

When I get that ironed out, I will eventually release an updated version of the demo, which will be built using the most recent devkitARM available at that time.

Best regards,

Rob


PS: Thanks for recommending my demo. :^)
_________________
July 5th 08: "Volumetric Shadow Demo" 1.6.0 (final) source released
June 5th 08: "Zombie NDS" WIP released!
It's all on my page, just click WWW below.