• Create Account

### #Actualalkisbkn

Posted 10 August 2012 - 09:46 AM

Hi haegarr,

I am now testing using 1 wave only and by implementing the equation you mentioned before. The problem is that the normal seems to always be (0,1,0) using this implementation:
[source lang="cpp"]float2 dir = float2(1.0, 0.0);float dir_vertex = dot(dir, wave_vertex.xz); float fs = 2 * PI / 800.0f;float t = time * 2 * PI / 45.0f; float wave1 = 30.0f * pow(sin(fs * dir_vertex + t), 2); float fx = dir.x * fs;float fz = dir.y * fs; float3 tan1 = float3(1.0, 2 * sin(fx * wave_vertex.x + fz * wave_vertex.z + t) * cos (fx * wave_vertex.x + fz * wave_vertex.z + t) * fx, 0.0); float3 bitan1 = float3(0.0, 2 * sin(fx * wave_vertex.x + fz * wave_vertex.z + t) * cos (fx * wave_vertex.x + fz * wave_vertex.z + t) * fz, 1.0); float3 normal1 = normalize(cross(bitan1, tan1));[/source]
resulting in a green fragment color.

### #3alkisbkn

Posted 10 August 2012 - 09:46 AM

Hi haegarr,

I am now testing using 1 wave only and by implementing the equation you mentioned before. The problem is that the normal seems to always be (0,1,0) using this implementation:
[source lang="cpp"]float2 dir = float2(1.0, 0.0);float dir_vertex = dot(dir, wave_vertex.xz); float fs = 2 * PI / 800.0f;float t = time * 2 * PI / 45.0f; float wave1 = 30.0f * pow(sin(fs * dir_vertex + t), 2); float fx = dir.x * fs;float fz = dir.y * fs; float3 tan1 = float3(1.0, 2 * sin(fx * wave_vertex.x + fz * wave_vertex.z + t) * cos (fx * wave_vertex.x + fz * wave_vertex.z + t) * fx, 0.0); float3 bitan1 = float3(0.0, 2 * sin(fx * wave_vertex.x + fz * wave_vertex.z + t) * cos (fx * wave_vertex.x + fz * wave_vertex.z + t) * fz, 1.0); float3 normal1 = normalize(cross(bitan1, tan1));[/source]
resulting in a green fragment color.

### #2alkisbkn

Posted 10 August 2012 - 09:45 AM

Hi haegarr,

I am now testing using 1 wave only and by implementing the equation you mentioned before. The problem is that the normal seems to always be (0,1,0) using this implementation:
[source lang="cpp"]float2 dir = float2(1.0, 0.0);float dir_vertex = dot(dir, wave_vertex.xz); float fs = 2 * PI / 800.0f;float t = time * 2 * PI / 45.0f; float wave1 = 30.0f * pow(sin(fs * dir_vertex + t), 2); float fx = dir.x * fs;float fz = dir.y * fs; float3 tan1 = float3(1.0, 2 * sin(fx * wave_vertex.x + fz * wave_vertex.z + t) * cos (fx * wave_vertex.x + fz * wave_vertex.z + t) * fx, 0.0); float3 bitan1 = float3(0.0, 2 * sin(fx * wave_vertex.x + fz * wave_vertex.z + t) * cos (fx * wave_vertex.x + fz * wave_vertex.z + t) * fz, 1.0); float3 normal1 = normalize(cross(bitan1, tan1));[/source]
resulting in a green fragment color.

### #1alkisbkn

Posted 10 August 2012 - 09:45 AM

Hi haegarr,

I am now testing using 1 wave only and by implementing the equation you mentioned before. The problem is that the normal seems to always be (0,1,0) using this implementation:
[source lang="cpp"]float2 dir = float2(1.0, 0.0);float dir_vertex = dot(dir, wave_vertex.xz); float fs = 2 * PI / 800.0f;float t = time * 2 * PI / 45.0f; float wave1 = 30.0f * pow(sin(fs * dir_vertex + t), 2); float fx = dir.x * fs;float fz = dir.y * fs; float3 tan1 = float3(1.0, 2 * sin(fx * wave_vertex.x + fz * wave_vertex.z + t) * cos (fx * wave_vertex.x + fz * wave_vertex.z + t) * fx, 0.0); float3 bitan1 = float3(0.0, 2 * sin(fx * wave_vertex.x + fz * wave_vertex.z + t) * cos (fx * wave_vertex.x + fz * wave_vertex.z + t) * fz, 1.0); float3 normal1 = normalize(cross(bitan1, tan1));[/source]
resulting in a green fragment color.

PARTNERS