Game Development Community

How would you do this effect in TSE/TGE

by Rob · in Torque Game Engine Advanced · 11/20/2005 (4:25 pm) · 12 replies

www.chasergame.com/images/screenshots/bs_01.jpg

Just curious how this type of effect could be done in TSE

cheers in advance

#1
11/20/2005 (4:46 pm)
I would guess that you'd render the scene to a texture then pass it through a blur shader.
#2
11/20/2005 (4:56 pm)
Looks like radial blur to me, no idea :)
#3
11/20/2005 (5:08 pm)
The engine is rendering it in real time, ive seen similar effects in many games

How can you render whatever the player POV is seeing to a texture? hehe
that makes my brain hurt :D
#4
11/20/2005 (5:33 pm)
As far as i know... the screen is literally treated as a picture in photoshop and radial blurred accordingly.. it does it behind the scenes so you dont see this happen..

so basically the filter bit happens before its rendered to your screen

im guessing thats what josh meant..
#5
11/20/2005 (6:52 pm)
Some guy in the TSE forums(sorry for not remembering name), had made a shader that does an effect quite like that.
#6
11/20/2005 (7:43 pm)
Yes it can be done. As a matter of fact any shader effect can be done. TSE's compiler works with both
ASM assembler and HLSL shaders. If your hardware supports it. With the most up to date DirectX version.
I mean any of the directX unified 1.x 2.0 and 3.0 (and the 1.x too but I try not to waste my time on the older
hardware).

Edit: Granted this... it's early in TSE's life and lot of work needs to be done. So doing custom shaders is
on the burden of the SDK owners while GG and associates crank on the core.
#7
11/20/2005 (11:36 pm)
"As far as i know... the screen is literally treated as a picture in photoshop and radial blurred accordingly.. it does it behind the scenes so you dont see this happen.."

So can you point me in the right direction for how one might go about applying shaders to the camera view/screen
#8
11/21/2005 (12:16 am)
Normaly , I would render 2 camera's and copy the contents (or render to texture) of camera 2 to a textured quad scaled to fit in front of the Camera.(or sprite if the engine supports)
alpha blend it , since a texture isnt cleared like the Backbuffer, its gets the radial blur effect.

Zmatrix
#9
11/21/2005 (12:24 am)
That is exactly what it is. It is a post process radial blur and would go something like this with a shader:

float2 texelSize = 1.0 / float2(texturewidth, textureheight);
float2 s = texturecoords + texelSize*0.5;
float2 coords[16];
for(int i=0; i<16; i++)
{
      float scale = 1.0f + blurwidth *(i/(float) (15));
      coords[i] = (s - float2(horizontalBlurCenter, verticalBlurCenter))*scale + float2(horizontalBlurCenter, verticalBlurCenter);
}
float4 final = 0;
for(int i=0; i<16; i++)
{
      final += tex2D(sceneSamper, coords[i]);
}
final /= 16;
return final;

Sorry if I missed anything or made some mistakes.
#10
11/21/2005 (12:26 am)
Rob: You should move this to the private TSE forums. But FYI, there's already a resource that does the base for this(renders the scene to a texture and runs it through a shader): www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=9104

All you'll have todo to get the effect that you posted is create the shader(unless you want the blur tied to velocity or something).
#11
11/21/2005 (3:19 am)
Great stuff thanks,

I would post in the private forums if I could hehe, but I dont have the registerted login, someone else im working with does though
#12
11/23/2005 (2:12 am)
Heres the problem I have
, that resource instructs me to play the exec command for the script after idleTimeOut, but there is no IdleTimeout or anything like it in my init.cs,
Ive tried inserting it in a few places but had no success
Can anyone help?
here my init.cs below
(yes im using the starterfps module as a testbed)


(some code deleted here to save space)
// loadMaterials - load all materials.cs files
//-----------------------------------------------------------------------------
function loadMaterials()
{
for( %file = findFirstFile( "*/materials.cs" ); %file !$= ""; %file = findNextFile( "*/materials.cs" ))
{
exec( %file );
}
}

function reloadMaterials()
{
reloadTextures();
loadMaterials();
reInitMaterials();
}

//-----------------------------------------------------------------------------
function initClient()
{
echo("\n--------- Initializing MOD: TSE FPS Starter Kit: Client ---------");

// Make sure this variable reflects the correct state.
$Server::Dedicated = false;

// Game information used to query the master server
$Client::GameTypeQuery = "TSE FPS Starter Kit";
$Client::MissionTypeQuery = "Any";

//
exec("./ui/customProfiles.cs"); // override the base profiles if necessary

// The common module provides basic client functionality
initBaseClient();

// InitCanvas starts up the graphics system.
// The canvas needs to be constructed before the gui scripts are
// run because many of the controls assume the canvas exists at
// load time.
initCanvas(".:Torque Shader Engine starter.fps starter kit v1.2:. (TSE Early Adopter EA1)");

/// Load client-side Audio Profiles/Descriptions
exec("./scripts/audioProfiles.cs");

// Load up the Game GUIs
exec("./ui/defaultGameProfiles.cs");
exec("./ui/PlayGui.gui");
exec("./ui/ChatHud.gui");
exec("./ui/playerList.gui");

// Load up the shell GUIs
exec("./ui/mainMenuGui.gui");
//exec("./ui/QuitGui.gui");
exec("./ui/aboutDlg.gui");
exec("./ui/startMissionGui.gui");
exec("./ui/joinServerGui.gui");
exec("./ui/loadingGui.gui");
exec("./ui/endGameGui.gui");
exec("./ui/optionsDlg.gui");
exec("./ui/remapDlg.gui");
exec("./ui/StartupGui.gui");

// full screen effects
exec("./scripts/fullscreenEffects.cs");

// Client scripts
exec("./scripts/client.cs");
exec("./scripts/game.cs");
exec("./scripts/missionDownload.cs");
exec("./scripts/serverConnection.cs");
exec("./scripts/playerList.cs");
exec("./scripts/loadingGui.cs");
exec("./scripts/optionsDlg.cs");
exec("./scripts/chatHud.cs");
exec("./scripts/messageHud.cs");
exec("./scripts/playGui.cs");
exec("./scripts/centerPrint.cs");


// Default player key bindings
exec("./scripts/default.bind.cs");
exec("./config.cs");

// material related
exec("./scripts/glowBuffer.cs");
exec("./scripts/shaders.cs");
exec("./scripts/commonMaterialData.cs" );

loadMaterials();

// Really shouldn't be starting the networking unless we are
// going to connect to a remote server, or host a multi-player
// game.
setNetPort(0);

// Copy saved script prefs into C++ code.
setShadowDetailLevel( $pref::shadows );
setDefaultFov( $pref::Player::defaultFov );
setZoomSpeed( $pref::Player::zoomSpeed );

// Start up the main menu... this is separated out into a
// method for easier mod override.

if ($JoinGameAddress !$= "") {
// If we are instantly connecting to an address, load the
// main menu then attempt the connect.
loadMainMenu();
connect($JoinGameAddress, "", $Pref::Player::Name);
}
else {
// Otherwise go to the splash screen.
Canvas.setCursor("DefaultCursor");
loadStartup();
}
}
(some code deleted here to save space)