Postprocessing: GodRay not using worldposition when updating

Created on 22 Apr 2019  路  3Comments  路  Source: vanruesc/postprocessing

Hi! Really cool library!

I noticed something when I started animating my "sun" to revolve around the center of the scene.
The mesh moved but the effect stayed where it is.

Turns out it's because of my "shortcut" of rotating the sun object. I have a THREE.Group at the center (0, 0, 0) and the sun is a children of that at (10, 0, 0). And I'm just rotating the parent group to move the sun.

But the god-ray effect always reads that (10, 0, 0) (The relative position) instead of the world position.

Right now I solved this by switching my sun object to a pseudoSun (just another group), and copy the world-coordinates of that into my real sun's position when updating.

Is there a reason for the effect to use the position directly instead of WorldCoordinates?

bug

All 3 comments

Hi,

thanks for the issue report!

Is there a reason for the effect to use the position directly instead of WorldCoordinates?

No, there is no reason. The GodRaysEffect was originally inspired by the god rays example from three.js which didn't account for this either. Until now there hasn't been a use case that reveiled this issue.

A fix is on the way.

Should be fixed in [email protected]. Didn't test this thoroughly so let me know if you find a bug!

Thanks! I just noticed that the package got updated. And, yes it works as it should. Thanks for the quick fix!

Was this page helpful?
0 / 5 - 0 ratings