Hey all,
Okay! So this may be a little confusing but I need to understand how to "code" something in UDK.
I need to have my grass alphas always face the player as he is walking around them. So, in L4D2 when you are walking around grass cards they always face you so you don't see the weird disappearing faces or the side of the alpha. I was thinking about trying to do something in the material editor because there is an 'object orientation node' but I do not know enough about it all.
If this makes sense and you can help me I would be very grateful.
Also, if anyone has any questions about this question ( if that makes sense
) let me know and I can elaborate about this more.
Screenshots will help also!
Thanks guys ( and gals )!
Replies
I really need help with this problem and I am nowhere near smart enough to figure it out on my own :]
Maybe you can try to play with particles.
http://udn.epicgames.com/Three/WorldPositionOffset.html
You need to make a material that rotates the vertexes of the model to face the player. It's a bit complicated for me to easily make an example so hopefully this will give you an idea and you'll come up with something yourself.
well here's something else that might help:
http://udn.epicgames.com/Three/MaterialsCompendium.html#RotateAboutAxis
Got everything plugged into the correct spots, but the object will still not face the character as I walk around it.
I'll try to get this working asap.
sorry this is playing up at work, already wrote a response that got lost.
Basically
you can do this three ways. In decreasing complexity.
1) i think you'd need to transform the matrix for the vertex shader to get it to stick to screen. you cant do transforms through the built in nodes in to vertex shader (at least i dont think) so you will need to try and do that in custom node.
I've done something similar to a vertex shader approach with this, by comparing the angle between object position and camera position, and rotating the asset accordingly. not ideal! and not really what you want, as it's not on a per plane basis.
2) You could make a cheap particle system to do this for you? Particles also have a feature to orient a mesh towards a camera, not just a sprite. Don't think particles are instanced in UDK though.
3) and finally... doesnt speedtree already have a feature for something like this? in the past i've definitely seen speedtree assets with billboards that face to camera.
i think speedtree is the number 1 route to go, if it does indeed do this.
Drawbacks:
- Does not take objects current rotation into account, meaning any custom Z rotation would break the billboard and become out of sync with the camera.
- Only rotates around the objects Z axis.
- Don't know how efficient this method is.
Billboard material link:
http://www.3dality.co.uk/UDK_Z-Axis_BillboardMaterial.jpg
The rotation is not about the object z axis -- the video I posted on youtube
shows this: [ame]http://www.youtube.com/watch?v=1kmLPZhtszQ[/ame]
Also, it appears to work in the editor but on build and PIE the
assets stay exactly where they were placed in the scene and nothing
happens and the surface is black (I used first BSP cards then interpactor cards to try it out).
I'm really in need on standard billboards.
Sprites?
I been playing with A.RABBITS code all day.
Looks like something is missing here, but what ?
Would love to know how to rotate around the other 2 axis.
(yeah ,1 more axis is enough but knowing the other 2 would be great)
I read someone mentioning you can set your mesh to the lowest LOD setting?
Cheers.
A rabbits system works for me as is , just a billboard that rotates left and right if u pan the cam left and right.
- The effect is broken when the material is applied to a mesh used in foliage mode. The same mesh/material works perfectly as a billboard as a static mesh, but rotates through the air (rather that simply angling its face towards the camera) when used in foliage mode. I'm guessing this has something to do with the world position somehow being reported as the origin of the landscape, instead of the actual correct location of the mesh... Maybe someone with more material editor know-how can tweak it to work in foliage mode?
- The material doesn't work if applied as a material to a LOD mesh. This is disappointing, as it would have the most potential in this situation (at a certain distance from the camera, swap in a billboard material plane in place of the higher poly geo)
Wonder if anyone else can figure out how to tweak this for perfection?
For now, it seems the best bet for my scene is to use foliage mode (Rather than hand place an entire field made of 5 different grasses...), which rules out the billboard material for now
Nevermind the material was traluscent switched to masked work fine now
http://udn.epicgames.com/Three/rsrc/Three/DirectX11Rendering/MartinM_GDC11_DX11_presentation.pdf
It is UV dependent -- make sure the card's UVs fill the whole 0-1 space. Again, this was a long time ago so who knows if it still works.