Tree Leaves Shader

Posted By: PietroNifosi

Tree Leaves Shader - 06/01/10 14:54

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.
Posted By: DavideG

Re: Tree Leaves Shader - 06/01/10 15:57

Ciao Pietro... Se mi scrivi in italiano cosa cerchi ti posso aiutare... wink
Posted By: Widi

Re: Tree Leaves Shader - 06/01/10 17:44

@DavideG: I dont speak italian, you give already a solution? Please write in english...
Posted By: PietroNifosi

Re: Tree Leaves Shader - 06/01/10 18:58

no he didn't, can you please help?
Posted By: Hummel

Re: Tree Leaves Shader - 06/01/10 20:26

if you upload the model in MDL format I´ll take a look at it
Posted By: EvilSOB

Re: Tree Leaves Shader - 06/01/10 20:29

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...


Posted By: Slin

Re: Tree Leaves Shader - 06/01/10 21:17

That is a very bad proposal EvilSOB, as the sprite aproach will be many many times slower while it will be fast with a shader.
Posted By: PietroNifosi

Re: Tree Leaves Shader - 06/02/10 00:28

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.
Posted By: JibbSmart

Re: Tree Leaves Shader - 06/02/10 01:51

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
Posted By: PietroNifosi

Re: Tree Leaves Shader - 06/02/10 03:17

I see.. this explains a lot. Now I see why loopix trees are done that way, static.
Posted By: Slin

Re: Tree Leaves Shader - 06/02/10 09:33

It should be possible to put the needed information into the second UV-Set and then do the requested. The only problematic part will then be, to set up that second uv set.
Posted By: DavideG

Re: Tree Leaves Shader - 06/02/10 10:08

Caro Pietro... se fossi stato un buon modellatore non avresti avuto questi problemi... Io ho la soluzione ( ovviamente per quanto riguarda la modellazione e non la programmazione ). Se fossi meno presuntuoso, adesso probabilmente avresti risolto il problema... Abituato a Generare alberi con 3dS MAX e non a crearli manualmente stai alzando un polverone inutile...

Ti saluto...
Posted By: PietroNifosi

Re: Tree Leaves Shader - 06/02/10 14:58

Gentilissimo Davide,
la ragione per la quale non voglio avere nulla a che fare con te dopo il tuo post presuntuoso di ricerca del pelo nell'uovo sul topic in Third Party del mio work in progress, ha raggiunto finalmente il suo culmine.

Mi spiego meglio.

Avendo vissuto per parecchi anni all'estero (per studio e per lavoro, quindi esperienza professionale nel settore dei videogiochi che tu molto sicuramente sogni di avere) ho imparato a confrontare diverse culture e diversi modi di fare nei vari paesi del mondo con l'italia.

Una grande dote del maschiaccio italiano e' quella di essere sempre invidioso verso gli altri (immaginati sopportare l'idea di un altro italiano che potenzialmente e' piu' abile di te anche in questa piccola comunita' di wannabe developers).

In base al tuo ultimo messaggio di buon augurio, dopo avermi offeso dicendomi di essere un mediocre modellatore (puro e semplice rosico), hai dunque dichiarato che tutti coloro che utilizzano plugin sono gente di poco talento.

Bene. Cio' significa che tutti coloro che hanno lavorato ad Oblivion, o The Witcher (ed altri titoli che non sto a dire perche' sarebbe una lunga lunga lista) ed hanno utilizzato SpeedTree Modeler sono artisti mediocri.

OK. Ma a questo punto, se metti al rogo coloro che cercano un alternativa rapida allo sviluppo di un videogioco (e qui dimostri di non aver mai lavorato in uno studio con date di scadenza, ma a casa tua da solo e per hobby), e ti vanti invece di fare tutto manualmente cioe' riscoprire all'infinito la ruota.. non dovresti anche vergognarti di te stesso se utilizzi un programma di modellazione? e' troppo facile!

Perche' non passi direttamente a scrivere numerini di coordinate sul notepad? Oppure ancora meglio scrivi in Assembler.

Ma non ti tenevi occupato con quella bella pallina che stavi modellando? Fanne un altra magari se hai finito con la prima.

ED INFINE PER CONFERMARE LE CAZZATE CHE SCRIVI :

SpeedTreeMAX was launched in February 2002, and SpeedTreeRT was licensed for its first titles, including The Elder Scrolls IV: Oblivion, in December 2002. SpeedTree has been licensed for PC and next-generation console titles in a wide variety of genres by developers including:

* 8monkey Labs
* Activision
* Airtight Games
* Ascaron
* Atari
* Auran
* Bethesda Softworks
* Big Huge Games
* Bizarre Creations
* BioWare
* Blue Byte Software
* CD Projekt
* Cheyenne Mountain Entertainment
* Cornered Rat Software
* The Creative Assembly
* Cryptic Studios
* EA Mythic
* Eidos Interactive
* Electronic Arts
* Epic Games
* Frontier
* Funcom Productions
* Gearbox Software
* Gravity Corp.
* HSC Labs
* Insomniac
* Intelligent Soft
* Koei
* Larian Studios
* LucasArts
* Massive Entertainment
* Microsoft Game Studios
* Midway
* Monte Cristo
* Namco Bandai
* NCsoft
* NetEase
* Nexon
* Ninja Theory
* Obsidian Entertainment
* People Can Fly
* Perpetual Entertainment
* Piranha Bytes
* Pivotal Games
* Pseudo Interactive
* Real Time Worlds
* Rockstar Games
* S2 Games
* SEGA
* Sierra Entertainment
* Silicon Knights
* Simutronics
* Sony Computer Entertainment
* Square Enix
* Star Vault
* Take-Two Interactive
* THQ
* Ubisoft
* Vivendi Games
* Volition
* WEBZEN
* Zelian Games


Ciao Ciao e mi raccomando rosica un po di meno che poi se ti stressi troppo ti cadono i capelli.
Posted By: DavideG

Re: Tree Leaves Shader - 06/23/10 14:30

Caro Pietro... la mia "riprensione" non voleva essere una "ricerca del pelo nell' uovo"... ma un semplice avviso nel caso in cui non ti fossi reso conto dell' "errore"... Il problema è che forse ti sei sempre sentito dire bravo bravo... e quando ho scovato l' "ombra anomala" (che poi anomala da quanto ho capito non è)ti sei arrabbiato... ( e non ho capito perchè )... Tu puoi anche aver studiato dove vuoi... Se hai la possibilità economica di permetterti tutto... anche la presunzione di dirmi "non ha la soluzione" ( che ripeto era semplice se avessi imparato comunque a modellare un albero senza speedTree [ e non è male usarlo ] )
La mia non è invidia ( questo è quello che pensi tu )... solo perchè ho fatto una semplice annotazione mi dici questo... se mi conoscessi capiresti chi sono... e invidioso non di certo...

Concludo...

1)SpeedTree non è male usarlo ma una conoscenza della modellazione manuale di qualsiasi cosa bisogna averla.
2)Grazie a Dio ad Ottobre studierò in una buona accademia e pagherò a "rate" l' iscrizione dato che non sono ricco come te evidentemente
3)Ti ho dato del mediocre semplicemente per il fatto che ti ritieni cosi bravo da dirmi "non ha la soluzione" e poi non sai modellare un albero...
4)Non hai mai visto dei miei lavori quindi non puoi dirmi se sono bravo o meno... aspetta un pò e forse ( dato che sto allestendo il mio portfolio ) vedrai i miei lavori...

Ciao Pietro wink
Posted By: fogman

Re: Tree Leaves Shader - 06/23/10 17:28

Somehow it sounds really interesting as far as I can tell... wink

Could you please translate that to simple english?
Posted By: Why_Do_I_Die

Re: Tree Leaves Shader - 06/25/10 09:38

y do you need the leaves to face the camera ? In real life , the leaves don't face you when you look at them.That trick was used for sprites because they were only 2 planes, and if they didn't rotate to face the camera you would see they were a 2d plane image. For a tree made of a model with individual leaves , there is no reason to have them face the camera , in fact , doing so would look rather strange. A better idea would be for the leaves to have some kind of animation , just my 2 cents.
© 2024 lite-C Forums