現在、レイヤー化されたオクターブのノイズを使用してOpenCLで地形生成を実装していますが、この問題に遭遇しました:
float multinoise2d(float2 position, float scale, int octaves, float persistence)
{
float result = 0.0f;
float sample = 0.0f;
float coefficient = 1.0f;
for(int i = 0; i < octaves; i++){
// get a sample of a simple signed perlin noise
sample = sgnoise2d(position/scale);
if(i > 0){
// Here is the problem:
// Implementation A, this works correctly.
coefficient = pown(persistence, i);
// Implementation B, using this only the first
// noise octave is visible in the terrain.
coefficient = persistence;
persistence = persistence*persistence;
}
result += coefficient * sample;
scale /= 2.0f;
}
return result;
}
OpenCL は for ループを並列化し、ここで同期の問題を引き起こしますか、それとも他に何か不足していますか?
どんな助けでも大歓迎です!