SkyMaterial up vector

Hello everyone,

I was wondering whether it would be possible to add an option to specify the up vector to be used in the SkyMaterial.
I saw a discussion about this topic here but I’m not too happy with how it ended :slight_smile:

I did it myself as a proof of concept


but I would really like if it was resolved officially.

sort-of off topic:
In the commit I linked, there are 4 lines of code used to find a rotation between two unit vectors.
Would it possible to add a method like this on a babylon Quaternion?
For example three.js has it, and I often find it quite useful.

Welcome to the forums!

Pinging @julien-moreau

1 Like

Pinging this topic.

I temporarily bypassed this issue without having to create my own copy of the whole material by overriding only the fragment shader and changing the “up” constant (this is good enough as we’re using the sun position).

But I would like to know whether I can hope for this feature to be added, so I can remove this “hack”.

Hey @MichalZr I’m so sorry I missed the post! =O
Im having a look ASAP but on my first pass It looks interesting, I think you can already create a pull request to include it directly :slight_smile:

@julien-moreau awesome.
I created the PR:

I smuggled in the method for computing a quaternion from two unit vectors as well.

1 Like

Perfect! I started a review as well as @Deltakosh :slight_smile:

2 Likes