KhronosGroup / Vulkan-Docs

The Vulkan API Specification and related tools
Other
2.75k stars 462 forks source link

[Specification] Elliptical footprint approximation #581

Open Retrofractal opened 6 years ago

Retrofractal commented 6 years ago

From the Vulkan (1.0.62) specification (15.6.7 Scale Factor Operation, Level-of-Detail Operation and Image Level(s) Selection):

The scale factors ρx and ρy, calculated from the magnitude of the derivatives in x and y, are used to compute the minimum and maximum scale factors.

This isn't correct; you cannot determine the maximum and minimum scale factors with just these scale factors.

ρx and ρy may be approximated with functions fx and fy

This should probably read

ρmin and ρmax may be approximated with functions fx and fy

with the following subsequent alteration:

The minimum and maximum scale factors (ρmin,ρmax) are given, under this approximation, by ρmax = max(fx, fy) ρmin = min(fx, fy)

jbreton-nv commented 6 years ago

When you read the spec, did you assume that the scale factors ρx and ρy were the magnitude of the derivatives in x and y? I didn't make this assumption, so that's why I thought your proposal was not a significant change to the current spec.

I think ρx and ρy should be seen as an approximation of the major and minor axes of the ellipse that cover the region you are sampling. You do a Max() to get the major axis and a Min() for the minor

The equations to compute those 2 axes could be quite complex, and I'm sure everyone as its own technic, but in the end, I expect implementations to use derivatives in x and y to compute those 2 values.

Retrofractal commented 6 years ago

When you read the spec, did you assume that the scale factors ρx and ρy were the magnitude of the derivatives in x and y?

Since the spec is using ρmin and ρmax to designate the scale factors of the minor and major axes respectively, it is reasonable to expect ρx and ρy to designate the scale factors of the screen-space horizontal and vertical axes, which is clear by reference to the openGL spec in which it is those values to which the approximations fx and fy specifically refer. More to the point, one shouldn't have to assume what they are in the first place!

I think ρx and ρy should be seen as an approximation of the major and minor axes of the ellipse that cover the region you are sampling.

Sure, you can use ρx and ρy as an approximation, but then the spec allows these values to be approximated with fx and fy. The key difference with openGL is the appearance the root two on the right hand side of the inequalities, which appears to recognise a relationship between the true minimum and maximum scale factors and the screen-space axis approximation. Overall, it seems a little obfuscatory.

Retrofractal commented 6 years ago

To put it another way, I could define fx and fy to be the true minimum and maximum scale factors, but by the warped logic of the spec, that would be considered an approximation of the scale factors of ρx and ρy, rather than the other way around. Furthermore, fx and fy would both need to depend on all derivatives, not just x or y, as implied by the spec.

Retrofractal commented 6 years ago

On the other hand, if I accept your interpretation that ρx and ρy are defined such that ρmax = max(ρx, ρy) and ρmin = min(ρx, ρy), then why should we use the labels ρx and ρy at all? Both ρx and ρy depend on all derivatives in x and y, not just (derivatives in) x for ρx and y for ρy. It seems misleading at worst and redundant at best.

jbreton-nv commented 6 years ago

You're right. I agree. I think we should clarify the spec and follow what you propose.

Retrofractal commented 6 years ago

Great! I would just like to add that it should be made clear that ρmin and ρmax depend on the derivatives in x and y, but that fx should depend on at least the derivatives in x and fy on at least the derivatives in y

Retrofractal commented 3 years ago

Would it be possible to get this resolved please?