-
Posts
327 -
Joined
-
Last visited
-
Days Won
2
Everything posted by Ren_712
-
try engineApplyShaderToWorldTexture(myShader,"*") -- which will apply to all the textures. DakiLLa might have a point on this.
-
With the code provided i'm quite surprised that you have shader max render distance defined. How about setting that yourself: shader = dxCreateShader('shader.fx',0,0,false,"world") - this changes the distance to infinite.
-
Works for every camera condition. Renders properly with current FOV setings. Will support every static world object, vehicle and ped elements. The resource is still WIP. So no download yet.
-
It requires as much resources as if the object was rendered normally.
-
Get 4x4 matrix of the camera, multiply by rotation matrix, change the position offsets, apply to the vehicle. Then send camera position, forward vector, and roll to shader so we could recreate camera matrix (needed for fixing the "camera lag" i mentioned before). Then there is a matter of recreating the projection matrix - to make it easy to scale the object. And ofcourse making the vehicle render in front of everything else. Then we need to recreate a gtasa vehicle effect (shader). Lighting should not be affected by vehicle position and rotation. Done effects for peds and objects as well. Still got some issues with volumetric shadows. But i guess it can't be helped.
-
Bumping the topic: I have dealt with cameraMatrix lagging when cameraTarget is localPlayer. All the issues regarding scaling, positioning and rotating object are also out of the way. The video doesn't show the object being rendered in a separate RT but that will be an option.
-
you might look at this resource: https://nightly.multitheftauto.com/files/shaders/shader_flag.zip
-
Yes. It is a very interesting 1.5 feature.
-
I don't know if MTA lets you import dynamic objects. You could create basic 'physics' using lua. https://wiki.multitheftauto.com/wiki/ProcessLineOfSight https://wiki.multitheftauto.com/wiki/IsLineOfSightClear https://wiki.multitheftauto.com/wiki/Easing
-
That means you did not apply the shader to the 'object' element. 'object' can be a vehicle, ped, world object. For example: You create 2 objects 2 shaders and 2 textures dxSetShaderValue( myshader1,"gTexture", mytexture1) dxSetShaderValue( myshader2,"gTexture", mytexture2) engineApplyShaderToWorldTexture( shader1, "texturename", myobject1 ) engineApplyShaderToWorldTexture( shader2, "texturename", myobject2 )
-
lua: local myobject = createObject ( ... local myshader = dxCreateShader("effect_file.fx") local mytexture = dxCreateTexture("mytexture.png", "dxt5") dxSetShaderValue( myshader,"gTexture", mytexture) engineApplyShaderToWorldTexture( shader, "texturename", myobject ) effect: texture gTexture; technique TexReplace { pass P0 { Texture[0] = gTexture; } }
-
I'd suggest changing the object into more appropriate one. How about this: -- Apply to world texture engineApplyShaderToWorldTexture ( shader, "bobo_2" ) -- Create object with model 4729 (billboard) local x,y,z = getElementPosition( getLocalPlayer() ) theObject = createObject ( 4729, x-15, y, z+3 ) setElementAlpha(theObject, 254) You might get some alpha issues. Might 'in an ugly way' fix them by exporting the object from gta3.img, then replacing ingame using mta engine functions - setting alpha transparency to 'true'. Or just create this object in front of the breakable one, set alpha to 0 so the wall is not visible.
-
It can be done.
-
You might look at this: https://bugs.mtasa.com/view.php?id=8769 We are talking here about creating texture as render targets in MTA. Haven't had much time lately, but i think this is what You are looking for.
-
It is a plugin for dynaimc_lighting resource. Aditional effects have been made for lod models in order to optimize the framerate. If you have any suggestions, ideas to make this resorce better - don't hesitate to say. I'm willing to share the resource with people that are willing to present more than is common in mta community. If you are a scripter willing to create unique experience and prove it - send a PM.
-
If i understood correctly - you want to change the alpha of the ScreenTexture. You might edit the MaskTexture, or you can setShaderValue( myShader, "gAlphaMult", alphaValue) -- ( 0 - 1). Are you using 50p's mask class ? Or just this shader ? /* Author: 50p Version: v1.0 Description: This shader allows you to mask a texture with a mask texture (black and white). */ float gAlphaMult = 1; texture ScreenTexture; sampler implicitInputTexture = sampler_state { Texture = ; }; texture MaskTexture; sampler implicitMaskTexture = sampler_state { Texture = ; }; float4 MaskTextureMain( float2 uv : TEXCOORD0 ) : COLOR0 { float4 sampledTexture = tex2D( implicitInputTexture, uv ); float4 maskSampled = tex2D( implicitMaskTexture, uv ); sampledTexture.a = (maskSampled.r + maskSampled.g + maskSampled.b) / 3.0f; sampledTexture.a *= gAlphaMult; return sampledTexture; } technique Technique1 { pass Pass1 { AlphaBlendEnable = true; SrcBlend = SrcAlpha; DestBlend = InvSrcAlpha; PixelShader = compile ps_2_0 MaskTextureMain(); } }
-
How about executing the addClothes function onClientResourceStart ? Or at least when the element is streamed in.
-
so you have a texture ... local mytex = dxCreateTexture("my_texture.png") local myshader = dxCreateShader("my_shader.fx") dxSetShaderValue(myshader,"gTexture0",mytex) engineApplyShaderToWorldTexture(myshader,"remap_supra92") texture gTexture0; //-- Very simple technique technique texReplace { pass P0 { //-- Set up texture stage 0 Texture[0] = gTexture0; } }
-
This doesn't seem to matter much. What matters is how many textures visible on screen the shader is applied to. vertex and pixel calculations are done when they're needed. (You can always create shader per entity - when it's streamed in) And you can change values per shader, not per texture. Exception are dxDrawImage and dxDrawMateriaLine3D - after drawing one you can just change values before you draw another (in the same frame).
-
If you want to change ped alpha using shaders you'll have to change it's rendering order. To make it render after world objects - you'll need to lower it's alpha. The solution: setElementAlpha(localPlayer,254)
-
This: float4 gColor = float4(1,1,1,1); bool bIsGTADiffuse = true; //--------------------------------------------------------------------- // Include some common stuff //--------------------------------------------------------------------- #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; 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; }; //------------------------------------------------------------------------------------------ // VertexShaderFunction // 1. Read from VS structure // 2. Process // 3. Write to PS structure //------------------------------------------------------------------------------------------ PSInput VertexShaderFunction(VSInput VS) { PSInput PS = (PSInput)0; // Calculate screen pos of vertex PS.Position = MTACalcScreenPosition ( VS.Position ); // Pass through tex coord PS.TexCoord = VS.TexCoord; // Calculate GTA lighting for buildings float4 Diffuse = MTACalcGTABuildingDiffuse( VS.Diffuse ); PS.Diffuse = 0; if (bIsGTADiffuse) PS.Diffuse = Diffuse; else PS.Diffuse = float4(1,1,1,Diffuse.a); PS.Diffuse *= gColor; 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); // Apply diffuse lighting float4 finalColor = texel * PS.Diffuse; return finalColor; } //------------------------------------------------------------------------------------------ // Techniques //------------------------------------------------------------------------------------------ technique colorize { pass P0 { VertexShader = compile vs_2_0 VertexShaderFunction(); PixelShader = compile ps_2_0 PixelShaderFunction(); } } // Fallback technique fallback { pass P0 { // Just draw normally } } Replace the roadshine.fx content of shader_roadshine example. Use dxSetShaderValue to set gColor and bIsGTADiffuse.
-
This resource has been made to eliminate any directional light influence on objects: https://community.multitheftauto.com/index.php?p= ... s&id=10186 You might try to apply the effect on peds to see if it does the job. Otherwise if you like to see only bright ped texture - with no vertex colors at all - you might try this effect: float rgbBright = 1.0; texture gTexture0 < string textureState="0,Texture"; >; sampler Sampler0 = sampler_state { Texture = (gTexture0); }; //------------------------------------------- // Pixel Shader //------------------------------------------- float4 PSFunction(float4 TexCoord : TEXCOORD0, float4 Position : POSITION, float4 Diffuse : COLOR0) : COLOR0 { float4 Tex = tex2D(Sampler0, TexCoord.xy); Tex.rgb *= rgbBright; Tex.a *= Diffuse.a; return saturate(Tex); } technique Techinque0 { pass p0 { AlphaBlendEnable = TRUE; PixelShader = compile ps_2_0 PSFunction(); } }
-
Dividing huge numbers per pixel has always been quite resource demanding. I'd suggest rethinking the way you deal with that. Also there is a resource on community that you might like to check out: https://community.multitheftauto.com/index.php?p= ... s&id=10163
-
The shader doesn't seem to be applied at all. Since there are no any errors in debug console - it means that your graphics card doesn't support shader model 3.0
-
Try this: https://community.multitheftauto.com/in ... s&id=10163