|
hawkwind
|
 |
« on: 17. March 2007, 01:50:47 pm » |
|
I am trying to setup up a flashlight for my avatar in my mystery game. Basically I have a spotlight, with a tight concentration. I position it based on the view held by the FirstPersonInputHandler. I then extract the facing direction of the view and set the spotlight direction to this. Strangely enough the light appears to shin down, to the right of where I am viewing. Any thoughts on why this does not work?? 
|
|
|
|
|
Logged
|
|
|
|
|
horati
|
 |
« Reply #1 on: 17. March 2007, 02:35:02 pm » |
|
Would it be possible to get this factored into a FlashLight class along with the other lights? It seems very useful. In fact, Aviatrix3D had a boolean flashlight parameter on their View.
|
|
|
|
|
Logged
|
|
|
|
|
Patheros
|
 |
« Reply #2 on: 17. March 2007, 05:45:15 pm » |
|
Could you give us a little test case of the light problem?
|
|
|
|
|
Logged
|
"I like my method, what was my method again?" - Jon
|
|
|
Marvin Fröhlich
Xith Lord
Administrator
Guru
   
Offline
Posts: 4381
May the 4th, be with you...
|
 |
« Reply #3 on: 17. March 2007, 08:45:47 pm » |
|
I really believe, "flashlight" is the wrong name for it (in my understanding a flashlight is the flashing light that you know from a disco). But it is definitely very useful. I think, the right way to go is to have an attacheLight() or setAttachedLight() method in the View class, that takes any Light extension.
What do you think?
Marvin
|
|
|
|
|
Logged
|
|
|
|
|
Patheros
|
 |
« Reply #4 on: 17. March 2007, 08:57:00 pm » |
|
I really believe, "flashlight" is the wrong name for it (in my understanding a flashlight is the flashing light that you know from a disco). But it is definitely very useful. I think, the right way to go is to have an attacheLight() or setAttachedLight() method in the View class, that takes any Light extension.
What do you think?
Marvin
In regards to names: I believe Hawkwind is referring to an American "Flashlight" (English "Torch"). As far as I know the only name for the spinning reflective disco light in America is "Disco Ball" or "Disco Lights" In regards to code: setAttachedLight() sounds like a good method to implement the function I believe Hawkwind is asking for
|
|
|
|
|
Logged
|
"I like my method, what was my method again?" - Jon
|
|
|
Marvin Fröhlich
Xith Lord
Administrator
Guru
   
Offline
Posts: 4381
May the 4th, be with you...
|
 |
« Reply #5 on: 17. March 2007, 09:28:42 pm » |
|
In regards to names: I believe Hawkwind is referring to an American "Flashlight" (English "Torch"). As far as I know the only name for the spinning reflective disco light in America is "Disco Ball" or "Disco Lights"
"Disco ball" is also known in germany. But it is something different than a flashlight. A flashlight is simply an extremely bright light, that goes on and off in about 15-20 Hz. It supports a slow-motion-like effect. Other countries, other words  Anyway, the name should not be a reason to not implement this useful feature. In regards to code: setAttachedLight() sounds like a good method to implement the function I believe Hawkwind is asking for
ok Marvin
|
|
|
|
|
Logged
|
|
|
|
|
horati
|
 |
« Reply #6 on: 17. March 2007, 10:05:48 pm » |
|
"Disco ball" is also known in germany. But it is something different than a flashlight. A flashlight is simply an extremely bright light, that goes on and off in about 15-20 Hz. It supports a slow-motion-like effect. Other countries, other words  We Americans know that as a strobe light; however, we could use this discussion as inspiration for all kinds of lighting effects to see who thinks some of them are useful. - Sun: combines multiple lighting effects to approximate outdoor lighting. One of my 3D editors' sample projects came with a very nice lighting effect using 3 directional lights to simulate this
- Flashlight / Torch: As Jon described
- Strobe: As Marvin described
Others?
|
|
|
|
|
Logged
|
|
|
|
|
hawkwind
|
 |
« Reply #7 on: 17. March 2007, 10:55:00 pm » |
|
Interesting discusion. Where I to define the specs I would say
1 - Any light 'attached' the the view must track the view movements, positionaly and rotationaly.
2 - I would extend this concept to provide a set of pre defined light sources
3 - One predefined one is a "flashlight" in the english sense. A mechanical device, powered by batteries, that emits a cone of light that always points/aligns with the view. If I look at an object I want the light to illuminate it. As I look across a wall (with mouse movements), I want the shiny part of the wall to track my changing view. This would be based on a spotlight object allowing radius of the cone and attenuation of the light to be manipulated.
4 - Second predefined one is a "torch". A burning hunk of wood emitting a flickering light in all directions. I implemented this as a PointLigtht with a redish-yellow color and I modify the magnitude of the red and yellow components cyclically (via seched operation). This gives a flickeing affect. This is what I give the player when they enter the dreaded dungeons in my game.
5 - The "flashlight" should be located at the same location of the view
6 - the torch might be better positioned slightly above the view (in the Y axis) as if it were being held up by the user.
These might be an addition to the firstpersoninput class which tracks and manipulates the view already
|
|
|
|
|
Logged
|
|
|
|
|
Patheros
|
 |
« Reply #8 on: 17. March 2007, 11:14:45 pm » |
|
3 - One predefined one is a "flashlight" in the english sense. A mechanical device, powered by batteries, that emits a cone of light that always points/aligns with the view. If I look at an object I want the light to illuminate it. As I look across a wall (with mouse movements), I want the shiny part of the wall to track my changing view. This would be based on a spotlight object allowing radius of the cone and attenuation of the light to be manipulated.
There should be some way to make the flashlight lead or lag the view or do something else for special effect. As much as having it fixed directly in the view's direction sounds like a good idea, after a while it starts to look fake.
|
|
|
|
|
Logged
|
"I like my method, what was my method again?" - Jon
|
|
|
Marvin Fröhlich
Xith Lord
Administrator
Guru
   
Offline
Posts: 4381
May the 4th, be with you...
|
 |
« Reply #9 on: 17. March 2007, 11:57:13 pm » |
|
I think, the attached light should be located at an offset to the view as well as face to a direction relative to the current viewing direction. These two parameters whould be most general to arrange any light type.
Marvin
|
|
|
|
|
Logged
|
|
|
|
|
hawkwind
|
 |
« Reply #10 on: 19. March 2007, 01:52:58 pm » |
|
This is how I manipulate the flashlight
Vector3f lDirect1 = ((View)fpHandler.getTransformNode()).getFacingDirection(); lDirect1.normalize(); LightManager.flashlight1.setDirection(lDirect1); //a spotlight
|
|
|
|
|
Logged
|
|
|
|
|
Patheros
|
 |
« Reply #11 on: 19. March 2007, 03:03:28 pm » |
|
I think, the attached light should be located at an offset to the view as well as face to a direction relative to the current viewing direction. These two parameters whould be most general to arrange any light type.
I think this would be the best way to do it too.
|
|
|
|
|
Logged
|
"I like my method, what was my method again?" - Jon
|
|
|
|
'n ddrylliog
|
 |
« Reply #12 on: 19. March 2007, 03:12:57 pm » |
|
|
|
|
|
|
Logged
|
|
|
|
|
hawkwind
|
 |
« Reply #13 on: 18. September 2007, 11:06:42 pm » |
|
Reviving this topic, I am getting hopelessly confused trying to implement a spotlight that track view changes. As far as I can see it seems that the 3D space of a Spotlight differs from the 3D space of the view. For example when I set a direction of (0,0,1) the spotlight 'seems' to point straight down, which is generally the Y axis....yoicks. Also I seem to remember that Lights in general don't move via Transformations, you need to manually set the position, so placing the Spotlight in the view transform does not work either.
I have been trying to use the view position and facing direction to drive the position and direction of the spotlight, but it ain't working, any ides??
|
|
|
|
|
Logged
|
|
|
|
Pandaemonium
Enjoying the stay
Offline
Posts: 85
If at first you don't succeed; call it version 1.0
|
 |
« Reply #14 on: 18. September 2007, 11:39:27 pm » |
|
Also I seem to remember that Lights in general don't move via Transformations, you need to manually set the position, so placing the Spotlight in the view transform does not work either. Hmmm. In OpenGL, light position is stored in eye coordinates so it should be affected by the viewing transformation. Have you tried setting the light position before the viewing transformation (not in the transformation but so that the transformation occurs after the position of the light is declared)?
|
|
|
|
|
Logged
|
|
|
|
|