在 vtkGPUVolumeRayCastMapper_HeaderFS.glsl中

vec4 noiseValue=texture2D(noiseTexture,pos.xy*100.0); // with repeat/tiling mode on the noise texture.

pos+=(noiseValue.x)*rayDir;

 

用途:

// 2D noise texture to jitter the starting point of the ray in order to
// remove patterns when the opacity transfer function make the data on the
// border of the dataset to be visible.

 

这里的噪声纹理用PerlinNoise

this->NoiseTexture=new float[size*size];
this->NoiseTextureSize=size;
vtkPerlinNoise *noiseGenerator=vtkPerlinNoise::New();
noiseGenerator->SetFrequency(size,1.0,1.0);
noiseGenerator->SetPhase(0.0,0.0,0.0);
noiseGenerator->SetAmplitude(amplitude);

posted on 2013-01-21 17:01  30斤大番薯  阅读(572)  评论(0编辑  收藏  举报