PCG and Object/Actor Position WS

Sorry if this has been asked or answered already. I did a quick search and didn’t see any mention of this specific issue. I noticed when trying to build a shader that used a function that called ObjectPositionWS to use as a way to generate random values that when applied to the actors that were being distributed by my PCG network that they all seemed to be getting the same value. More over the value changed when I moved the volume. That leads me to believe that the network is passing down it’s WSposition to the actors in a way that both the ObjectPositionWS and the ActorPositionWS nodes in the material editor are reading instead of the positions of the points the actors are being spawned on. Is this a known issue? Is there a way to get the WS position of the PCG points within the material editor?

I did a quick test with a debug shader made to output a frac’ed X value as the emissive color on a plane that I spawned in a super basic PCG to test my theory that they were all getting the same value, at least from the shader’s perspective and it appears to be the case. All the planes show the same value which only changes if I move the volume itself along the X axis.



Hi JamesFBall,

Try adding a “VertexInterpolator” node inbetween your code with the ObjectPositionWS and the rest - being instances you’ll want the vertex shader value rather than the pixel shader.

1 Like

That did it! Thanks a ton!

1 Like

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