How do I set rotation of lensflare?

        var textureLoader = new THREE.TextureLoader();
        var textureFlare0 = textureLoader.load('model/sparkle5.png');

        var pointLight = new THREE.PointLight(0xffffff, 1.5, 1000);
        pointLight.position.set(0, 50, 15);

        var lensflare = new THREE.Lensflare();
        lensflare.addElement(new THREE.LensflareElement(textureFlare0, 700, 0, pointLight.color));
        var lensflareElement = new THREE.LensflareElement(textureFlare0, 200, 0)
        lensflare.rotation = Math.PI / 4;// It does not works,why?

why set rotation of lensflare does not works?
Original drawing:image
I want it:

There is no rotation for the Lensflare implementation. If you only want to rotate it do it with the image file itself and a image editing tool, if you want to animate it you could only modify it’s shader material to apply a rotation.

1 Like

For all images rotation, into “Lensflare.js” add code:

float angle=0.5;
vec3 vRotated=vec3(position.x*cos(angle)-position.y*sin(angle),position.y*cos(angle)+position.x*sin(angle),position.z);


1 Like

Hi,thank for your reply, I try and it works, but I still don’t know how to achieve this effect,the lensflare of the diamond looks so real! Can u give me some solutions?
And the website is:

Code obfuscated. Very hard to get right code

Deobfuscated, optimized: Diamond spark shader

1 Like

Wow, the effect looks very great! It must spend lot of time, thank you very much!