shader texture calls with varying variables

nirradi

Newcomer
hello, knowers of all things shady.

please answer me this: a texture coordinate can be assigned into a varying variable in a vert. program and then used in the fragment program, when the fixed part of the pipeline calculates the level of detail, does it calculate it according to the derivatives of that specific varying variable?

for example, if i decide to assign a texcoord like this in a vertex program:

someTexCoord = gl_MultiTexCoord0.xy * scale;

and then sample during the fragment stage

float result= texture2D(samplerName, someTexCoord).x;

so how does the lod look like? is it also scaled by scale?
can anyone xplain pls? ty.
 
The LOD calculation is based on the values passed as texcoords to texture2D(), so the LOD is indeed affected by scale. GPUs generally processes (multiple) blocks of 2x2 fragments (aka quads) in parallel and use the difference between the texture coordinates of those fragments to calculate the LOD for the quad.
 
thanx, thats what i suspected, but then that wouild mean that of the original texture was mipmapped with lod = 0.5 (texture is magnified) and the scale was say 64, then the scaled texture will always be minified.

i'm not so sure if thats what is intended when scaling the texture coordinates - to tell the truth i'm not sure what the significance of this scaling actually is - that would stretch the original texcoords at vertice points, say from 0..1 to 0..64
 
thanx, thats what i suspected, but then that wouild mean that of the original texture was mipmapped with lod = 0.5 (texture is magnified) and the scale was say 64, then the scaled texture will always be minified.

i'm not so sure if thats what is intended when scaling the texture coordinates - to tell the truth i'm not sure what the significance of this scaling actually is - that would stretch the original texcoords at vertice points, say from 0..1 to 0..64
Which means that the texture will be repeated 64 times between the vertices, assuming the S and T wrap modes are set to GL_REPEAT. This means each repetition of the texture is a lot smaller on screen, i.e. minified. It all makes perfect sense.
 
Back
Top