» electricity shader on recent nvidia cards
This site relies heavily on Javascript. You should enable it if you want the full experience. Learn more.

electricity shader on recent nvidia cards

question resolved using-vvvv

u7angel 03/02/12 - 02:19

has some of you shader maniacs an idea why the old electricity shader doesnt work on recent (geforce 570/560) cards but on an old geforce 8800gtx.

the shader compiles just fine on both system but does its magic only on the old card.

//Electricty PS1.1 / VS2.0
//
// -----------------------------------------------------------------------------
// PARAMETERS:
// ------------------------------------------------------------------------------
 
//Tranforms
float4x4 tWVP: WORLDVIEWPROJECTION;
 
//Tweaks
 
float4 col2 : COLOR <String uiname="Color"; >  = {1, 1, 1, 1};
float glowStrength;
float ambientGlow;
float ambientGlowHeightScale;
float height;
float glowFallOff;
float speed;
float vertexNoise;
float time;
 
//Texture
 
texture Noise_Tex;
sampler Noise = sampler_state
{
   Texture = (Noise_Tex);
   ADDRESSU = WRAP;
   ADDRESSV = WRAP;
   ADDRESSW = WRAP;
   MAGFILTER = LINEAR;
   MINFILTER = LINEAR;
   MIPFILTER = LINEAR;
};
//Structure
 
struct vs2ps {
   float4 Pos: POSITION;
   float2 texCoord: TEXCOORD;
};
 
// -----------------------------------------------------------------------------
// VERTEXSHADER
// -----------------------------------------------------------------------------
 
vs2ps VS(
 
   float4 Pos: POSITION)
{
 
   vs2ps Out = (vs2ps)0;
 
   // Clean up inaccuracies
   Pos.xy = sign(Pos.xy);
 
   Out.Pos = mul(Pos, tWVP);
   Out.texCoord = Pos.xy;
 
   return Out;
}
 
// -----------------------------------------------------------------------------
// PIXELSHADER
// -----------------------------------------------------------------------------
 
float4 PS(
float2 texCoord: TEXCOORD) : COLOR
{
 
float2 t = float2(speed * time * 0.5871 - vertexNoise * abs(texCoord.y), speed * time);
 
   // Sample at three positions for some horizontal blur
   // The shader should blur fine by itself in vertical direction
   float xs0 = texCoord.x;
   float xs1 = texCoord.x;
   float xs2 = texCoord.y + texCoord.x ;
 
   // Noise for the three samples
   float noise0 = tex3D(Noise, float3(xs0, t)).r;
   float noise1 = tex3D(Noise, float3(xs1, t)).r;
   float noise2 = tex3D(Noise, float3(xs2, t)).r;
 
   // The position of the flash
   float mid0 = height * (noise0 * 2 - 1) * (1 - xs0 * xs0);
   float mid1 = height * (noise1 * 2 - 1) * (1 - xs1 * xs1);
   float mid2 = height * (noise2 * 2 - 1) * (1 - xs2 * xs2);
 
   // Distance to flash
   float dist0 = abs(texCoord.y - mid0);
   float dist1 = abs(texCoord.y - mid1);
   float dist2 = abs(texCoord.y - mid2);
 
   // Glow according to distance to flash
   float glow = 1.0 - pow(0.25 * (dist0 + 2 * dist1 + dist2), glowFallOff);
 
   // Add some ambient glow to get some power in the air feeling
   float ambGlow = ambientGlow * (1 - xs1 * xs1) * (1 - abs(ambientGlowHeightScale * texCoord.y));
 
   return (glowStrength * glow * glow + ambGlow) * col2;
}
 
 
//--------------------------------------------------------------//
// Technique
//--------------------------------------------------------------//
technique Electricty
{
   pass P0
   {
 
      VertexShader = compile vs_1_1 VS();
      PixelShader = compile ps_2_0 PS();
   }
 
}
4 replies 0 new

link | Flagged as solution by u7angel. Remove solution flag. u7angel 03/02/2012 - 15:28

ok solved...filetexture lost its volume texture setting. haha

I'm getting this on my NVIDIA GeForce GTX 460M. Any help?

link | Flagged as solution by matka. Remove solution flag. mrboni 02/04/2012 - 17:35

change the texture type in filetexture to a volume texture

thanks, solved!!

anonymous user login

Shoutbox

~6min ago

Urbankind: circuitb:Wrongcop is epic! :)

~46min ago

joreg: @tobi: use GetSlice() as the patch i referred you to is demonstrating. or start a forum thread with your patch.

~57min ago

TobiTobsen123: hmm yes i can see the values...but how to handle them as seperate values? I need to forward them via TCP/IP...

~2h ago

joreg: @tobi: OSCDecoder helppatch has a section: OSC_Advanced (bottomright) that demoes decoding of multiple messages

~3h ago

TobiTobsen123: I'm using an OSCDecoder, it receives two arguments...works but how can I seperate the arguments into two seperate values

~5h ago

u7angel: @mediadog, make it a forum question.

~6h ago

u7angel: @mediadog, tty renderer ?

~8h ago

microdee: however non-conductive objects are invisible for this so the pencil and the sticks in the video are still a mysteries