Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Macryc |
Hi.
I’m working with 3d particle shaders. I have a shader that places particles using a heightmap image. I’m using this shader to create particle grass.
I also have a normal map to go with this heightmap and I was wondering if I can use that normal map to somehow get the individual particles to point in the direction of the terrain normal.
Is this possible in particle shaders? Presumably, TRANSFORM should be able to do this but I’ve been racking my brains on how to set this up and so far I’ve been unsuccessful.
Any tips highly appreciated.
it is possible, but it is a bit of a mathematic nightmare. You need to build transformation matrix to rotate chosen axis of your mesh towards the NORMAL. That requires to simulate other orthogonal axes of NORMAL using cross().
Good luck understanding this :
https://forum.godotengine.org/117809/construct-rotation-matrix-knowing-vector-align-matrix-vector
If I get back to my project whereI simplified it and understood it, I will be able to post proper answer
Inces | 2022-06-13 18:45