Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualalkisbkn

Posted 11 August 2012 - 06:39 AM

Thanks everyone, I think it is working correctly now. Below I am showing how I am doing it:
float height = 50.0 * sin(fs * waveVertex.x + t * _Time.y) +
		  125.0 * sin(fs * waveVertex.z + t * _Time.y + PI/4.0) +
		  135.0 * sin(-fs * waveVertex.x/4.0 - t * _Time.y * 0.75 + PI/2.0) +
		  165.0 * sin(-fs * waveVertex.z/8.0 - t * _Time.y * 0.5 + PI);
height *= 0.25;

float derivative = 150.0 * fs * cos(fs * waveVertex.x + t * _Time.y) +
		 125.0 * fs * cos(fs * waveVertex.z + t * _Time.y + PI/4.0) +
		 135.0 * -fs * cos(-fs * waveVertex.x/4.0 + t * _Time.y * 0.75 + PI/2.0) +
		 165.0 * -fs * cos(-fs * waveVertex.z/8.0 + t * _Time.y * 0.5 + PI);


float3 tan1 = float3(1.0, derivative, 0.0);
float3 bitan1 = float3(0.0, derivative, 1.0);

normal = normalize(cross(bitan1, tan1));
And this gives me the result as you see in the screenshot.

#3alkisbkn

Posted 11 August 2012 - 06:36 AM

Thanks everyone, I think it is working correctly now. Below I am showing how I am doing it:
float height = 50.0 * sin(fs * waveVertex.x + t * _Time.y) +
		  125.0 * sin(fs * waveVertex.z + t * _Time.y + PI/4.0);
		  135.0 * sin(-fs * waveVertex.x/4.0 - t * _Time.y * 0.75 + PI/2.0) +
		  165.0 * sin(-fs * waveVertex.z/8.0 - t * _Time.y * 0.5 + PI);
height *= 0.25;

float derivative = 150.0 * fs * cos(fs * waveVertex.x + t * _Time.y) +
		 125.0 * fs * cos(fs * waveVertex.z + t * _Time.y + PI/4.0) +
		 135.0 * -fs * cos(-fs * waveVertex.x/4.0 + t * _Time.y * 0.75 + PI/2.0) +
		 165.0 * -fs * cos(-fs * waveVertex.z/8.0 + t * _Time.y * 0.5 + PI);


float3 tan1 = float3(1.0, derivative, 0.0);
float3 bitan1 = float3(0.0, derivative, 1.0);

normal = normalize(cross(bitan1, tan1));
And this gives me the result as you see in the screenshot.

#2alkisbkn

Posted 11 August 2012 - 06:16 AM

Thanks everyone, I think it is working correctly now. Below I am showing how I am doing it:
float height = 50.0 * sin(fs * waveVertex.x + t * _Time.y) +
		  125.0 * sin(fs * waveVertex.z + t * _Time.y + PI/4.0);
		  135.0 * sin(-fs * waveVertex.x/4.0 - t * _Time.y * 0.75 + PI/2.0) +
		  165.0 * sin(-fs * waveVertex.z/8.0 - t * _Time.y * 0.5 + PI);
height *= 0.25;

float derivative = 150.0 * fs * cos(fs * waveVertex.x + t * _Time.y) +
		 125.0 * fs * cos(fs * waveVertex.z + t * _Time.y + PI/4.0) +
		 135.0 * fs * cos(fs * waveVertex.x + t * _Time.y * 0.75 + PI/2.0) +
		 165.0 * fs * cos(fs * waveVertex.z/4.0 + t * _Time.y * 0.5 + PI);


float3 tan1 = float3(1.0, derivative, 0.0);
float3 bitan1 = float3(0.0, derivative, 1.0);

normal = normalize(cross(bitan1, tan1));
And this gives me the result as you see in the screenshot.

#1alkisbkn

Posted 11 August 2012 - 06:16 AM

Thanks everyone, I think it is working correctly now. Below I am showing how I am doing it:
float height = 50.0 * sin(fs * waveVertex.x + t * _Time.y) +
		  125.0 * sin(fs * waveVertex.z + t * _Time.y + PI/4.0);
		  135.0 * sin(-fs * waveVertex.x/4.0 - t * _Time.y * 0.75 + PI/2.0) +
		  165.0 * sin(-fs * waveVertex.z/8.0 - t * _Time.y * 0.5 + PI);
height *= 0.25;

float derivative = 150.0 * fs * cos(fs * waveVertex.x + t * _Time.y) +
		 125.0 * fs * cos(fs * waveVertex.z + t * _Time.y + PI/4.0) +
		 135.0 * fs * cos(fs * waveVertex.x + t * _Time.y * 0.75 + PI/2.0) +
		 165.0 * fs * cos(fs * waveVertex.z/4.0 + t * _Time.y * 0.5 + PI);


float3 tan1 = float3(1.0, derivative, 0.0);
float3 bitan1 = float3(0.0, derivative, 1.0);

normal = normalize(cross(bitan1, tan1));
And this gives me the result as you see in the screenshot.

PARTNERS