Jump to content

  • Log In with Google      Sign In   
  • Create Account


Massive number of pixel shader inputs?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 Tessellator   Members   -  Reputation: 552

Like
0Likes
Like

Posted 18 August 2005 - 04:20 AM

Hi, If we move all lighting calculations into the pixel shader (including transforming our per-pixel normal into world space), so that we avoid changing the number of shader inputs/outputs as the number of lights change, the number of shader inputs becomes quite large. For example:
struct PS_INPUT
{
    float4 Position   : POSITION;
    float3 Normal     : TEXCOORD0;
    float3 Tangent    : TEXCOORD1;
    float3 Bitangent  : TEXCOORD2;
    float3 WorldPos   : TEXCOORD3;
    float2 TexCoords  : TEXCOORD4;
};

This allows us access to a per-pixel basis to transform normals into world space, and the world position of the texel we are going to shade. However, we still need to add more texture coords once we factor in things like shadow mapping and projective textures. This seems like quite a lot of inputs to me. So, basically, I'm curious now. On average, how many inputs do you guys have into your shaders? Does the above seem excessive? I guess once you start sending in interpolated lighting normals (rather than doing the math in the PS), the numbers grow quite large anyway..? T

Sponsor:

#2 Cypher19   Members   -  Reputation: 768

Like
0Likes
Like

Posted 18 August 2005 - 04:32 AM

So what if there are a lot of inputs?

Oh, and for me in theory, I'm going to have 14 inputs, but of course I can't due to technical limitations so I have to run to deferred shading to precompute some things like bump mapping.

#3 y2kiah   Members   -  Reputation: 900

Like
0Likes
Like

Posted 18 August 2005 - 05:03 AM

I currently have 15 inputs including samplers for 11 texture reads for my terrain, in practice I might reduce this to 6 texture reads and use another pass for the 4 layers that I would lose.

Unless you are changing the input values quite often throughout the frame it doesn't make much difference how many you have, but logically the shader will get slower the more things you ask it to do, and the more things you ask it to do the more inputs you will probably need.

I am rethinking my shader for performance reasons, since for about 95% of the pixels drawn, 5 of the texture reads make no difference to the final output. I'm better off drawing a more optimized pass for the areas where those layers count.

#4 Tessellator   Members   -  Reputation: 552

Like
0Likes
Like

Posted 18 August 2005 - 05:10 AM

I haven't really kept up to date with gfx hardware, but the last time I used pixel shaders, the number of inputs were a lot smaller. I guess it isn't so much of a big deal these days... I'll expermient throwing loads of stuff in and see what happens to performance.

Thanks for sharing guys. :)

T




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS