Jump to content

Krokara

Members
  • Posts

    27
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Krokara's Achievements

Advanced Member

Advanced Member (8/54)

0

Reputation

  1. Animation video I want to walk this animation
  2. It looks like ZEnable false only works with image and ZEnable true for objects, technique technique energyField { pass P0 { ZEnable = true; //ZWriteEnable = true; VertexShader = compile vs_3_0 VertexShaderFunction(); PixelShader = compile ps_3_0 PixelShaderFunction(); } } Result It's working a lot, thank you The_GTA
  3. // // energyField.fx // By: Brandon Fogerty // http://glslsandbox.com/e#25448.3 // glsl to hlsl translation by Ren712 // bfogerty at gmail dot com // xdpixel.com // Special thanks to Inigo Quilez for noise! //------------------------------------------------------------------------------------------ // //-- These two are set by MTA //------------------------------------------------------------------------------------------// matrix gProjectionMainScene : PROJECTION_MAIN_SCENE; //------------------------------------------------------------------------------------------ // Shader settings //------------------------------------------------------------------------------------------ float2 sTexSize = float2(800,600); float2 sScale = float2(0.5,0.5); float2 sCenter = float2(0.5,0.5); //------------------------------------------------------------------------------------------ // These parameters are set by MTA whenever a shader is drawn //------------------------------------------------------------------------------------------ float4x4 gWorld : WORLD; float4x4 gView : VIEW; float4x4 gProjection : PROJECTION; float gTime : TIME; #define PI 3.1415926535897 //------------------------------------------------------------------------------------------ // 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; }; struct VS_IN { float4 position : POSITION; float2 texcoord : TEXCOORD; }; struct VS_OUT { float4 position : SV_POSITION; float2 texcoord : TEXCOORD0; }; struct PS_OUT { float4 color : COLOR0; float depth : DEPTH0; }; VS_OUT VS(VS_IN input) { VS_OUT output = (VS_OUT)0; output.position = input.position; output.texcoord = input.texcoord; return output; } PS_OUT PS(VS_OUT input) { PS_OUT output = (PS_OUT)0; // Now that output.depth is defined with SV_Depth, and you have depth-write enabled, // this should write to the depth buffer. output.depth = 0; return output; } //----------------------------------------------------------------------------- //-- Get value from the depth buffer //-- Uses define set at compile time to handle RAWZ special case (which will use up a few more slots) //----------------------------------------------------------------------------- float FetchDepthBufferValue( float2 uv ) { float4 texel = tex2D(SamplerDepth, uv); #if IS_DEPTHBUFFER_RAWZ float3 rawval = floor(255.0 * texel.arg + 0.5); float3 valueScaler = float3(0.996093809371817670572857294849, 0.0038909914428586627756752238080039, 1.5199185323666651467481343000015e-5); return dot(rawval, valueScaler / 255.0); #else return texel.r; #endif } //----------------------------------------------------------------------------- //-- Use the last scene projecion matrix to linearize the depth value a bit more //----------------------------------------------------------------------------- float Linearize(float posZ) { return gProjectionMainScene[3][2] / (posZ - gProjectionMainScene[2][2]); } PSInput VertexShaderFunction(VSInput VS) { PSInput PS = (PSInput)0; // Calculate screen pos of vertex float4 posWorld = mul(float4(VS.Position.xyz,1), gWorld); float4 posWorldView = mul(posWorld, gView); PS.Position = mul(posWorldView, gProjection); // Pass through color and tex coord PS.Diffuse = VS.Diffuse; // Translate TexCoord float2 position = float2(VS.TexCoord.x,1 - VS.TexCoord.y); float2 center = 5 + (sCenter + 0.6); position += float2(1 - center.x, center.y) - 0.5; position = (position - 0.5) * float2(sTexSize.x/sTexSize.y,1) / sScale + 0.5; position -= 0.5; PS.TexCoord = position; return PS; } //------------------------------------------------------------------------------------------ // PixelShaderFunction //------------------------------------------------------------------------------------------ float hash( float n ) { return frac(sin(n)*753.5453123); } // Slight modification of iq's noise function. float noise( float2 x ) { float2 p = floor(x); float2 f = frac(x); f = f*f*(5.0-2.0*f); float n = p.x + p.y*157.0; return lerp( lerp( hash(n+ 0.0), hash(n+ 1.0),f.x), lerp( hash(n+157.0), hash(n+158.0),f.x), f.y); } float fbm(float2 p, float3 a) { float v = 0.0; v += noise(p*a.x)*.5; v += noise(p*a.y)*.25; v += noise(p*a.z)*.125; return v; } float3 drawLines( float2 uv, float3 fbmOffset, float3 color1, float3 color2, float timer ) { float timeVal = timer * 0.1; float3 finalColor = float3( 0.0,0.0,0.0 ); for( int i=0; i < 3; ++i ) { float indexAsFloat = float(i); float amp = 40.0 + (indexAsFloat*5.0); float period = 2.0 + (indexAsFloat+2.0); float thickness = lerp( 0.9, 1.0, noise(uv*10.0) ); float t = abs( 0.9 / (sin(uv.x + fbm( uv + timeVal * period, fbmOffset )) * amp) * thickness ); finalColor += t * color1; } for( int j=0; j < 5; ++j ) { float indexAsFloat = float(j); float amp = 40.0 + (indexAsFloat*7.0); float period = 2.0 + (indexAsFloat+8.0); float thickness = lerp( 0.7, 1.0, noise(uv*10.0) ); float t = abs( 0.8 / (sin(uv.x + fbm( uv + timeVal * period, fbmOffset )) * amp) * thickness ); finalColor += t * color2 * 0.6; } return finalColor; } float4 PixelShaderFunction(PSInput PS) : COLOR0 { // Get TexCoord float2 position = PS.TexCoord; float timer = gTime; // correction position.xy = position.yx; float3 lineColor1 = float3( 2.3, 0.5, .5 ); float3 lineColor2 = float3( 0.3, 0.5, 2.5 ); // main effect float3 finalColor = float3(0,0,0); float t = sin( timer ) * 0.5 + 0.5; float pulse = lerp( 0.10, 0.20, t); finalColor += drawLines( position, float3( 1.0, 20.0, 30.0), lineColor1, lineColor2, timer ) * pulse; finalColor += drawLines( position, float3( 1.0, 2.0, 4.0), lineColor1, lineColor2, timer ); return float4(finalColor.rgb,1); } //------------------------------------------------------------------------------------------ // Techniques //------------------------------------------------------------------------------------------ technique energyField { pass P0 { zEnable = false; VertexShader = compile vs_3_0 VS(); PixelShader = compile ps_3_0 PS(); } pass P1 { VertexShader = compile vs_3_0 VertexShaderFunction(); PixelShader = compile ps_3_0 PixelShaderFunction(); } } // Fallback technique fallback { pass P0 { // Just draw normally } } I don't understand why it is not modifying depth
  4. that Russian lightning effect I couldn't make it work so for now I'm not touching it this is another shader object is not working like the image I made a video https://drive.google.com/file/d/1XV588GBdFpLUXZksPVjZSoPfpI5ss4Z1/view?usp=sharing
  5. I, couldn't change the depth texture gDepthBuffer : DEPTHBUFFER; Texture2D m_TextureColor; sampler SamplerDepth = sampler_state { Texture = (gDepthBuffer); AddressU = Clamp; AddressV = Clamp; }; SamplerState g_samPoint { Filter = MIN_MAG_MIP_POINT; AddressU = Wrap; AddressV = Wrap; }; struct VS_IN { float4 position : POSITION; float2 texcoord : TEXCOORD; }; struct VS_OUT { float4 position : SV_POSITION; float2 texcoord : TEXCOORD0; }; struct PS_OUT { float4 color : COLOR0; float depth : DEPTH0; }; VS_OUT VS(VS_IN input) { VS_OUT output = (VS_OUT)0; output.position = input.position; output.texcoord = input.texcoord; return output; } PS_OUT PS(VS_OUT input) { PS_OUT output = (PS_OUT)0; // Now that output.depth is defined with SV_Depth, and you have depth-write enabled, // this should write to the depth buffer. output.depth = m_TextureColor.SampleLevel(g_samPoint, input.texcoord, 0); return output; } technique depthh { pass P0 { VertexShader = compile vs_3_0 VS(); PixelShader = compile ps_3_0 PS(); } } ZEnable, it worked on the image correctly, but I think that the object did not work due to the depth that I could not modfy and it keeps disappearing object at times
  6. More other players would not see the same thing in the same player world position.
  7. https://wiki.multitheftauto.com/wiki/DepthBuffer float4 PS_Example( PSInput In ) : COLOR { float BufferValue = FetchDepthBufferValue( In.TexCoord.xy ); float Depth = Linearize( BufferValue ); Depth = 0.0f; return Depth; } so far is everything alright? now i don't know how i can disable depth testing
  8. You misunderstood I want the object to be visible even with the player in front of the object
  9. i want to give visual priority to make my object appear first than the player when the player is in front of the object it is no longer visible i want to change it
  10. 3d round object is already done
  11. if create an object how will do those effects?
  12. Thank you the role follows the character's camera a how I can make the vertices be round? exemple: can be done using: dxDrawImage3D?
×
×
  • Create New...