Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualalkisbkn

Posted 10 August 2012 - 05:30 AM

Hi and thanks!

It does make sense now. However, I don't think I am getting the correct results. How I calculate my wave, tangent, bitangent and normal:
[source lang="c++"]float2 dir = float2(1.0f, 0.0f);float dir_vertex = dot(dir, wave_vertex.xz); float wave1 = 25.0f * pow(sin( (2 * PI / 800) * dir_vertex - time * 2 * PI / 45.0f - 105.0f),2);float3 tan1 = float3(1.0, 2 * cos( (2 * PI / 800) * dir_vertex - time * 2 * PI / 45.0f - 105.0f), 0.0);float3 bitan1 = float3(0.0, 2 * cos( (2 * PI / 800) * dir_vertex - time * 2 * PI / 45.0f - 105.0f), 1.0);float3 normal1 = normalize(cross(bitan1, tan1));[/source]
Maybe my derivation is wrong. A power exponent goes in front of the base number when we derive, correct? Also the constant = 1, thus the amplitude is removed from the tan1 and bitan1 equations. I have attached a screenshot of the current output (for 2 perpendicular waves). To my understanding, when the wave is at full amplitude, the normal should be (0,1,0) (green colour), however it doesn't seem so in the screenshot.

Moreover, to get the final vertex normal, I do:
normal = normalize(normal1 + normal2);

#1alkisbkn

Posted 10 August 2012 - 05:29 AM

Hi and thanks!

It does make sense now. However, I don't think I am getting the correct results. How I calculate my wave, tangent, bitangent and normal:
[source lang="c++"]float2 dir = float2(1.0f, 0.0f);float dir_vertex = dot(dir, wave_vertex.xz); float wave1 = 25.0f * pow(sin( (2 * PI / 800) * dir_vertex - time * 2 * PI / 45.0f - 105.0f),2);float3 tan1 = float3(1.0, 2 * cos( (2 * PI / 800) * dir_vertex - time * 2 * PI / 45.0f - 105.0f), 0.0);float3 bitan1 = float3(0.0, 2 * cos( (2 * PI / 800) * dir_vertex - time * 2 * PI / 45.0f - 105.0f), 1.0);float3 normal1 = normalize(cross(bitan1, tan1));[/source]
Maybe my derivation is wrong. A power exponent goes in front of the base number when we derive, correct? Also the constant = 1, thus the amplitude is removed from the tan1 and bitan1 equations. I have attached a screenshot of the current output (for 2 perpendicular waves). To my understanding, when the wave is at full amplitude, the normal should be (0,1,0) (green colour), however it doesn't seem so in the screenshot.

Moreover, to get the final vertex normal, I do:
normal = normalize(normal1 + normal2);

PARTNERS