Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.
Posted 09 August 2012 - 08:15 PM
Posted 09 August 2012 - 08:32 PM
Posted 09 August 2012 - 08:43 PM
Posted 10 August 2012 - 05:29 AM
normal = normalize(normal1 + normal2);
Posted 10 August 2012 - 07:44 AM
Edited by haegarr, 10 August 2012 - 07:59 AM.
Posted 10 August 2012 - 09:45 AM
Edited by alkisbkn, 10 August 2012 - 09:46 AM.
Posted 10 August 2012 - 12:51 PM
Posted 10 August 2012 - 01:22 PM
float wave1 = 30.0f * sin(fs * dir_vertex + t);
float tan1y = cos(fs * dir.x * wave_vertex.x) float bitan1y = cos(fs * dir.y * wave_vertex.z);(is t in the derivative equation? I think not, as it's constant)
Edited by alkisbkn, 10 August 2012 - 01:45 PM.
Posted 10 August 2012 - 06:23 PM
float3 tan1 = float3(1.0, 30.0 * fs * cos(fs * waveVertex.x + t), 0.0); float3 bitan1 = float3(0.0, 30.0 * fs * cos(fs * waveVertex.x + t), 1.0);for tan and bitan. Then I do
normal = normalize(cross(bitan1, tan1));For 1 wave it seems to be correct, however how should I go about adding many wave's normals together? Just summing them and normalizing the result?
Posted 11 August 2012 - 06:16 AM
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.
Edited by alkisbkn, 11 August 2012 - 06:39 AM.
Posted 12 August 2012 - 03:50 AM
Edited by haegarr, 12 August 2012 - 03:52 AM.
Posted 12 August 2012 - 06:32 AM
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.
GameDev.net™, the GameDev.net logo, and GDNet™ are trademarks of GameDev.net, LLC.