Creating Pure Darkness?
by Feilim Breatnach · in Technical Issues · 09/12/2005 (11:54 am) · 12 replies
I am pretty new to Torque but have started work on an audio driven game. The game of course includes graphics but the aim is that it will be playable by using sound alone. I would like to be able to bind a key to a function which will effectively 'turn the graphics off', ie make everything pitch black.
I have tried playing around with the sun's elevation, ambient intensity and color intensity values in the World Editor Inspector, and relighting the scene, but even setting the sun's intensity to 0 or elevation to below 0 does not seem to give any darkness.
Does anyone know of a way in which darkness can be achieved for an exterior mission, and if so whether this can be achieved through scripting?
Many thanks in advance,
Feilim
I have tried playing around with the sun's elevation, ambient intensity and color intensity values in the World Editor Inspector, and relighting the scene, but even setting the sun's intensity to 0 or elevation to below 0 does not seem to give any darkness.
Does anyone know of a way in which darkness can be achieved for an exterior mission, and if so whether this can be achieved through scripting?
Many thanks in advance,
Feilim
#2
You could probably get away with just creating an object surrounding the camera. You could create a sphere, and turn all the polys to face inwards. There is probably a more sophisticated way through scripting or a UI layer though...
09/12/2005 (12:09 pm)
What if you were to place a paper bag over the camera?You could probably get away with just creating an object surrounding the camera. You could create a sphere, and turn all the polys to face inwards. There is probably a more sophisticated way through scripting or a UI layer though...
#3
09/12/2005 (12:27 pm)
Check the ambient light.
#4
By removing the sun or setting the color/ambient values to 0, you are in effect telling the engine to choose a default lighting value. Instead, set the color and ambient values to very low numbers like this:
Sun Object:
color: 0.010000 0.010000 0.010000 1.000000
ambient: 0.010000 0.010000 0.010000 1.000000
This will still leave you w/ a sky-box question. Either set the color of your skybox textures to a dark color (as suits your need), or do this...
Sky Object:
useSkyTextures: False (not checked)
SkySolidColor: 0.010000 0.010000 0.010000 1.000000
Now the scene should be pretty black.
Hope this helps.
Hall Of Worlds - For Gamers
EdM|EGTGE
09/12/2005 (12:42 pm)
Feilim,By removing the sun or setting the color/ambient values to 0, you are in effect telling the engine to choose a default lighting value. Instead, set the color and ambient values to very low numbers like this:
Sun Object:
color: 0.010000 0.010000 0.010000 1.000000
ambient: 0.010000 0.010000 0.010000 1.000000
This will still leave you w/ a sky-box question. Either set the color of your skybox textures to a dark color (as suits your need), or do this...
Sky Object:
useSkyTextures: False (not checked)
SkySolidColor: 0.010000 0.010000 0.010000 1.000000
Now the scene should be pretty black.
Hope this helps.
Hall Of Worlds - For GamersEdM|EGTGE
#5
On the easy side, how about creating a black image to cover the entire screen? Then just change the visibility of the gui element by the key stroke.
Thanks.
09/12/2005 (9:10 pm)
Feilim,On the easy side, how about creating a black image to cover the entire screen? Then just change the visibility of the gui element by the key stroke.
Thanks.
#6
Cheers,
Feilim
09/13/2005 (9:24 am)
Many thanks for the tips guys, I will try to implement some of your ideas and will let you know how I get on. Derk Adams' idea of creating a black gui image to cover the screen sounds like a simple but effective solution.Cheers,
Feilim
#7
09/13/2005 (9:31 am)
You could probably do it by setting the visibility to 0. That will in effect cull anything that is greater then 0 away (or everything)
#8
Chris "Digi" Timberlake: It seems that when I comment out the Sun's DataBlock from the mission file and then fire up Torque that the game crashes, therefore it appears that Torque cannot run a mission file which does not include a Sun DataBlock
Ed Maurina: I tried the values you suggested for both the Sun and Sky Object(/Datablock?) and they give fairly pleasing results with the exception that water/lava blocks (which I have) still remain fully lit as does the sky, which now appears with the Cloud graphic. I know that I could simply use a black PNG for the cloud graphic but the idea is to be able to turn graphics on/off by a simple keystroke (not to have them off at all times). Also terrain was visible some distance away - fixed this by changing the fog distance to a large value (~10000), but terrain silhouette still was visible against the Sky.
Chris Lombard: I tried setting visibility to 0, which did cull everything. The result was that the bottom half of the FOV was turned to a white colour, while the upper half of the FOV still showed the Skybox.
I figure the best solution sounds like the black GUI layer idea, I just have to try and figure out how to do this now but it was interesting trying the other suggestions and seeing their results. I'll let you know how this goes..
Cheers,
Feilim
09/13/2005 (10:26 am)
OK, I tried 3 of the easier to implement suggestions and here are results:Chris "Digi" Timberlake: It seems that when I comment out the Sun's DataBlock from the mission file and then fire up Torque that the game crashes, therefore it appears that Torque cannot run a mission file which does not include a Sun DataBlock
Ed Maurina: I tried the values you suggested for both the Sun and Sky Object(/Datablock?) and they give fairly pleasing results with the exception that water/lava blocks (which I have) still remain fully lit as does the sky, which now appears with the Cloud graphic. I know that I could simply use a black PNG for the cloud graphic but the idea is to be able to turn graphics on/off by a simple keystroke (not to have them off at all times). Also terrain was visible some distance away - fixed this by changing the fog distance to a large value (~10000), but terrain silhouette still was visible against the Sky.
Chris Lombard: I tried setting visibility to 0, which did cull everything. The result was that the bottom half of the FOV was turned to a white colour, while the upper half of the FOV still showed the Skybox.
I figure the best solution sounds like the black GUI layer idea, I just have to try and figure out how to do this now but it was interesting trying the other suggestions and seeing their results. I'll let you know how this goes..
Cheers,
Feilim
#9
I put this on the backburner for a while but have tried tackling the issue again recently. I have yet to come up with a solution which allows toggling graphics on/off (black screen) at the touch of a keystroke.
I looked into most of the solutions suggested by the other posters in this thread, but didnt have any success. Creating a GUI layer seemed like the simplest thing to do, but I found that when I toggled the visibility of the GUI layer the screen went white, and then would not toggle back to showing graphics. I will post up the code I used for this later as do not have access to it right now.
Maybe the suggestion from Unsung Zero above would be doable, where one could place a 'paper bag' over the camera to toggle the graphics on/off, although this would of course have to follow the camera as the player moves around. The camera will be locked in 3rd person mode at all times.
PS for those who are wondering why toggle graphics on/off at all, the game I am working on is a game which is accessible to the blind (relying mostly on 3d audio), and to give sighted players more of a challenge I'd like to have a control to disable graphics.
Any help on this would be most appreciated
Cheers,
Feilim
12/13/2005 (7:39 am)
HiI put this on the backburner for a while but have tried tackling the issue again recently. I have yet to come up with a solution which allows toggling graphics on/off (black screen) at the touch of a keystroke.
I looked into most of the solutions suggested by the other posters in this thread, but didnt have any success. Creating a GUI layer seemed like the simplest thing to do, but I found that when I toggled the visibility of the GUI layer the screen went white, and then would not toggle back to showing graphics. I will post up the code I used for this later as do not have access to it right now.
Maybe the suggestion from Unsung Zero above would be doable, where one could place a 'paper bag' over the camera to toggle the graphics on/off, although this would of course have to follow the camera as the player moves around. The camera will be locked in 3rd person mode at all times.
PS for those who are wondering why toggle graphics on/off at all, the game I am working on is a game which is accessible to the blind (relying mostly on 3d audio), and to give sighted players more of a challenge I'd like to have a control to disable graphics.
Any help on this would be most appreciated
Cheers,
Feilim
#10
12/13/2005 (8:32 am)
There is already a function called setblackout in TGE but I cant post specifics in a public forum.
#11
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=7945
12/13/2005 (8:41 am)
You could look at some of the scope resourceswww.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=7945
#12
In default.bind.cs
Then in a server side script file I have the function:
Now when I press the 'tab' key in-game, I would expect the screen to blackout in 1 second, yet nothing happens. Any ideas on this?
PS I have of course disabled the default tab functionality to toggle camera (in my game the camera is locked in 3rd person at all times)
12/15/2005 (8:49 am)
I have looed into implementing the setBlackout() method for GameConnection object but nothing seems to be happening. Here is what I have done:In default.bind.cs
moveMap.bind(keyboard, tab, toggleGraphics );
function toggleGraphics(%val) {
if (%val)
commandToServer('ToggleGraphics');
}Then in a server side script file I have the function:
function serverCmdToggleGraphics(%client) {
%client.setBlackout(1,1000);
}Now when I press the 'tab' key in-game, I would expect the screen to blackout in 1 second, yet nothing happens. Any ideas on this?
PS I have of course disabled the default tab functionality to toggle camera (in my game the camera is locked in 3rd person at all times)
Torque 3D Owner Chris "DiGi" Timberlake