1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

[Blender] modeling tileable forest features

Discussion in 'Civ4 - Creation & Customization' started by tesb, Nov 27, 2012.

  1. tesb

    tesb Emperor

    Joined:
    Jan 16, 2010
    Messages:
    1,593
    Hi i am searching for advise on the creation of features with blender. the features should be tileable and use <TileArtType>TILE_ART_TYPE_TREES</TileArtType> tag in the art defines.

    I encountered one major problem with this however: when i make custom meshes they will not use NiStringExtraData: OFFSETCOUNT within the *.nif meaning they will ignore height changes due to mountains and hills, thus disappearing within hills and mountains instead of on top of them.

    this becomes really interesting when i merge the meshes of the custom model with that of the trees into one mesh, the parts of the trees will work fine and the custom parts will still mess up. Does anybody know why this happens and how to fix this problem? currently the only method of making new features is by editing the old ones which significantly reduces the options for creating new art.

    Below are some explanatory pictures

    1) Used the tree stumps of the civ IV trees and merged them with the sugar leaves from the sugar resource into one mesh:
    Spoiler :


    2) the overall structure of the mesh in nifskope:
    Spoiler :


    3) testing ingame: the tree stumps correctly change z-level on hills, whereas the leaves are displayed in horrible ways:
    Spoiler :
     
  2. tesb

    tesb Emperor

    Joined:
    Jan 16, 2010
    Messages:
    1,593
    another example:

    1) in nifskope, the yellow things at the base of the plant are pieces of the old civ IV tree stumps. it is all one mesh, although the same thing happens if it is in different objects:
    Spoiler :


    2) in game the yellow stumps are placed correctly on the hills while the plants themselves are not placed on the hills but inside the hills:
    Spoiler :
     
  3. The_Coyote

    The_Coyote Emperor

    Joined:
    Mar 1, 2008
    Messages:
    1,367
    Location:
    Europe
    I guess the vertex color (to be exact, i think the red-value is is used for this) of the vertices is used to link the vertices to the offset. Or in other words, vertices with the vertex color "#01ffffff" are linked to offset 1, while "#0affffff" are linked to offset 10.

    But so far it is only a guess - only based on the structure in the nif.
     

    Attached Files:

  4. tesb

    tesb Emperor

    Joined:
    Jan 16, 2010
    Messages:
    1,593
    if this is the case it would be easy to fix, i will try it. my current work around is not up to my standards. i will try today (after sleep and report back).

    edit: is there an easy way in blender to color vertices's to exactly that value? i guess it would take quite a while in nifskope
     
  5. The_Coyote

    The_Coyote Emperor

    Joined:
    Mar 1, 2008
    Messages:
    1,367
    Location:
    Europe
    So far, i only saw a set value button (SetVCol - also Shift+K), but with this button you "paint" all vertices with the same color.

    A still relative fast option should be to *separate* all different "trees" to individual objects, give them their vertex color with *SetVCol* and after "coloring" them using *join object* to have one object again.
     
  6. tesb

    tesb Emperor

    Joined:
    Jan 16, 2010
    Messages:
    1,593
    ok i tested it and it works :) yay

    however there are some problems:
    when exporting i found that some vertex colors are not saved correctly for example checking in nifskope if everything worked i some times get deviations in the vertex color list like:

    #04ffffff
    #something weird
    #04ffffff

    this only happened after the second export so maybe i messed something up. one more serious thing is that you can open a color chooser in blender by pressing 'n' in vertex color mode, but the pipette function will return totally wrong values, for example i click on the tree and it gives me different color than displayed. basically i have to look at nifskope to get the colors of the right trees. very annoying.
     
  7. LunarMongoose

    LunarMongoose King

    Joined:
    Jan 29, 2006
    Messages:
    731
    Gender:
    Male
    Location:
    Boston, MA, USA
    HOLY CARP!!! This is EXACTLY what I needed to know!

    Huge thank you to Tesb for asking the question publically, and another huge thank you to Coyote for revealing the deepest mystery yet held by the dreaded NIF (which until now I'm pretty sure stood for "Noooooo, I'm Foobarred..." :().

    I have been wanting to fix the excellent Burnt Forest model that's been around for a while now, for, well, a while now lol. And the Bamboo model I discovered much more recently also got added to that frustration list.

    I thought Burnt Forest on Hills looked so awful I actually blocked it from being allowed there at all in MongooseMod (which, besides sucking in general, led to an awkward situation with the Forest Fire event hehe). But I just assumed there was nothing that could be done.

    Earlier tonight I again tried poking around blindly in NifSkope and trying a bunch of random things, but it probably would've taken me forever to find that red-value / OFFSETCOUNT link. Heck, I didn't even know if the OFFSETCOUNT object was relevant.

    Google didn't really turn up much on the subject, either. So as a final act of desperation I started searching for the nametag links of a few people here that I knew knew more about this stuff than I did, hoping they were still around so I could PM them... and promptly found this thread instead.

    THANKS AGAIN GUYS!!! :) :) :)

    *hugs*

    p.s. - This of course means I'll be making hill-compliant versions of the Burnt Forest and Bamboo models tonight, soooo... feel free to pilfer them when MM 4.1 is released. ;)
     
  8. LunarMongoose

    LunarMongoose King

    Joined:
    Jan 29, 2006
    Messages:
    731
    Gender:
    Male
    Location:
    Boston, MA, USA
    SUCCESS!!!

    It took the better part of 2 days, but I finally got Burnt Forest the way it SHOULD be! (The dead husks even sway in the wind now... Not sure if I should leave that on or not, lol.)

    Ah, this makes me a Very Happy Mongoose. For 2 years this problem was SERIOUSLY bugging me, and now it's fixed. :) I should point out that this was significantly more work than what Tesb was/is doing, b/c Burnt Forest doesn't use the default Forest/Jungle layout for its individual trees. I had to build my OFFSETCOUNT lists, and generate my 15 quadrant-variation files, from scratch based on the original model.

    It wasn't as straightforward as I'd hoped (I had to change things around several times, test some things, and redo some things when I made a dumb mistake), but I think I have all the kinks worked out in my conversion process now, so the Bamboo (and probably Scrub) work should go a lot faster.

    Can't thank you guys enough for the info in this thread! :)

    ---

    I never had any problem with corrupt/invalid data in the VertexColors after Export, btw. It took me a bit to find the button for it though, b/c I didn't realize Vertex Coloring is actually a full-fledged MODE (like Object Mode and Edit Mode).

    Also, I should mention that the NIF exporter in Blender only works if you have the objects you want (or a container for them like Scene Root) actively selected when you do the Export command - otherwise you get an almost-empty NIF file. It took me a minute to figure out why it wasn't working, so I figured someone else could easily mistake that for a bug, hehe.

    ---

    Now then... behold! *beams*
     

    Attached Files:

  9. The_J

    The_J Say No 2 Net Validations Retired Moderator Supporter

    Joined:
    Oct 22, 2008
    Messages:
    32,874
    Location:
    DE/NL/FR
    :thumbsup:

    Hope it's already in the database :).
     
  10. Zlatko

    Zlatko CIW

    Joined:
    Apr 1, 2010
    Messages:
    713
    Location:
    Solar System
  11. LunarMongoose

    LunarMongoose King

    Joined:
    Jan 29, 2006
    Messages:
    731
    Gender:
    Male
    Location:
    Boston, MA, USA
    Thanks. :) To be 100% clear though, I did NOT make the original skin or model on this. I actually don't KNOW who made it, so if anyone does know, please, umm, let me know. I got it from the Thomas' War mod originally if I remember correctly, but it's also in Caveman 2 Cosmos (and probably a lot of other places too).

    What I did was get it sitting correctly on Hills. (As automatic side effects, the trees also sway, and slide down to make room for tile improvements, now.) Before, the whole thing would lie flat, touching the highest point in the center of the Hill and spreading out like the trees were sitting on air.

    Ooh, The_J gave me a smiley. :) No, not yet. I have to give Bamboo the same treatment first. Then it'll be in MM 4.1's art files when that comes out in a month or so.

    I'm also planning to release it separately, but I already have a bunch of separate art downloads (with broken links still, heh), so I was going to combine them all into a Graphics Pack first, which'll take a little time.

    (I also need to release a PerfectMongoose update, and I'm literally working every waking minute on MM 4.1 right now... I promise I'll get the Burnt Forest files out as soon as I can. I'm doing the Bamboo conversion today though.)

    Speaking of which, I don't know who made the original Bamboo model either. I got it from Caveman 2 Cosmos (and their Credits section, being just a short list of names, is uselessly non-specific), so again, if anyone knows the author, please let me know. Thanks.
     
  12. The_Coyote

    The_Coyote Emperor

    Joined:
    Mar 1, 2008
    Messages:
    1,367
    Location:
    Europe
    You still remember what happened last time you summoned the holy carp here, do you? ;)

    Glad to see that this little thread could also help you and thanks for the (technical) feedback. And of course: :goodjob:
     
  13. tesb

    tesb Emperor

    Joined:
    Jan 16, 2010
    Messages:
    1,593
    i have noticed some issues with blender and vertex colors just to let you know (it happens in nifskope as well, it is not inherent to blender!):

    sometimes the vertex colors get messed up, for example the vertex color
    #09 is 0.0352941, if you apply this in blender you get a wrong vertex color. however even if you use the short version 0.035 (from nifskope) you get the wrong color. you can test in in nifskope if you set any vertex to 0.035 you get #08 and not #09. to get get #09 you need to use 0.036.

    i am not quite done with my new tile art, so there might be more of them out there, but i noticed these issues with:
    #09 0.036 0.0352941=0.035
    #0b 0.047 0.0431373=0.043
    #0c 0.048 0.0470588=0.047

    the first entry is the vertex color, the second value in bold the one that you should use and the third values are the original values from nifskope that produce the wrong outcome!
     
  14. LunarMongoose

    LunarMongoose King

    Joined:
    Jan 29, 2006
    Messages:
    731
    Gender:
    Male
    Location:
    Boston, MA, USA
    Well, what I personally have been doing this whole time is setting, in Blender, my desired vertex colors by manually typing "09FFFF", for example, directly into the Hex field, then immediately hitting the SetVCol button with the object selected.

    Once exported, I STILL get #09 when viewed in NifSkope (I just double-checked to be sure, hehe). It IS true that, when selected, the Red field in NifSkope reads 0.035, and if I then hit Enter on that existing 0.035 value, it SWITCHES the displayed hex value from #09 to #08. But as long as I leave it alone in its as-exported state, it seems to be correct.

    (Unless I'm missing something and you're saying that, even with NifSkope displaying #09, pumping 0.035 into Civ4 will be treated as having received #08? It doesn't seem likely that it would store 3 decimal RGB values in the .nif when it can just store one hex value though, so the game should be fine, I would think...)
     
  15. tesb

    tesb Emperor

    Joined:
    Jan 16, 2010
    Messages:
    1,593
    i am writing a little autohotkey sript to reduce the time for needless key strokes, but i have one question:

    what is the hotkey to go from vertex color mode to object mode?
    when i am going from object mode to vertex color mode and hit tab it brings me to the edit mode and not back to the object mode. if i hit tab again while in edit mode it brings me back to object mode. very annoying. i searched for blender hotkey lists but could not find any reference on how to go directly to the object mode and not edit mode.


    edit: got it it is: v
     
  16. tesb

    tesb Emperor

    Joined:
    Jan 16, 2010
    Messages:
    1,593
    if anyone is interested in the autohokey script:
    Spoiler :
    Code:
    #IfWinActive, Blender ahk_class GHOST_WindowClass
    Enter::
    MouseMove, 700, 700
    Sleep 50
    Send {Enter}
    Sleep 50
    Send +k
    Sleep 50
    Send v
    return
    
    x::
    Send +d
    Sleep 50
    MouseClick, left
    Send v
    Sleep 50
    MouseClick, left, 1050, 990
    Sleep 50
    MouseClick, left, 1266, 810
    Sleep 50
    MouseClick, left, 1266, 810
    Sleep 50
    Send {Delete}
    Sleep 50
    Send {Delete}
    return
    


    How to use:
    1) You have to have your tileable feature into separate objects, for example if you have some different trees that you want to turn into a tileable feature each tree must be its own object.

    2) select one tree in object mode and press 'x' on your keyboard. what happens:
    • the object gets copied
    • switches to vertex paint mode
    • clicks on color value box
    • clicks into the first position of the hexfield box twice
    • deletes the first two entries
    you will most likely have to change the coordinates in the script, to fit your resolution and blender setup. you can easily get coordinates with windows Spy which is included into Autohotkey.

    3)
    simply enter the hex color value for the object (for example 01) and press enter. what happens:
    • the mouse will move onto the normal 3d view (again you might have to adjust to your blender setup and monitor resolution)
    • the value in the hex field is confirmed
    • the value is applied to the object
    • switches back to object mode

    in short:
    1) select your object and press x
    2) enter the hex value for the red channel and press enter
    3) move to object to the correct position
    rinse and repeat
     
  17. Hydromancerx

    Hydromancerx C2C Modder

    Joined:
    Feb 27, 2008
    Messages:
    16,281
    Location:
    California, USA
    I made the Bamboo, along with the Kelp (not sea grass which is from Planetfall). I also made a new Coral Reef in C2C too. And converted the Mangroves from ZT2 to civ4. Just in case you wondered on credits.
     

Share This Page