Jump to content
Sign in to follow this  
mikebart

mikebarts Soft Shaded Trees

Recommended Posts

Hey guys, some of you might already be aware of these things if you've checked out the thread that Abs created over at Arma 2 Editing\ Arma 2 O2 modeling\ How does one create custom trees?

if not have a look if you're interested in finding out what they're all about and how to make them work. Basically im using Maya 2010 to transfer the vertex normals of a sphere onto a peice of foliage, so that it looks like this:

vertnorms.th.jpg

Im really intending this tree to be a learning example for guys making trees along with some info on how to apply this technique to their foliage as an alternative to lightmapping, as its easier to set up (as long as you have Maya) and should perform better than an A2 tree seeing as it has no 2nd UV channel.

I'd appreciate it if island makers could test it out for performance and asthetics, I also want to test out some other things like, "does a tree perform better when it has only one material for all the lods?" and "how much does a light map effect performance", so its a bit of an experimentation thing aswell

It comes with a config too so that you can place it in the editor, just for viewing, but its really intended to be used by island makers.

Below is a comparison between the standard vert normals (unified) on the left, and the altered vertex normals (spherical) on the right, you'l notice that the tree on the right receives light more volumetrically than the tree on the left which apears quite flat.

elmsmallcompare.th.jpg

In the two screenshots below you'll see how the trees compare in a group situation, the altered vert normals give the tree a bit more bang for its buck for no extra cost

elmscompare01.th.jpg

Im hoping that this could be a more performance friendly alternative to lightmapping. Standard Arma 2 trees use a lightmap on a second UV channel, which also includes some colour variation aswell as baked in shading. Although the altered vertex normals are'nt quite an equal alternative to a light map, there are some things that the altered vertexes can do that a lightmap cant, such as receive light dynamically in the same way, for example you couldnt get a forest shading quite like this just with lightmaps:

foliage02.th.jpg

something i'd really like to try is the combination of the altered vertex normals and a lightmap for ambient shadow and and colour variation and then find out exactly how much a light map affects performance.

hey guys, heres the final release, i've updated all the geo lods, the trunk and added a lightmap just to the trunk.

Download mb_elmSmall1.02

-fixed $pboprefix$

-added surface types 'foliage' and 'wood'

Edited by mikebart

Share this post


Link to post
Share on other sites

Hey that's pretty clever. I'm guessing you used "transfer attributes" in maya for that?

Share this post


Link to post
Share on other sites

yeah i did!, and the great thing about it is that you can use any shape you want,i wrote a quick tutorial on how to get spherical vert normals for your vegetation using the transfer attributes in maya;

1. start by creating a polysphere next to your foliage model.

transferattributes01.th.jpg

2. select the foliage first then the sphere, making the sphere the primary selection.

3. Open in the file menu, mesh/transfer atrributes, have only vertex position on in the dialogue (refer to image below)

4. select only the sphere object and drag/translate it over the foliage object until it 'shrinkwraps' itself around the shape of the foliage as shown in the image below.

transferattributes04.th.jpg

5. freeze all transformations, now select the sphere then the foliage, making the foliage the primary selection,

6. in the transfer atributes dialogue switch off vertex position and swith on vertex normal and the foliage takes on the vertex normals of the shrinkwrapped sphere object.

transferattributes05.th.jpg

Share this post


Link to post
Share on other sites

Much better looking. How does it perform FPS-wise? I would like to give it a test with fagus trees and pines on Panthera I'm upgrading soon :)

Share this post


Link to post
Share on other sites

well, it should be pretty good i think, its only 1350 verts on lod1, there's 3 visual lods each with there own textures, all 2048 in the download but they could be dropped to 1024 and still look fine I reckon, including the lod1 textures, and the foliage only uses 1 UV channel instead of 2.

So all in all I think they should be pretty efficient

edit: thats great to here you're upgrading Panthera Icebreaker

Edited by mikebart

Share this post


Link to post
Share on other sites

I tried the semi-finished test models that were posted over in editing... a couple of missing textures - pulled them out of the other post and got them working...

It's difficult to judge FPS of course... I tried roughly 500,000 of the dodgy brown birch tree over a 40x40km terrain - then swapped them for the small elm...

Initial impressions were...

Performance seemed pretty good compared to the dreaded brown trees... I just flew around mostly, but things seemed pretty smooth... perhaps a few FPS more... need to test more thoroughly though...

They "bulk out" well... - the birch looks "thin" at 1 tree per 10m, but the elms filled out nicely, and gave a nice dense woods look at the same density. Thats really handy!

I'll try again with the new version later this evening, but it all looks very good...

Well done for pulling it all together mikebart! it was great fun watching the idea develop - even if I barely understood a word of it! :)

B

Share this post


Link to post
Share on other sites

thanks Bushlurker, it wasnt all me though, I had a lot of help from Synide to get these working. thanks for doing some tests, its gonna be hard to test till I fix the collision lods cause they'll affect the fps a bit too, but atleast you say they're looking ok :)

Share this post


Link to post
Share on other sites

mikebart: so, you'll be working on the pines & fagus class?

Share this post


Link to post
Share on other sites

Largely over my head but colour me impressed. Good luck!

Share this post


Link to post
Share on other sites

^^ What he said. Good work Mikebart! :)

Has the last image in the first post anything to do with AI viewblock? Or will they have viewblock capability? Would be very nice.

Thanks for the effort. Looking forward seeing these in action. :)

Share this post


Link to post
Share on other sites

If some tree mlods come out from bis anytime soon then I might consider re-working the origional A2 trees, the shrubs could really use this treatment, ill probably work on making another large version of the Elm next, along with some younger versions of the tree.

Elms and Faguses aka beech have very similar leaves so it could just be a few minor texture changes with the leaves and a smoother trunk (could just use bis's). I'd definitly like to see this technique applied to pines, I think they'd render really nicely.

So yeah ill see how i go with that Icebreaker but i think it would be a while.

---------- Post added at 09:28 AM ---------- Previous post was at 09:14 AM ----------

^^ What he said. Good work Mikebart! :)

Has the last image in the first post anything to do with AI viewblock? Or will they have viewblock capability? Would be very nice.

no, that's showing a sphere that's been shrink wrapped roughly around the volume of the piece of foliage, so if you can imagine what the vertex normals are doing on that shape to make it render the way it is, those same attributes are being transferred over to that piece of foliage via the vertex normals, and thats causing the foliage to recieve light as if it has real volume

Edited by mikebart

Share this post


Link to post
Share on other sites

Amazing and very clever work.

I might try this and fraps it when I get some time, going around the NW part of Utes, near the lighthouse (just as an example).

Is there a key signature for servers that verify keys?

Keep up the good work!

Share this post


Link to post
Share on other sites

BUGS:

Theres a few bugs which I havent been able to fix, one is im getting no shadows, not sure why, I dont think i've done anything different than in trees i've made in the past in regards to shadows, also im having problems making convex hulls work for collision lods, I reverted back to the arma1 02 so that the "make convex" function worked but they still didnt collide, i just thought i'd post it up now for if anyone wants to do some performance tests, you'll just have to keep in mind those issues. I've spent alot of time tweaking the .paas and .rvmats, i think they're switching lods pretty well.

Download: http://www.esnips.com/doc/be493897-300a-4cdb-ad52-4a651fa1273f/MB_soft_shade_trees_beta

Not sure why you aren't getting shadows on your model. Didn't had time yet to unpbo the model and check out it's setup. I suppose you are aware of the shadowLod 1000 (for stencil shadow, especially for vegitation).

You might also be something with this topic of Klinck if you want alpha shadows to work (might be a bit to heavy though, but should give nicer shadows):

http://forums.bistudio.com/showthread.php?t=83863&highlight=alpha+shadow

As for your convex geo shapes. As you know make them as simple as possible. Keep them smooth (no sharp edges). In organic shapes i most of the times keep them as squarized as possible and then converted them to tris by using the O2 option 'structure->triangulate concave' (could be it was triangulate convex). Most of the times that converts the poly into tris without having non-convex faces. It ain't always 100% perfect in one time, some times you need to subdive your model into smaller pieces.

Share this post


Link to post
Share on other sites

Mike, if this can take me from 22 to 24 fps in wooded areas that would be a dramatic and awesome improvement. D you have t have everything set to "very high" image quality for this to work right?

Share this post


Link to post
Share on other sites

Is there a key signature for servers that verify keys?

No, not yet, would that be useful though?, server keys are an area i havent quite delved into yet, do you mean so that you can swap it with an existing tree? ill look into it.

Not sure why you aren't getting shadows on your model. Didn't had time yet to unpbo the model and check out it's setup. I suppose you are aware of the shadowLod 1000 (for stencil shadow, especially for vegitation).

You might also be something with this topic of Klinck if you want alpha shadows to work (might be a bit to heavy though, but should give nicer shadows):

http://forums.bistudio.com/showthread.php?t=83863&highlight=alpha+shadow

Im pretty sure thats the same as what ive got, im not sure wether its possible but I'd really like the foliage to not recieve shadows from the shadow lod, just the trunk and branches, theres enough shadow information baked into the texture of the leaves, and with the way they're rendering, they kind of appear to have a bit of light passing through them, which is realistic.

As for your convex geo shapes. As you know make them as simple as possible. Keep them smooth (no sharp edges). In organic shapes i most of the times keep them as squarized as possible and then converted them to tris by using the O2 option 'structure->triangulate concave' (could be it was triangulate convex). Most of the times that converts the poly into tris without having non-convex faces. It ain't always 100% perfect in one time, some times you need to subdive your model into smaller pieces.

thanks for the info Dasquade, I had a play around with those functions and I managed to get the fire geo and the collision geo working (forgot about weights), and ill just assume the view geo's working too, are there any debug commands like e.g "show view geometry" just so i can make sure on that?. Maybe i just need to get with the times and install win7, apparently the make convex bug is a winXP thing?

@tank commander; perfect for gumtrees eh!

Mike, if this can take me from 22 to 24 fps in wooded areas that would be a dramatic and awesome improvement. D you have t have everything set to "very high" image quality for this to work right?

Not at all, I've been testing them on low texture settings and low object detail and they still look pretty good.

---------- Post added at 10:04 AM ---------- Previous post was at 09:48 AM ----------

Just updated the first post with some more info about the mod, and put up a link to an updated .p3d

Share this post


Link to post
Share on other sites

Wow really amazing work there mate! Is AI behavior in any way altered this way? I mean the well known "look through gaps of bushes/trees leafs, branches, etc " ?

Share this post


Link to post
Share on other sites

Stunning work :eek: Hope to see a proper addon by the time. It should alter every tree in the game. This would make the game even better :)

Share this post


Link to post
Share on other sites
Wow really amazing work there mate! Is AI behavior in any way altered this way? I mean the well known "look through gaps of bushes/trees leafs, branches, etc " ?

thanks for the comments guys.

At the moment the view lod is pretty simple, i've basically just copied the view geo on one of the arma1 sample model trees, and altered it to suit, it would be interesting to see if things have changed much with Arma 2 trees in regard to view geo, guess we wont know till they release sample models.

edit: yeah just checked out the developers blog again, ill improve the view geo to look more like the image in this blog entry, wonder how much that effects performance?, could be an interesting thing to test

Edited by mikebart

Share this post


Link to post
Share on other sites

and BIS should include your work in the official patch :)

Share this post


Link to post
Share on other sites

How can I actually see those trees in action? Is it just enough to use the addon and fire up Chernarus, or do I have to wait for some Island maker to build them into his map? Would be great if Chernarus would benefit from it too because it is the most demanding map of all.

In the meanwhile it would be cool to have a simple test map to have a look at those arborary creations, that would also help you to get a few more infos on performance with different hardware.

Share this post


Link to post
Share on other sites

sorry im not quite there yet with replacing trees in chenaurus, but im looking into it, if you just want to have a look at them you can find them in the editor under EMPTY/MB_VEG

yeah a test map would be really useful, i've been working on my own island but i broke it a little while ago and havent gotten back to fix it, i just managed to successfully binarize the tree and added a server key so its getting there,

updated front page with a new version:Download Binarized and signed tree

Edited by mikebart

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×