Noticed what I'd consider a bug in filmgrain2.fx

  • Daemonjax
  • Topic Author
More
1 year 1 month ago #1 by Daemonjax Noticed what I'd consider a bug in filmgrain2.fx was created by Daemonjax
Not sure where to put this so putting it here.  Should modulate the timer, otherwise it looks bad.

Original code:
...
uniform float timer < source = "timer"; >;
...
    float2 rotCoordsR = coordRot(texCoord, timer + rotOffset.x);
    float3 noise = pnoise3D(float3(rotCoordsR * BUFFER_SCREEN_SIZE / grainsize, 0.0)).xxx;

    if (coloramount > 0)
    {
        float2 rotCoordsG = coordRot(texCoord, timer + rotOffset.y);
        float2 rotCoordsB = coordRot(texCoord, timer + rotOffset.z);
        ....

Needs to be something like:
...
uniform float timer < source = "timer"; >;
...
    float modulatedTimer = timer % 997.0f //doesn't really need to be a prime number, but I like primes
    float2 rotCoordsR = coordRot(texCoord, modulatedTimer + rotOffset.x); //use modulatedTimer instead of timer directly
    float3 noise = pnoise3D(float3(rotCoordsR * BUFFER_SCREEN_SIZE / grainsize, 0.0)).xxx;

    if (coloramount > 0)
    {
        float2 rotCoordsG = coordRot(texCoord, modulatedTimer + rotOffset.y); //use modulatedTimer instead of timer directly
        float2 rotCoordsB = coordRot(texCoord, modulatedTimer + rotOffset.z); //use modulatedTimer instead of timer directly
        ....

Hoping the indents work out in the code sections...
 

Please Log in or Create an account to join the conversation.