Wysłany: 2017-02-04, 21:16
_Haze
Peace Yo!
Wiek: 24 Na forum: 4185 dni Posty: 1648
Nick w MP: Haze
Piwa : 2628
venzikk , zobacz kod u g?ry edytowa?em go
Wysłany: 2017-02-04, 21:21
venzikk
LUA, MODELER
Wiek: 24 Na forum: 3823 dni Posty: 235
Nick w MP: VenZ
Piwa : 3158
Dalej to samo, ale na karoserie tak jest zrobione:
function zaladujshadery ()
end -- funkcja , ktora laduje pliki shaderow
function wlaczauta ()
if not autoshader then autoshader = dxCreateShader ( "car_paint.fx" ) end
local AutatextureVol = dxCreateTexture ( "images/smallnoise3d.dds" )
local AutatextureCube = dxCreateTexture ( "images/cube_env256.dds" )
dxSetShaderValue ( autoshader , "sRandomTexture" , AutatextureVol )
dxSetShaderValue ( autoshader , "sReflectionTexture" , AutatextureCube )
engineApplyShaderToWorldTexture ( autoshader , "vehiclegrunge256" )
engineApplyShaderToWorldTexture ( autoshader , "?emap*" )
end
function wylaczauta ()
engineRemoveShaderFromWorldTexture ( autoshader , "vehiclegrunge256" )
engineRemoveShaderFromWorldTexture ( autoshader , "?emap*" )
destroyElement ( autoshader )
autoshader = nil
end
addEventHandler ( "onClientResourceStart" , resourceRoot ,
function()
GUIEditor . window [ 1 ] = guiCreateWindow ( 1053 , 227 , 226 , 391 , "Panel Shader?w by VenZ" , false )
guiWindowSetSizable ( GUIEditor . window [ 1 ], false )
GUIEditor . button [ 1 ] = guiCreateButton ( 9 , 343 , 207 , 38 , "Zamknij okno" , false , GUIEditor . window [ 1 ])
GUIEditor . checkbox [ 1 ] = guiCreateCheckBox ( 10 , 26 , 206 , 67 , "Karoseria Pojazd?w" , false , false , GUIEditor . window [ 1 ])
GUIEditor . checkbox [ 2 ] = guiCreateCheckBox ( 9 , 94 , 207 , 71 , "Odbicie pod?o?a" , false , false , GUIEditor . window [ 1 ])
GUIEditor . checkbox [ 3 ] = guiCreateCheckBox ( 9 , 168 , 207 , 68 , "BUDOWA" , false , false , GUIEditor . window [ 1 ])
GUIEditor . checkbox [ 4 ] = guiCreateCheckBox ( 9 , 237 , 207 , 63 , "BUD0WA" , false , false , GUIEditor . window [ 1 ])
end )
showCursor ( true )
addEventHandler ( "onClientGUIClick" , root ,
function()
if source == GUIEditor . checkbox [ 1 ] then
if guiCheckBoxGetSelected ( GUIEditor . checkbox [ 1 ])== true then
wlaczauta ()
elseif guiCheckBoxGetSelected ( GUIEditor . checkbox [ 1 ])== false then
wylaczauta ()
end
end
end )
I dzia?a na karoserie a to nie ;/
Podpis
Hej
[you]
,Tak ty! Pomogłem ci? zostaw
Pomagam w miarę możliwości
Kontakt:
Discord: VenZio#8080
GG:63293490
skype:szymex1021
Wysłany: 2017-02-04, 21:27
_Haze
Peace Yo!
Wiek: 24 Na forum: 4185 dni Posty: 1648
Nick w MP: Haze
Piwa : 2628
venzikk , mo?e zamiast * daj nazwy tych shader?w
Wysłany: 2017-02-04, 21:28
venzikk
LUA, MODELER
Wiek: 24 Na forum: 3823 dni Posty: 235
Nick w MP: VenZ
Piwa : 3158
Hazmudex , Da?em, ale teraz nawet shader si? nie odpali
Podpis
Hej
[you]
,Tak ty! Pomogłem ci? zostaw
Pomagam w miarę możliwości
Kontakt:
Discord: VenZio#8080
GG:63293490
skype:szymex1021
Wysłany: 2017-02-04, 21:29
_Haze
Peace Yo!
Wiek: 24 Na forum: 4185 dni Posty: 1648
Nick w MP: Haze
Piwa : 2628
Wysłany: 2017-02-04, 21:32
venzikk
LUA, MODELER
Wiek: 24 Na forum: 3823 dni Posty: 235
Nick w MP: VenZ
Piwa : 3158
hader , tec = nil
function nazwa ()
local shader , tec = dxCreateShader ( "roadshine.fx" )
if engineApplyShaderToWorldTexture ( shader , "roadshine" ) then return true end
return false
end
function wylaczauta1 ()
if shader then
engineRemoveShaderFromWorldTexture ( shader , "roadshine" )
destroyElement ( shader )
shader = nil
return true
end
return false
end
addEventHandler ( "onClientGUIClick" , root ,
function()
if source == GUIEditor . checkbox [ 2 ] then
if guiCheckBoxGetSelected ( source ) then
if nazwa () then
end
else
if wylaczauta1 () then
end
end
end
end )
Podpis
Hej
[you]
,Tak ty! Pomogłem ci? zostaw
Pomagam w miarę możliwości
Kontakt:
Discord: VenZio#8080
GG:63293490
skype:szymex1021
Wysłany: 2017-02-04, 21:34
_Haze
Peace Yo!
Wiek: 24 Na forum: 4185 dni Posty: 1648
Nick w MP: Haze
Piwa : 2628
venzikk , nazwe shader z pliku .fx
Wysłany: 2017-02-04, 21:36
venzikk
LUA, MODELER
Wiek: 24 Na forum: 3823 dni Posty: 235
Nick w MP: VenZ
Piwa : 3158
To jest kod tego shadera
--
-- c_roadshine . lua
--
addEventHandler ( "onClientResourceStart" , resourceRoot ,
function()
-- Version check
if getVersion (). sortable < "1.1.0" then
outputChatBox ( "Resource is not compatible with this client." )
return
end
-- Create shader
local shader , tec = dxCreateShader ( "roadshine.fx" )
if not shader then
outputChatBox ( "Could not create shader. Please use debugscript 3" )
else
outputChatBox ( "Using technique " .. tec )
-- Apply shader to all world textures
engineApplyShaderToWorldTexture ( shader , "*" )
end
end
)
Podpis
Hej
[you]
,Tak ty! Pomogłem ci? zostaw
Pomagam w miarę możliwości
Kontakt:
Discord: VenZio#8080
GG:63293490
skype:szymex1021
Wysłany: 2017-02-04, 21:37
Pawel5321
Szkrypter
Wiek: 36 Na forum: 3810 dni Posty: 237
Nick w MP: Pawell
Piwa : 2315
function wylaczsha ()
engineRemoveShaderFromWorldTexture ( roadshader , "*" )
destroyElement ( roadshader )
roadshader = nil
end
function wlaczsha ()
if not roadshader then roadshader = dxCreateShader ( "roadshine3.fx" , 0 ) end
dxSetShaderValue ( roadshader , "sStrength" , 1.5 )
dxSetShaderValue ( roadshader , "sFadeEnd" , maxEffectDistance )
dxSetShaderValue ( roadshader , "sFadeStart" , maxEffectDistance / 2 )
engineApplyShaderToWorldTexture ( roadshader , "*" )
end
takie trudne?
PS.
podpi?cie pod gui:
addEventHandler ( "onClientGUIClick" , root ,
function()
if source == GUIEditor . checkbox [ 2 ] then
if guiCheckBoxGetSelected ( GUIEditor . checkbox [ 2 ])== true then
wlaczsha ()
elseif guiCheckBoxGetSelected ( GUIEditor . checkbox [ 2 ])== false then
wylaczsha ()
end
end
end )
Ostatnio zmieniony przez Pawel5321 2017-02-04, 21:38, w całości zmieniany 2 razy
Wysłany: 2017-02-04, 21:37
_Haze
Peace Yo!
Wiek: 24 Na forum: 4185 dni Posty: 1648
Nick w MP: Haze
Piwa : 2628
venzikk , otw?rz plik .fx i podaj mi go
Wysłany: 2017-02-04, 21:39
venzikk
LUA, MODELER
Wiek: 24 Na forum: 3823 dni Posty: 235
Nick w MP: VenZ
Piwa : 3158
Pawel5321 , Teraz to wcale nie dzia?a :V
[ Dodano : 2017-02-04, 21:41 ]
//
// Example shader - roadshine.fx
//
//---------------------------------------------------------------------
// Road shine settings
//---------------------------------------------------------------------
float3 sLightDir = float3 ( 0.507 ,- 0.507 ,- 0.2 );
float sSpecularPower = 16 ;
//---------------------------------------------------------------------
// Include some common stuff
//---------------------------------------------------------------------
#define GENERATE_NORMALS // Uncomment for normals to be generated
#include "mta-helper.fx"
//---------------------------------------------------------------------
// Sampler for the main texture
//---------------------------------------------------------------------
sampler Sampler0 = sampler_state
{
Texture = ( gTexture0 );
};
//---------------------------------------------------------------------
// Structure of data sent to the vertex shader
//---------------------------------------------------------------------
struct VSInput
{
float3 Position : POSITION0 ;
float3 Normal : NORMAL0 ;
float4 Diffuse : COLOR0 ;
float2 TexCoord : TEXCOORD0 ;
};
//---------------------------------------------------------------------
// Structure of data sent to the pixel shader ( from the vertex shader )
//---------------------------------------------------------------------
struct PSInput
{
float4 Position : POSITION0 ;
float4 Diffuse : COLOR0 ;
float2 TexCoord : TEXCOORD0 ;
float3 WorldNormal : TEXCOORD1 ;
float3 WorldPos : TEXCOORD2 ;
};
//------------------------------------------------------------------------------------------
// VertexShaderFunction
// 1. Read from VS structure
// 2. Process
// 3. Write to PS structure
//------------------------------------------------------------------------------------------
PSInput VertexShaderFunction ( VSInput VS )
{
PSInput PS = ( PSInput ) 0 ;
// Make sure normal is valid
MTAFixUpNormal ( VS . Normal );
// Calculate screen pos of vertex
PS . Position = MTACalcScreenPosition ( VS . Position );
// Pass through tex coord
PS . TexCoord = VS . TexCoord ;
// Calculate GTA lighting for buildings
PS . Diffuse = MTACalcGTABuildingDiffuse ( VS . Diffuse );
// Set information to do specular calculation in pixel shader
PS . WorldNormal = MTACalcWorldNormal ( VS . Normal );
PS . WorldPos = MTACalcWorldPosition ( VS . Position );
return PS ;
}
//------------------------------------------------------------------------------------------
// PixelShaderFunction
// 1. Read from PS structure
// 2. Process
// 3. Return pixel color
//------------------------------------------------------------------------------------------
float4 PixelShaderFunction ( PSInput PS ) : COLOR0
{
// Get texture pixel
float4 texel = tex2D ( Sampler0 , PS . TexCoord );
//
// Specular calculation
//
float3 lightDir = normalize ( sLightDir );
// Using Blinn half angle modification for performance over correctness
float3 h = normalize ( normalize ( gCameraPosition - PS . WorldPos ) - lightDir );
float specLighting = pow ( saturate ( dot ( h , PS . WorldNormal )), sSpecularPower );
// Modulate specular with texture a little bit to break up the surface
specLighting *= texel . g * texel . g ;
// Apply diffuse lighting
float4 finalColor = texel * PS . Diffuse ;
// Apply specular
finalColor . rgb += texel . rgb * specLighting ;
return finalColor ;
}
//------------------------------------------------------------------------------------------
// Techniques
//------------------------------------------------------------------------------------------
technique shine
{
pass P0
{
VertexShader = compile vs_2_0 VertexShaderFunction ();
PixelShader = compile ps_2_0 PixelShaderFunction ();
}
}
// Fallback
technique fallback
{
pass P0
{
// Just draw normally
}
}
Podpis
Hej
[you]
,Tak ty! Pomogłem ci? zostaw
Pomagam w miarę możliwości
Kontakt:
Discord: VenZio#8080
GG:63293490
skype:szymex1021
Wysłany: 2017-02-04, 21:43
Pawel5321
Szkrypter
Wiek: 36 Na forum: 3810 dni Posty: 237
Nick w MP: Pawell
Piwa : 2315
venzikk , bo zrobi?em to pod roadshine3 . Zaraz ci pode?l? na pw dzia?aj?ce
Wysłany: 2017-02-04, 21:44
venzikk
LUA, MODELER
Wiek: 24 Na forum: 3823 dni Posty: 235
Nick w MP: VenZ
Piwa : 3158
Pawel5321 , Okey ;v
Podpis
Hej
[you]
,Tak ty! Pomogłem ci? zostaw
Pomagam w miarę możliwości
Kontakt:
Discord: VenZio#8080
GG:63293490
skype:szymex1021
Wysłany: 2017-02-04, 21:46
marcin778
Krytyk serwerów MTA
Wiek: 24 Na forum: 4150 dni Posty: 2268
Nick w MP: Marcineg
Piwa : 4662
function wylaczsha ()
engineRemoveShaderFromWorldTexture ( roadshader , "*" )
destroyElement ( roadshader )
roadshader = nil
end
function wlaczsha ()
if not roadshader then roadshader = dxCreateShader ( "roadshine.fx" , 0 ) end
dxSetShaderValue ( roadshader , "sStrength" , 1.5 )
dxSetShaderValue ( roadshader , "sFadeEnd" , maxEffectDistance )
dxSetShaderValue ( roadshader , "sFadeStart" , maxEffectDistance / 2 )
engineApplyShaderToWorldTexture ( roadshader , "*" )
end
Tagi: function
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: