1 registered members (Ayumi),
662
guests, and 3
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Tree Leaves Shader
#326524
06/01/10 14:54
06/01/10 14:54
|
Joined: Dec 2009
Posts: 217 Italy
PietroNifosi
OP
Member
|
OP
Member
Joined: Dec 2009
Posts: 217
Italy
|
Ok so, I'm in need of a shader that applies orientation to the leaves so that they keep on facing the camera. Just like sprites.
I wanna have a tree composed by 2 separate meshes, trunk and leaves, but it would be a pain to singularly place sprites while generating them with a 3dsmax plugin is much easier.
Can it be done? I'm not a programmer.
Last edited by PietroNifosi; 06/02/10 03:17.
|
|
|
Re: Tree Leaves Shader
[Re: Hummel]
#326623
06/01/10 20:29
06/01/10 20:29
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
As a programmer (and a poor modeller), I think the sprite way is the best...
All you gotta do is attach the sprites to specific vertices of your model, and then they'll always be positioned correct, and always face the camera...
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: Tree Leaves Shader
[Re: Slin]
#326641
06/02/10 00:28
06/02/10 00:28
|
Joined: Dec 2009
Posts: 217 Italy
PietroNifosi
OP
Member
|
OP
Member
Joined: Dec 2009
Posts: 217
Italy
|
I can't explain it easier
Ok you have a mesh composed of 20 triangles (10 quads). Have them face the camera all the time.
Can you do that in a shader? can you script that for me please? I don't think it's that difficult from a theorical point of view but like i said i'm not a programmer.
Last edited by PietroNifosi; 06/02/10 03:16.
|
|
|
Re: Tree Leaves Shader
[Re: PietroNifosi]
#326644
06/02/10 01:51
06/02/10 01:51
|
Joined: Mar 2006
Posts: 3,538 WA, Australia
JibbSmart
Expert
|
Expert
Joined: Mar 2006
Posts: 3,538
WA, Australia
|
In a vertex shader, each vertex is generally only aware of its own position and its normal. There's a bit more than that, but basically you want each quad to rotate around the quad's centre, and in order to do that each vertex needs to know its position relative to its quad's centre, and this cannot be done in a shader.
I would personally do it with bones, if you're using the A8 beta, and do bones animation in the vertex shader. Use ent_bonerotate to orientate the bones when you need to. It'd be worth a try, anyway. It might still be slow with lots of bones, and it'd be tedious to set up. It could be done in A7, but all the vertices will be moved using the CPU, and that'll be slower.
Alternatively, if your Max plugin can put down single vertices instead of quads it wouldn't be much effort to write a function that just places a sprite at each of those vertices -- like Slin said, this'll be relatively slow, but A8 has sprite instancing, which might make up for it.
In short, I don't think what you want to do is feasible in A7, but A8 might have what you need on the off chance that you're a private beta tester.
Jibb
Formerly known as JulzMighty. I made KarBOOM!
|
|
|
Re: Tree Leaves Shader
[Re: JibbSmart]
#326647
06/02/10 03:17
06/02/10 03:17
|
Joined: Dec 2009
Posts: 217 Italy
PietroNifosi
OP
Member
|
OP
Member
Joined: Dec 2009
Posts: 217
Italy
|
I see.. this explains a lot. Now I see why loopix trees are done that way, static.
Last edited by PietroNifosi; 06/02/10 03:17.
|
|
|
|