Jump to content

  • Log In with Google      Sign In   
  • Create Account

Martin Perry

Member Since 23 Feb 2012
Offline Last Active Nov 28 2015 08:03 AM

Posts I've Made

In Topic: Tangent space - Lengyel vs ShaderX5 - difference ?

11 October 2015 - 01:43 AM

Everything that has been said here is correct, but no one answered the subquestion "what is the difference (mathematically) of both methods if they are used for a single triangle".

In Topic: Tangent space - Lengyel vs ShaderX5 - difference ?

09 October 2015 - 07:58 AM

Well, I'm saying "different, unrelated" because they take completely different approaches. The first precisely calculates two vectors from a triangle, consuming three vertices of the mesh at a time in a preprocessing step (no, this couldn't be done on the GPU), and uses two vertex streams for the two vectors. It then has the hardware interpolate them (which is mathematically incorrect), renormalizes and does a cross product. Which looks OK, despite being incorrect.


The other has no preprocessing step (OK, I lied... you still need to have a normal, of course -- but this is a step that you do not see). Instead, it makes a per-pixel estimate based on partial derivatives (the dFdx and dFdy instructions in the code snippet). It does not need another vertex stream for the binormal (or any other data, in particular it does not need all three vertices of the triangle), and it achieves a quality that is just as good (acutally, better).


But If I look at the first approach and compare the values needed to compute tangent with ShaderX5 book, they calculate du1 = u1 - u0 (and other differences similar way), which is the same as the first approach does.


I understand why it is good to move calculations to the GPU to pixel shader (you can calculate it independently on geometry, plus today you can generate or tesselate geometry). What I dont understand from both articles is, why I cant use the first one in shader, because for a single triangle, if i wrote solution on the paper, they both use the same differences.

In Topic: Tangent space - Lengyel vs ShaderX5 - difference ?

09 October 2015 - 07:15 AM

Unrelated? They both calculate tangent (and bitangent, or at least I understand it that way). The first store data in vertex, yes, but the second can to. So the first can run on GPU, because the difference they used are the same in both techniques.

In Topic: WinAPI - Raw input and mouse acceleration

07 March 2015 - 01:29 AM

Ok.. thanks to all. I have done the combination of WM_INPUIT and WM_MOUSE* and its now OK.

In Topic: WinAPI - Raw input and mouse acceleration

06 March 2015 - 04:29 AM

The first one.. my RAW input is not affected by accelartion and I want to affect it. I have app, that combine GUI and OpenGL window. Turn off acceleration for my app is not a solution, since I want to leave it for GUI elements. I can check if mouse is in GL area or not, but that is my last solution. I would rather implement Window´s accelration on top of WM_INPUT by myself.