Jump to page content
English English   Polish Polish   Dutch Dutch   Russian Russian   German German   Hungarian Hungarian   Norwegian Norwegian   Swedish Swedish   Finnish Finnish   Romanian Romanian   Spanish Spanish   Portuguese Portuguese   Latvian Latvian  


rssShader Flashlight test (shader_flashlight_test)

Rate:You need to be logged in to vote
Rating:3.7 (70 Votes)
This resource is discontinued. It uses an old inefficient methods, You'll find better lighting resources here: https://community.mtasa.com/index.php?p=resources&s=de..p;id=18512

resource: Shader_flashlight_test v1.2.5
author: Ren712
videos: http://www.youtube.com/watch?v=_Zswo_uObS4

uses: http://community.multitheftauto.com/index.php?p=resources&..mp;id=9398
other resources:
projectile lighting: http://community.multitheftauto.com/index.php?p=resources&..p;id=11072
vehicle lighting: http://community.multitheftauto.com/index.php?p=resources&..p;id=11071
night mod: https://community.multitheftauto.com/index.php?p=resources..p;id=13740

If you see any issues,or if you have any suggestions - just
post them in the comments section.

Update v1.1.9
-Rewritten the flashlight script to make it use dynamic_lighting exported functions.
Update v1.1.7
-The last version that doesn't use dynamic_lighting resource.
Update v0.8.9
-The last version using a texCube for lighting.

Instead of a projected cube texture this version uses per pixel spot light.
Shader model 3 supports up to 15 lights at once while.
Shader model 2 - only one light effect synced.

This version doesn't work with other toWorldTexture effects.
(With default settings) Look into dynamic_lighting resource for solutions.


This is the flashlight shader I've been working on. It's a fully functional
version. All you need is to start the resource and you will
see the explanation on how to use it in the chatbox.

The shader projects a light effect on nearby world, vehicle
and ped textures.

The original flashlight model from:
Slightly modified.

Requires bone_attach resource and dynamic_lighting.
Place them in resources folder along with flashlight script.


Download latest version | Report

Version history

Version Publish Date Changes
1.2.5 2016-03-22 21:39:49 -rewritten event stuff Download
1.2.4 2015-12-28 01:04:25 -fixed a recent typo Download
1.2.3 2015-12-28 00:55:45 -added separate light settings for localPlayer
-light is being switched off when entering a vehicle
1.2.2 2015-02-28 20:17:43 -readded gAttenuation variable
-added switchFlashLight event for external resources
1.2.1 2014-11-03 02:44:48 -Improved shader performance (requires new dynamic_lighting resource version) Download
1.2.0 2014-07-07 22:03:53 -Changed effectRange and distFade to make this effect as fps friendly as pre 1.19 version. Download
1.1.9 2014-06-23 16:39:42 - Rewritten the flashlight script to make it use dynamic_lighting exported functions. Download
1.1.7 2014-03-09 00:00:33 -Decided to drop the redefinition of the effect during play (introduced in 1.04).
-culling the light sources that are not visible on screen.
-Increased max number of synced lights to 15+1 (5+1 is default)
1.1.6 2014-03-08 18:59:20 -Reconfigured the depthBias for layered effects Download
1.1.5 2014-03-04 10:53:23 -Deleted some needless chatbox output Download
1.1.4 2014-03-04 10:44:46 -Applied better solution for zFighting when the Effect is layered
-removed few shinemap textures from the effect
-isEffectForcedOn: switching between 1 and 2 lights works faster
-Shader model 2 shader is not forced for shader model 3 graphics cards
1.1.3 2014-03-04 07:56:09 -Set the isEffectForcedOn variable to false. Download
1.1.2 2014-02-19 07:02:24 -Added isEffectForcedOn variable to force the shader effect to be applied when the lights are turned off. Alternative 'false' serves for better performance (no needless shaders applied) Download
1.1.1 2014-02-14 16:37:06 -Set the isEffectLayered variable back to false. Download
1.1.0 2014-02-14 16:31:18 -Added an option to apply the world and ped effects in a separate pass.
Gives an ability to use other world shader effects - but with significant FPS drop.
-Changed blending method for vehicle shader.
1.0.9 2014-02-14 15:35:52 -Replaced onClientRender events with timers for some calculations in order to save FPS Download
1.0.8 2014-02-14 06:31:10 -Changed the light position update method. Solves issues with light source shaking. Download
1.0.7 2014-01-20 01:28:07 -Effect redefinition fix Download
1.0.6 2014-01-09 02:06:26 -Added fallback techniques Download
1.0.5 2014-01-09 01:53:21 -Reapplied gtasa fog for sm 3.0 effect (thanks to ccw for the SM 3.0 pixel shader snippet for fog) Download
1.0.4 2014-01-06 22:39:13 -Increased potential max support to 12 flashlights streamed in
-Optimalisation: the effect is redefined and restarted for certain number of light effects
1.0.3 2014-01-06 03:26:53 -Fixed some potential alpha issues
-Optimised the effects
Added some variables:
-gBrightness - modify world ,ped and vehicle texture brightness
-gLightFalloff - a spotlight attenuation variable
-gWorldSelfShadow - bring back world object self shadowing from previous versions
1.0.2 2013-12-30 15:24:40 -Increased max light support for SM3 to 8+1 (localPlayer)
-Applied light sorting (isSortLight)
-theta and phi variables now in dergees instead of radians
1.0.1 2013-12-29 01:25:34 -Added some explanation for theta and phi variables
-lowered the gta point light brightness
1.0.0 2013-12-28 23:41:08 -Changed the rendering techniques Download
0.8.9 2013-10-31 23:21:16 -The maxLights value doesn't affect localPlayer anymore
-disableFLTex to make the carried flashlight not visible
(useful for alterAttach)
-Minor alteration in the shader to optimise the flashlight effect
-autoEnableFL simplifies flashlight usage
0.8.8 2013-08-10 20:55:16 -Added maxLights variable to set max light effects synced at once (default 2) Download
0.8.7 2013-07-22 22:25:38 -Fixed lightrays transparency issues
-Tried to optimise flashlight effect
-Added isSynced variable to reduce lag (false = only localPlayer's light effect )
-Added alterAttach variable to attach flashlight for more convenient use.. to forehead .. and it works
0.8.5 2013-04-17 13:05:52 -Added flashlight object streaming in/out.
-The flashlight works in interiors now.
-Rewritten some partsof hlsl and lua code.
0.8.0 2013-04-15 20:37:09 -Added main Effect streaming in/out on max distance.
-Workaround for effect flashing onStart/stream in.
-Added fake bumps variable.
-Flashlight rays visible after max distance is reached.
-Fixed :not switching off the flashlight when player is streamed out.
0.7.0 2013-04-06 00:20:23 First public release Download