Using imposters in Landscape Grass output hindered by object position returning wrong value


I’m trying to use the imposter UVs material function to use imposter sprites as landscape grass. however, because it uses object position for the ‘rotation’ (UV choice) of the input texture, the wrong value is received because object position used on landscape instances returns a value for the individual lanscape component, not the grass instance as needed.

Is this a bug or expected behaviour?

this pictures attached shows where the lanscape components line up and the colour is the object position put into the colour as a debug helper.


Would be great if there was an ‘instance position’ node. AbsolutePosition doesn’t work as it needs the centre of the sprite and it messes up the rotations if I use that.


Okay so I figured out the fix for this.

I did some searching on answerhub and discovered that the pixel shader can’t return object position for instances BUT the vertex shader can. So i’ve piped object position into customized uvs and read them back in into the imposterUV material function. The next hurdle was that inside that material function, there is the use of absoluteworld position to compute the world position offset of the imposter sprite. the hack fix for that was to export out my own sprite mesh (actually might even work on the one in the content example but I wanted a mesh that was even lighter poly wise) and use the texcoord node as fake ‘vertex’ positions and transformVector them to get the world position of the vertices for the pixel shader.

I had to do careful lining up of the values so that the vertex positions that are set after build scaling in the static mesh editor line up with what I’m doing in the material function to recreate those vertex positions.

All work nice now and I get some cool imposter grass. I’ll post a video later on.

The goal now is to experiment with pixel depth offset with some rendered depth maps ( like the trees do in kite demo) as I’m rendering from maya. It also made me wonder about the fact it would be nice to have a ‘local vertex position’ node and also that the customized UVs and texCoord nodes only deal with float2s. I’d love for the texCoords to be able to pass float3s around.