On 16/05/2013 at 16:53, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 13
Platform: Windows ;
Language(s) : C++ ;
---------
Hi,
When I use the Noise() function in my shader plugin. It's crazy slow. Not only does it render very slow. But it's very, very slow everywhere else too.
For example: When I open the material. It's extremely slow to open. And the preview image takes a very long time to render that little preview image in the corner.
This extreme slowness does not happen when I create a material using the built-in shader options:
-Create a new material
-In the color channel's Texture option. Add a noise shader
-In the noises's Noise option. Select Cranal
Here's how I'm writing the code in my plugin:
Vector MyShader::Output(BaseShader *chn, ChannelData *cd)
{
Vector p = cd->p;
p *= 10;
LONG seed = 555;
C4DNoise *mynoise = C4DNoise::Alloc(seed);
Real n = mynoise->Noise(NOISE_CRANAL, FALSE, p, 0.0, 1.0, FALSE, 0.25, 0.25, 0);
C4DNoise::Free(mynoise);
return Vector(n);
}
What's making my Noise() function so super slow?
How do I make my own implementation of the Noise() function work as fast as the ones that are already built into the materials options?
-ScottA