Jump to content
  • Advertisement
Sign in to follow this  
IYP

OpenGL what does textureGather exactly do?

This topic is 1208 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Ok I've been trying to do bilinear PCF for my shadows, which I success fully did then I tried to use textureGather function to maybe increase the performance in which I failed, so problem is in the spec it's said:

 

    vec4(Sample_i0_j1(P, base).comp,
         Sample_i1_j1(P, base).comp,
         Sample_i1_j0(P, base).comp,
         Sample_i0_j1(P, base).comp);

 

also said:

 

textureGather — gathers four texels from a texture

 

but since returned vector's x component "Sample_i0_j1(P, base).comp" is the same texel as returned vector's w component "Sample_i0_j1(P, base).comp" it actually gathers 3 texels, so my guess here is that the x component of the returned vector should be "Sample_i0_j0(P, base).comp", and even if that is the case then why isn't the behavior of:

	vec4 samplesDepth=textureGather(ShadowMap,vec3(samples/vec2(TextureSize),i));

thes same as:

	samplesDepth.x=texelFetch(ShadowMap,ivec3(ivec2(samples),i),0).x;
	samplesDepth.z=texelFetch(ShadowMap,ivec3(ivec2(samples)+ivec2(1,0),i),0).x;
	samplesDepth.w=texelFetch(ShadowMap,ivec3(ivec2(samples)+ivec2(0,1),i),0).x;
	samplesDepth.y=texelFetch(ShadowMap,ivec3(ivec2(samples)+ivec2(1,1),i),0).x;

smaples is floored so changing it to ivec2 doesn't effect the values.

 

also ShadowMap is an array texture

 

Thanks in advance

Edited by IYP

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!