So far I manage to find worldPosition, cameraVector, … And the TransformLocalVectorToWorld, TransformWorldVectorToLocal, and TransformLocalPositionToWorld.
I cant find Transform positio from world to local.
Is there a “easy” way to get the nodes code or some documentation to look?
In this case the Local uses the Primitive where the material is running to correctly do the transform.
When possible, try to leave some nodes outside the custom node (if you are using one) to do the transform and use a vector3 as input to the custom node.
About that, my main concern is that Im sure that the code wont allways work without the compiler magic under the nodes. But that makes writing shaders much more complicated and slow.
Why the need of GetPrimitiveData after 21? And what kind of primitiveData are available?
Every place you had before a Primitive.something need to be changed to that because the changes UE4.22 rendering module received, as for the reasons you can watch this video for the details:
For the amount of operations you can do for a primitive (if you are not used to make shaders in OpenGL or HLSL, check for google definitions for HLSL primitives) they are mapped by the HLSL cross-compiler to these page details: FPrimitiveUniformShaderParameters | Unreal Engine 5.2 Documentation
I have a similar issue. I’m using some content from the marketplace that is out of date, using “Primitive.LocalObjectBoundsMax.xyz” - how do I update that exactly? I’m not sure what the PrimativeID would be.
PrimitiveId is an internal value encoded by the engine during the shader compilation process, and you don’t need to worry about that.
You will just replace that whole text for: “GetPrimitiveData(Parameters.PrimitiveId).LocalObjectBoundsMax.xyz”.
That can be done easily with a search / replace set in any text editor, meaning for every “Primitive.” replace for “GetPrimitiveData(Parameters.PrimitiveId).” and your legacy code will work as soon you paste the contents inside the Custom node.
Vertex locations can be accessed via Absolute World Position. If you use it in the vertex shader it’ll function as vertex position, in the pixel shader as pixel position. You can use a vertex interpolator to use vertex position in the pixel shader if you need to.
[USER=“3140864”]MostHost LA[/USER] I think it can be done as @TheJamsh mentioned above. I never used custom nodes for vertex operations myself and ideally to try things out, you need to plug as much regular material nodes into the custom node and see which is the data you can get out of them via debug value nodes. I have ported several stuff made in Unity and ShaderToy just for fun using custom nodes, it is something I do to expand my mind when working with Unreal projects. While doing that I realize the simple way to get the node Time functionality is just feed it to a custom node’s input pin and the same practice is advisable for other nodes, main reason is to avoid as much as possible to use inside the custom node any MaterialExpressionXXXX, which when the node suffers changes it might break compatibility in later engine releases.
Makes perfect sense.
Absolute world position (WPO) doesn’t seem to “stick” to the original vertex factory information. I think that’s my problem. Tessellation vertices are included in the offset results, making what I want not possible with just the node.
I’ll try plugging it to custtm and playing around with it though. Thanks to both.