Jump to content
Battlefront is now Slitherine ×

Tree mod - cor I could .mdr a beer ...


Recommended Posts

Some of you fine fellows will know that I've been playing around (read: tearing my remaining hair out!) with mdr files whilst preparing some new flora for BN and RT. One of my side projects to this has been trying to develop new, naturalistic tree modes - a large, leaning oak tree to begin with. Anyway long story short, I got as far as doing the basic modelling, importing it into the games, all seemingly hunky dory except that I needed to work on the UV map for the bark texture. After plenty of study and looking at the various online guides, I thought I had a fairly good grasp of the basic principle of UV mapping and proceeded with unwrapping my model and making various attempts at manipulating the UV map to produce a nicely textured tree, this is where it all went t*ts up ...

So from my understanding of models for CM the model has to be made of triangular texel faces, I guess they need to be flat/planar as well. The unwrapped UV map will consist of islands (I'm in Blender doing this BTW) with as little texture distortion as possible, though some texture stretching is inevitable and allowed? So far I have tried multiple times to achieve a good outcome by hand manipulating the UV map; using the various UV map unwrap projection methods; using smart UV unwrap; using project from view in an orthogonal viewport ... and goodness knows what else. All to no avail, the result is always more or less malformed. It doesn't break the mdr, the basic model is fine, I can still export and use the model in game without any other issue.

Here are images of what I'm getting from the export:

AqreAxv.jpg

The areas highlighted show severe distortion of the texture at what I think is the edges of islands on the UV map, though it's hard to say ... (just realised these look somewhat phallic, sorry, completely unintentional)

FVOlAvA.jpg

... same tree rotated view, more of the same though the area highlighted blue is distorted in the original UV map since I haven't altered it from what was auto unwrapped ...

sibDfkm.jpg

... the model in Blender, no particular unexpected distortions, some wholly expected joins ...

Cs1JyUc.jpg

... rotated, again no unexpected distortions, the highlighted area is the distortion seen previously where I haven't adjusted the UV unwrapping ...

Lzm14E5.jpg

... the model unclothed, I tried with more or less triangle faces, made no noticeable difference ...

J2ds7RA.jpg

 ... the UV map as it stands; the top few islands are a side branch unwrapped by using seams and selecting a section at a time, then using a bit of manual manipulation to realign some faces; the middle five islands are done using project from view unwrapping, no extra manipulation except to move them into a row; the bottom mess is from the smart unwrap - as you can see it lives up to it's name! All that was done to this was to relax the angles to reduce stretching ...

LlSmQDG.jpg

... what I have discovered is that if I then reimport my exported tree.mdr this is it's UV map, obviously something is going wrong possibly at the export stage; possibly a limitation of the export module? The brown colours on the left are inherited from the original game tree mdr file and don't appear in the file until after it's exported, at least I've never seen them and I've reset the UV map on multiple occasions.

My questions are:

• Am I flogging a dead horse here, is what I want to make impossible in the current game with the current tools we have?

• If it is possible, where might I be going wrong?

• What tools do BF use for 3D modelling?

• Can we please, please, please at least have an official tool from BF to open and resave the mdrs? @sbobovyc did an amazing job creating the tools we have now for import and export, @Aquila-SmartWargames @Frenchy56 @kohlenklau @JM Stuff @benpark amongst others have pursued and encouraged the modding of 3D elements in the games, and what would really help this to flourish is for something to make the process a little easier. I know this isn't a priority for @Battlefront.com but boy would it help us poor modders ... did I say please ...

uHPNsaq.png

• If not then I'll shut up and go away ...

I would really appreciate any and all input, suggestions, offers of an empathetic beer, a kitten ...

If you want to look at the files they are here, the blender file does have the models for the tree crown as well, they are just hidden. The tree mod can be opened in most CM games just drop the mdrs and bmps in your z folder as usual.

Ta

 

Link to comment
Share on other sites

I'm just the 2D artist, I'm not the clever one. But during texturing I'm often telling the 3D artist 'This bit is mapping badly', 'That bit isn't mapping to anything', 'That other bit is displaying inside-out.'  Often I don't bother him and simply counter-warp the art the opposite from the polygon so it'll appear correct in-game.

Link to comment
Share on other sites

Hey Lucky.

1. battlefront officially has been pro-modder but there is a limit. We got rezexplode and rezpack. We never got any map converter. 

2. battlefront second echelon guys like Mikey and ben have always been super helpful to me and others but can only do so much, (NDA?)

3. with all that said, I will download your stuff and take a look. But let me first say that I have an "Associate's Apprentice Certificate" in 3D Blender Hacking from "CM BFC Forum Community College"...  I used the GI Bill!

 

Link to comment
Share on other sites

As per Soviet-era reverse engineering SOP, I always first take a good analysis of what NATO capitalists did. I made a quicky striped "tracker bmp".

Oh, do you know about making edges become "seams" to help guide the uv unwrapping? EDIT: YES, I RE-READ. YOU DO. OOPS. Just mentioning that...I think it helps. The below tells me that BFC uses seams also. Of course, your tree is freaking awesome. But the enemy of awesome is that it is often challenging to succeed.

03RhZHf.png

Edited by kohlenklau
Link to comment
Share on other sites

Here is something maybe of help...maybe you know, maybe you don't.

Be in edit mode in Blender, solid mode for display of the object, vertex select mode for selecting a vertex. Ctrl-n is properties of the vertex.

You can type in the z coordinate to make them all level horizontally. Go around the tree 360 and right click each verex near your desired z height and then type the z coord entry to MAKE it exactly the same. Maybe that helps with the seams.

 

Link to comment
Share on other sites

14 hours ago, MikeyD said:

I'm just the 2D artist, I'm not the clever one. But during texturing I'm often telling the 3D artist 'This bit is mapping badly', 'That bit isn't mapping to anything', 'That other bit is displaying inside-out.'  Often I don't bother him and simply counter-warp the art the opposite from the polygon so it'll appear correct in-game.

I don't think the word just could ever apply to the work you've done Mikey!

I did wonder about approaching this from a different direction, maybe a very large texture, but I just couldn't wrap my poor noodle around how to proceed.

Link to comment
Share on other sites

10 hours ago, kohlenklau said:

3. with all that said, I will download your stuff and take a look. But let me first say that I have an "Associate's Apprentice Certificate" in 3D Blender Hacking from "CM BFC Forum Community College"...  I used the GI Bill!

Several levels above me then! I got a silver star on my Blender grade school homework.

Thanks for taking the time with all your thoughts and suggestions Kohl, very much appreciated ...

10 hours ago, kohlenklau said:

Oh, do you know about making edges become "seams" to help guide the uv unwrapping? EDIT: YES, I RE-READ. YOU DO. OOPS. Just mentioning that...I think it helps. The below tells me that BFC uses seams also. Of course, your tree is freaking awesome. But the enemy of awesome is that it is often challenging to succeed.

Thanks, this is why I wonder if it's just a stretch to hope it will work.

I can't see anything that technically would prevent something this wonky from working, BUT I do notice that all the UV maps for BF originals are very, I mean ultra, neat and packed like how my wife packs to go on holiday. I tried repacking the UV maps but still to no avail.

10 hours ago, kohlenklau said:

Here is yours. Try using some seams in as best a horizontal manner as you can? 

EDIT: Also I see that exactly where the branches join the trunk, that should definitely be a seam... 

I have been a bit reticent about doing the whole of the UV unwrapping more manually as it's a ton of work that may not pay any dividends. But I will see if a horizontal seam works on the bottom part of the trunk. The auto unwrapping should work according to all that I've read, it just won't make for pleasing results.

10 hours ago, kohlenklau said:

BUT maybe what you are saying is you DO export it perfectly but it comes back all hosed when you import it back? Right?

Hang in there!

Yes, other than messed up UVs that export is flawless.

9 hours ago, kohlenklau said:

I need more coffee!

Try this, rename your tree bmp with some small change like the e to a t in tree? Make it tret-3-bark

change in Blender also and reprocess and export and reimport to see if the original brown goes away?

No dice, the weirdness remains. The brown is coming from the UV map as opposed to the texture. I have no idea where that is though when I look at my Blender file, it's just not there. It only appears on export and in the reimported mdr. There's something I'm missing in the Blender file. It may of course be associated with the mysterious metadata ....

8 hours ago, kohlenklau said:

Here is something maybe of help...maybe you know, maybe you don't.

Be in edit mode in Blender, solid mode for display of the object, vertex select mode for selecting a vertex. Ctrl-n is properties of the vertex.

You can type in the z coordinate to make them all level horizontally. Go around the tree 360 and right click each verex near your desired z height and then type the z coord entry to MAKE it exactly the same. Maybe that helps with the seams.

Do you mean just for the very bottom edges of the model? Or every single vertex?

I just notice you've sent me message so I'll go and read that ...

Link to comment
Share on other sites

Well, what's the old saying, where there's a will ... no more nasty texture distortion (caveat: with some compromise) ...

There's no manual for how to mod CM, especially how to mod the 3D models, so this is all made up after much trial and even more error, but some careful thinking with prompts from our amazing mod powerhouse that is @kohlenklau and a drop of the special sauce 🥃 (donations very welcome 😉) ... I spent one more (very long) night bashing my head against a very tough tree trunk, trying to get rid of aforesaid texture distortions, and just as Mr Blackbird was greeting the dawn I decided to call it quits. Off to bed for you my lad and dream of mods. Then, just as I was cleaning me gnashers I had a thought about my last attempts, which had seemed better but still not much; I had separated all the main components into their own meshes (sorry if this sounds like nonsense to the uninitiated, it might help some other poor soul), but most of the distortions remained except at some edges, what if, as with the game's originals, the models all need to be tubes? So, today, I cut the trunk into a series of tubular sections, deleted most so that I was only concentrating on the large bottom section, and tried again, better! What about slicing the trunk lengthways - imagine a paper tube cut along it's length then opened out flat; better again the texture distortion along the cut edges gone! You see where this is headed?

Finally, cutting the whole tube into manageable sections gets rid of the distortion at ALL the edges of ALL the sections, each sub-mesh effectively has it's own texture map that stops at it's edges and doesn't affect it's immediate neighbours - hey-presto no distorted textures (excepting if I actually make them distorted). Why this way? Don't know, maybe the game cannot handle curves beyond a certain angle, there are for sure other curved facets in the game, but most are made from tubular shapes constructed with triangular cross-sections or square, pentagonal, hexagonal, octagonal, etc (essentially triangles, look down the muzzle end of a large calibre gun barrel when next in game to see what I mean, they're not round, you get the picture), nothing wonky ... so all tubular shapes need to be constructed in this way OR from flattish individual panels, more like building for instance.

So here boys and girls is a more naturalistic tree trunk without nasty weird distorted textures that will work in game ...

RmyO0Jx.jpg

... it's only the bottom section, the branches need a whole load of work to do the same and so on ...

3YE27AC.jpg

... the caveat (at the moment) there are more angular interfaces, much less curviness and more sharp edges, compare it to the very first images of the tree in game at the start of this thread ...

lflc5U7.jpg

... in-game, in the corner of a field, Fritz hiding in the shadows ...

QWDBq2X.jpg

... whilst his comrades sun themselves in the long grass at the woods' edge, waiting for Tommy ...

The sharper angles might be something I can work around by adding more faces to the 3D mesh, which don't impact massively on the 'drawing' cost of a tree in-game compared to all those leaves ... my tree already has a smaller triangle (face) count than the official version.

Happy days!

 

Link to comment
Share on other sites

I applaud your efforts.  However, I was looking at the in-game images using Aris' "tree bark" mods, and they already look very good.  I don't see the angularity that we see in your pics.  The bark in Hedgerow Hell is also xnt.

Just wanted to make sure that you have checked those out and are not reinventing the wheel.

Edited by Erwin
Link to comment
Share on other sites

59 minutes ago, Erwin said:

I applaud your efforts.  However, I was looking at the in-game images using Aris' "tree bark" mods, and they already look very good.  I don't see the angularity that we see in your pics.  The bark in Hedgerow Hell is also xnt.

Just wanted to make sure that you have checked those out and are not reinventing the wheel.

Tee-hee! Errr ... I made Hedgerow Hell 😉 But thanks for your concern.

Yes I agree, the original game bark which Aris modded was very nice, then along came a couple of others and they were also improvements; my Hedgerow Hell tree barks were mostly brand new textures which I hoped took the art of bark texturing to the next level, with identifiable species of tree. However, the point of this one is not so much bark, but rather to have tree trunk shapes which are not constructed simply from straight, elongated cone shapes interlocking with each other; the trunk is a cone, the branches are also cones, albeit with non-circular cross-sections. What I've done here is a very different and, dare I say it, new way of making trees for CM (though of course we don't know if BF may have tried this in the past). As I said in my post above, there are caveats which I am well aware of - the noticeable angularity for instance - but I feel this is something that I may be able to ameliorate to some extent. Also there are other implications and benefits from what I am doing which might also possibly help other modders. If you look carefully at the games we have you will notice that most of the shapes used are very simple or combinations of simple shapes, what I hope to show is that we can have more complex shapes, and given today's much more powerful GPUs and CPUs some of this extra horsepower could perhaps be leveraged to improving how the game environment looks. With the up coming release of CMBN on Steam BF will attract a lot of potential new customers and many of them will have an expectation of how graphics can look today, so, IMHO anything that can make for a more immersive experience, whilst still maintaining the fantastic underlying mechanics of the CM games, is all good.

Edited by Lucky_Strike
Link to comment
Share on other sites

Wow, great stuff! (work has put my own projects back in CM hypersleep again for the time being. Ain't it awful?). 

One question: how endemic are tulip trees in northern Europe? (I know they're pretty common in northeast North America - a very ancient and resilient genus that dates to the Jurassic btw though not well suited for timber).

I think this has been discussed before, and is well beyond anyone's ability to mod up, but I'd expect large expanses of primeval mature oaks and such to be a bit of a rarity in timber hungry populated (embattled) Europe. Large stands of conifers (not great for firewood), absolutely. Isolated big trees by riverbanks, in parks or manor estates, sure. But deciduous woods that haven't been logged in the last century? not so much.

Tactically, This Matters since stands of smaller trees (regrowth) competing for sunlight offers a lot less ground level LOS through in season than what's in the game.

Edited by LongLeftFlank
Link to comment
Share on other sites

Thanks LongLeftFlank, bad foot left me with extra time and having to spend most of it sitting down, shame 😉

Tulip trees are uncommon in Europe, mostly ornamental reserved for parks and the like.

From the time I've spent working on the mods - this and Hedgerow Hell - I do know that we are seriously lacking in tree variety in CM. The games, by necessity have to limit the number of models, the newer releases do have more and I hope that we may get more for BN one day.

It's true that much of the ancient forest of Europe has disappeared even by the time of WW2, but actually there are/were still many pockets of woodland with trees well over several hundred years old. As a child growing up in southern England, very similar countryside to the Bocage in Normandy, I spent many a happy day playing in woodlands comprised of massive beech, sycamore, ash, elm etc and the hedgerows were dotted with many ancient trees. Large plantations of conifers tending to be more of a northern European thing, though they have become more widespread over the post WW2 years. Interestingly that trend is starting to reverse in a progressively more environmentally aware world where the negative impact of these monocultures is seen on the diversity of other species of flora and fauna. 

9 hours ago, LongLeftFlank said:

Tactically, This Matters since stands of smaller trees (regrowth) competing for sunlight offers a lot less ground level LOS through in season than what's in the game.

Yes, again here we are limited by how the game engine works. I am able to mod the trees, and indeed bushes and bocage, to give the impression of very dense undergrowth but mostly it has no impact on how the mechanics work, whether I make a sapling or a behemoth out of a regular tree the engine still sees a regular tree. The only real effect in-game is if one plays mostly at ground level with visual aids turned off, then one looses track very quickly of where the enemy is and where one left that MG squad!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...