Skip to content

random rotation implementation #2

@xmyhhh

Description

@xmyhhh

thanks for sharing the code, it helped me a lot!

however i have a question in frag shader "IndirectLighting-frag.glsl"

//………… line 74
  //  fetch rotation angle
  //  map rsmTexCoord to noiseTexCoord : [0,0.5] -> [0,4] (repeatable texture)
  float rotationAngle = texture(kernelRotations, rsmTexCoord.xy * noiseResolution).r;
  rotationAngle *= 2.0 * M_PI;
//………… line 87 
  //  rotate the offset vector
  float sin_theta = sin(rotationAngle);
  float cos_theta = cos(rotationAngle);
  sampleOffset = mat2(cos_theta, sin_theta, -sin_theta, cos_theta) * sampleOffset;

the rotationAngle seems to be fixed for every sample step, that means zhe rotaion for each fragment out is fixed!
That doesn't seem right to me. (Of course, I'm a beginner in this algorithm, so if I'm wrong, please help me out!)

Sorry to bother you and thanks again for sharing!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions