Author : winged doom


Reply
Reply
 
Thread Tools Display Modes
Andrew Mackie's Avatar
Old (#1)
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 :p ) let me know and I can elaborate about this more.
Screenshots will help also!
Thanks guys ( and gals )!
Offline , triangle, 439 Posts, Join Date Jun 2010, Location Willing to relocate anywhere Send a message via Skype™ to Andrew Mackie  
   Reply With Quote

Andrew Mackie's Avatar
Old (#2)
I'm just typing here to see if anyone will notice this thread again.
I really need help with this problem and I am nowhere near smart enough to figure it out on my own :]

<3
Offline , triangle, 439 Posts, Join Date Jun 2010, Location Willing to relocate anywhere Send a message via Skype™ to Andrew Mackie  
   Reply With Quote

ParoXum's Avatar
Old (#3)
Well I guess the exact name of what you're seeking is sprites, I don't think you can make sprite based foliage in the UDK with the regular toolset tho.

Maybe you can try to play with particles.


Vincent Mayeur - Environment Artist
Offline , polycounter, 867 Posts, Join Date Feb 2009, Location Belgium  
   Reply With Quote

Andrew Mackie's Avatar
Old (#4)
Thanks ParoXum! - I'll give particles a look through and see if I can figure them out in regards to this problem.
Offline , triangle, 439 Posts, Join Date Jun 2010, Location Willing to relocate anywhere Send a message via Skype™ to Andrew Mackie  
   Reply With Quote

sprunghunt's Avatar
Old (#5)
you can make a shader that makes a fake sprite by using world position offset.

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.
---------------------------------------
sci-fi base
Robot Hunters Room
CER level
Offline , polycounter, 1,285 Posts, Join Date Apr 2005, Location Massachusetts  
   Reply With Quote

Andrew Mackie's Avatar
Old (#6)
hey sprunghunt - thanks for the link. My problem is that I don't know how to make a material rotate towards the position of the player but hopefully I'll be able to work with this and figure it out. Thanks for the comments guys!
Offline , triangle, 439 Posts, Join Date Jun 2010, Location Willing to relocate anywhere Send a message via Skype™ to Andrew Mackie  
   Reply With Quote

sprunghunt's Avatar
Old (#7)
Quote:
Originally Posted by Andrew Mackie View Post
hey sprunghunt - thanks for the link. My problem is that I don't know how to make a material rotate towards the position of the player but hopefully I'll be able to work with this and figure it out. Thanks for the comments guys!
well here's something else that might help:

http://udn.epicgames.com/Three/Mater...otateAboutAxis
---------------------------------------
sci-fi base
Robot Hunters Room
CER level
Offline , polycounter, 1,285 Posts, Join Date Apr 2005, Location Massachusetts  
   Reply With Quote

Andrew Mackie's Avatar
Old (#8)
I plugged in all the info as it describes with the object/material is not always facing the player as I move throughout the scene. I'll keep playing with this and see if I can post some screenshots or a video better explaining my problems haha. Thanks for all the help sprunghunt!
Offline , triangle, 439 Posts, Join Date Jun 2010, Location Willing to relocate anywhere Send a message via Skype™ to Andrew Mackie  
   Reply With Quote

Andrew Mackie's Avatar
Old (#9)
Still have not found out the proper way to do this yet.
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.
Offline , triangle, 439 Posts, Join Date Jun 2010, Location Willing to relocate anywhere Send a message via Skype™ to Andrew Mackie  
   Reply With Quote

ImSlightlyBored's Avatar
Old (#10)
test postx
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.

Last edited by ImSlightlyBored; 02-09-2011 at 06:17 AM..
VFX Artist
2011 Reel
Offline , polygon, 679 Posts, Join Date Aug 2007, Location London, UK  
   Reply With Quote

Andrew Mackie's Avatar
Old (#11)
Hey ImSlightlyBored! - Thanks man this is exactly what I need. I'm going to try the particle system first then I'll look into Speedtree and see if there is something I can do with that. Thanks again and I'll try to post my results soon.
Offline , triangle, 439 Posts, Join Date Jun 2010, Location Willing to relocate anywhere Send a message via Skype™ to Andrew Mackie  
   Reply With Quote

ImSlightlyBored's Avatar
Old (#12)
id be careful using particles, as i'd like to reiterate that i dont think epic's udk builds have instanced particles so this could get heavy (love to be proved wrong though!)
i think speedtree is the number 1 route to go, if it does indeed do this.
VFX Artist
2011 Reel
Offline , polygon, 679 Posts, Join Date Aug 2007, Location London, UK  
   Reply With Quote

A. Rabbit's Avatar
Old (#13)
Thought I would post this, will probably help a few people wanting to make a billboard effect with static meshes.

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_...rdMaterial.jpg
Offline , null, 9 Posts, Join Date Aug 2010,  
   Reply With Quote

Andrew Mackie's Avatar
Old (#14)
Hey A. Rabbit! Thanks for the link! I'll look into trying that out and let you know if it's what I needed.
Offline , triangle, 439 Posts, Join Date Jun 2010, Location Willing to relocate anywhere Send a message via Skype™ to Andrew Mackie  
   Reply With Quote

tomacmuni's Avatar
Old (#15)
For the A. Rabbit expression, it works but probably not as intended.
The rotation is not about the object z axis -- the video I posted on youtube
shows this: 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).
Offline , null, 1 Posts, Join Date Jun 2011,  
   Reply With Quote

Andrew Mackie's Avatar
Old (#16)
Hey tomacmuni! This is awesome, I'm going to try to figure this problem out again (it's been a while since I last tried). Thanks for the great help, I'll post my results soon!
Offline , triangle, 439 Posts, Join Date Jun 2010, Location Willing to relocate anywhere Send a message via Skype™ to Andrew Mackie  
   Reply With Quote

tuxmask75's Avatar
Old (#17)
Was anyone able to make billboards that always face the camera even while looking down from above? ( not just on the Z axis)
I'm really in need on standard billboards.
Offline , line, 79 Posts, Join Date Jan 2011, Location Florida, USA  
   Reply With Quote

ambershee's Avatar
Old (#18)
Quote:
Originally Posted by tuxmask75 View Post
Was anyone able to make billboards that always face the camera even while looking down from above? ( not just on the Z axis)
I'm really in need on standard billboards.
Sprites?
+++MESSAGE ENDS+++
Offline , dedicated polycounter, 1,539 Posts, Join Date Nov 2005, Location Newcastle, UK  
   Reply With Quote

tuxmask75's Avatar
Old (#19)
Yeah for 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)
Code:
 
float4 output;
float3 CameraToObjVector;
//Get Camera to Object Vector
CameraToObjVector = normalize(CameraWorldPos - ObjectWorldPositionAndRadius);
//Set RGB of output to the objects Z-Axis
output.r = ObjectOrientation.r;
output.b = ObjectOrientation.b;
output.g = ObjectOrientation.g;
 
//Transform Vector into Radians.
output.a = atan2(CameraToObjVector.y,CameraToObjVector.x);
return (output);

Last edited by tuxmask75; 08-25-2011 at 07:04 AM..
Offline , line, 79 Posts, Join Date Jan 2011, Location Florida, USA  
   Reply With Quote

b1skit's Avatar
Old (#20)
Any updates on this guys? I'm also looking for a billboard system for grass, so that the planes always face the player/camera.

I read someone mentioning you can set your mesh to the lowest LOD setting?
Visit my website at www.adambadke.com
Offline , line, 80 Posts, Join Date Jan 2010, Location Vancouver, BC  
   Reply With Quote

b1skit's Avatar
Old (#21)
Nope, that doesn't work... Does the A.RABBITS code work as described, or is it as broken as it looks in tomacmuni's video?

Cheers.
Visit my website at www.adambadke.com
Offline , line, 80 Posts, Join Date Jan 2010, Location Vancouver, BC  
   Reply With Quote

tuxmask75's Avatar
Old (#22)
yeah I'm still looking for this too,,, model always facing the camera, for true in your face billboards...

A rabbits system works for me as is , just a billboard that rotates left and right if u pan the cam left and right.
Offline , line, 79 Posts, Join Date Jan 2011, Location Florida, USA  
   Reply With Quote

b1skit's Avatar
Old (#23)
Seems A.RABBITS code works, and workds quite well... But, with a few caveats:

- 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
Visit my website at www.adambadke.com
Offline , line, 80 Posts, Join Date Jan 2010, Location Vancouver, BC  
   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Copyright 1998-2012 A. Risch