WPO Lookat

Hi,
I’m looking into a way to make a lookat in material with normal recalculation ideally.
Would like to feed in the lookat vector, pivot point and maybe the mesh forward.

Anyone have done something like this?

Thanks!

1 Like

Hi, Check Rotate vector node and what is inside it. Fix rotate about axis normals node can give you a hint how to recalculate normals.

Thanks for the pointer, so now I have this which “works”, but the mesh gets kinda squished depending on the look at vector. Goes as far as being completely flat if I have a negative value in the lookat. Any clue more clue?

Solved it in a different way, but it works.



ho is there a way to do the blueprint part in the material instead?
I am going to have thousands of instances using this as HISM, or folliage.
The target position will be passed as a material parameter collection.

Thanks! :slight_smile:

Idk, if unreal pass rotation or quat to shader , than you can potentially retrieve this data in material with custom node.
You can pass rotation as ISM custom data floats. You can pack rotation as Quaternion (only 4 floats, instead of 3 vectors/9 floats) and unpack it shader.

I found a way to convert the FindLookAtRotation in HLSL and have a 100% shader based look at (except feeding the look at position)

LookAt Code:

X = normalize(end-start);
float3 upvector = X.z < 0.9999 ? float3(0,0,1) : float3(1,0,0);
Y = normalize(cross(upvector, X));
Z = cross(X, Y);

return 0;

This way you could have a material parameter collection for the target position and update hundreds of instances at almost no tick cost.

3 Likes

I love this place, thanks for sharing.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.