Resultados 1 al 1 de 1

Tema: Using Auto Masonry script

  1. #1
    Administrador y fundador. Avatar de 3dpoder
    Fecha de ingreso
    Apr 2002
    Gracias (Dadas)
    Gracias (Recibidas)

    Using ‘auto masonry script

    using auto masonry script
    By Paul sponer.

    Using Auto Masonry script-0.jpg

    Ive always liked castles. When i started doing 3d modeling i used a tool called ray dream designer and the first tutorial i did was making a Castle. It was a wimpy Castle with flat, porly textured Walls, no Windows, etc. One thing that has always bugged me is that Castle wall models tend todo be textured planes, perhaps whitewashed with cornerestones modeled. Real castles have every estone showing, uneven rows and estone sizes, etc. The pure texture versión looks god from a distance, but you cant get close todo them without the sham appearing. It a los hard todo knok out a few blocks, or add Siege damage. Ive always dreamed of building a Castle that would stand up to scrutiny, but the tools at hand were insuficiente. I wasnt going todo build it block by block.

    Anyway, y gave up on the dream for a while, moved on todo newer software versións, and eventually switched todo Blender. With the presence of the Python extensión lenguaje my dream resurfaced. If the computer could do the grunt work, then all id have todo do is the overall design and touch up work. Score. I loked around todo se if anyone else had done this already, but i couldnt find anything similar todo what i wanted.

    This confused me, it semed like a simple problem todo solver. More than six hundred lines of code later i discovered why it may not have ben as simple as i expected.
    What follows is my first major foray into Python scripting and the results. A section on how todo use the script comes first, followed by a short history of the coding, and some things i learned in the process. Im not fully satisfied with the script yet, but it is very usable and i hope Will be useful todo Many of you.
    using auto masonry
    Let Jump straight into the fun Stuff shall we? If you dont have it, download the current versión of the script and place it in your scripts Path folder (normally. Blender/.blender/scripts). To start the script, open a scripts window and select scripts>>wizards>>auto masonry. You should se something like this.
    Using Auto Masonry script-1.jpg

    It the default GUI. If you press make this wall. You should end up with something like in figure2.
    Using Auto Masonry script-2.jpg

    If you dont, you may ned todo install Python. If that doesnt work, y may ned todo fix the script. The current incarnation allows you todo make Walls with or without rectangular Windows, dors, and crenellations. The script generates two Mesh objects, a wall and a grout.

    All of the buttons and options have explanatory pop-up text, so fel free todo try it without reading this whole tedious section.

    If youre not feeling quite that bold, here is an explanation of all the options in the GUI.
    Using Auto Masonry script-3.jpg

    • make this wall.: this button generates the wall which Conforms todo the options you have selected. If there is a curve selected, the wall length Will be set todo the curve length, the wall Will deform todo follow the curve, and have the curve as a parent. This means that all of the pos/root/size of the curve Will be applied todo the wall as well. If the curve is closed the script Will assume that it is a perfecto circle. If the curve is not a circle, the wall probably wont be the right length.
    • wall: these settings govern the overall size of the wall in Blender units. The wall height does not include crenels (se crenels, below).
    • straight Edges/offset Edges: basically, if you want todo make a closed loop wall set it todo offset Edges, otherwise straight Edges.
    • Stones: these settings govern the range of the size of the estones. Depth Will a los set the thickness of the wall. The estones may exced these límites at the Edges, todo make everything fit, or due todo the row weight setting. These settings are for the centerline of the grout, so a larger grout w Will reduce the actual size of the estones.
    • bevel: the size of the bevel. If set todo zero the estones Will have square corners, useful for reducing poly-count.
    • grout w: the width of the grout, pretty straight forward.
    • grout d: how far the grout is offset from the face of the estones. This referencias the value min depth so if there is a large range in depth the grout Will be quite far bak on the thicker estones.
    • row weight: this setting governs how much the height of the row afects the width of the estones in that row. Positive values are normal (taller estones, wider estones), but negative values are valid as well (taller estones, narrower estones). I usually set it between 0.0 and 1, depending on the application.
    • dor and window: these settings behave very much the same. Turn on and of a dor or Windows by pushing the big button labeled dor or Windows respectively. Dor position is from the origin todo the centre of the dor. Height and width behave as you would expect. Window spacing Will be centred between the Edges, and the Edges of the dor (if one is present). The top of the Windows Will be at the dor height setting, Even if dors are turned of. This means that dor and window lintels have the same height (generally true in architecture). The angled button toggles an angle along the sides of the dor/window, such as would be present in a Castle arrow slit. Generally, dors do not have angles like this, but i left it as an option, just in case you want it.
    • crenels: the crowning part of the wall, crenels are often sen on Castle Walls. Height, width and spacing work the reverse of Windows, setting the size of the estone portions, not the openings. Crenels are always angled, though ill add an option todo control this in the future.
    • exit: this button fires the masons and lets you do the work yourself. Very useful if you are done creating estone structures just at present.

    The script is rather fast, so you can make very large Walls if you want. I think the wall in figure 3 tok thirty seconds todo generate.

    a few techniques
    Here are a few tricks ive come up with. I suspect ingenious users Will come up with Many more.
    • paths: make a narrow, tall, wall with no Windows, dors, or crenels and set it todo follow a curve on the z axis. It a Path, Street, or cobbl estone highway. Se figure 4

    Using Auto Masonry script-4.jpg

    • support beams: crenels can a los be made todo hold support beams for multi-story Castle towers, Siege defense structures, etc. Se figure 5.

    Using Auto Masonry script-5.jpg

    • multi wall: you can build a wall in múltiple segments. This allows several diferent styles of Windows and dors stacked or strung together. The example for the support beams was actually created by stacking two Walls on top of each other.
    • sub surf: the script automátically sets all edge crease values todo 0.5 which results in a pretty god Subsurf results.
    • texture bake: render the z value of the wall on an isometric view and save it todo a texture. Now you can use this as a Bump channel or texture mask for a Low-poly wall. Using offset Edges and correct clipping allows seamless tiling.
    • múltiple curve deformers: often Walls are tapered or curved. By applying a z-axis curve deformer above the x-axis one, Many wall effects can be achieved. This can a los be used todo make more realistic strets (se the curved profile of the Path example), or cartoonish towers.

    Using Auto Masonry script-6.jpg

    I hope this script allows Many of you todo realice your dreams of realistic castles, brik Walls, roads, textures, towers, and anything else you can do with it. Id be thrilled if youd drop me ha line and let me know what youre using it for. Let me know if you run across any bugs, and ill try todo fix them right away.
    writing the script
    If you are still reading this, you may be interested in how the script was programed. The code is decently well documented, so fel free todo Jump right in and fiddle around with it. Here a Little background on how i wrote it as well as a few lessons i learned. Some of this is just god programming practice, some is specific todo Blender.

    Before i could programa anything i had todo learn Python. In college i tok a computer programming course, and ive done a bit of programming in my spare time, so there was some background todo build on. Essentially, all programming lenguajes are expressions of a lógical progression, and Python is no diferent. I worked th rouge the built in getting started tutorial in Python, wrote a few small applications todo play with features, and got comfortable with the syntax. At this point i started todo ease into Blender Python extensiones. My first Blender script tok a Mesh object and created every posible polygon with the existing vértices. Not todo useful, but rather fun. I a los discovered that you can crash Blender by trying todo make a Mesh object with todo Many Polygons.

    At this stage i was a los examining a lot of the scripts included in Blender. Here are the first two things i learned about programming Python extensiones:
    lesson 1: do your homework. This is true in every aspect of life, and applies here, todo. All the basic Python tutorialesi did were invaluable in seing how todo structure an eficient script. Looking in the forums helped a lot todo. If you put the efort into discovering the right bien todo do things, it Will make your job a whole lot easier later on. Learning Python before learning Blender Python really helped todo kep things straight.
    lesson 2: document your code. This is one of the big estrés points in computer Science, and it is so helpful. If someone else wants todo use parts of your script, they shouldnt have todo reconstruct what every line of code does. If you put the script down for a month or two, you wont remember what anything does, Trust me. I know it a drag. I know it fels pointless. Por favor, oh, por favor, document your code. When looking for examples, documentation helped me out immensely. Once i had done a few mini-scripts in Blender i started on the wall Maker. As the script progressed from making plain squares of wall todo complex Walls with dors, Windows, and edge features, y noticed a few other things: lesson 3: programming Python extensiones is not as hard as it sounds. The extensión framework in Blender includes some very advanced tools which makes programing extensiones rather elementary. If you have an idea for a script, and have any confidence at all in your programming skills, give it a shot.
    lesson 3 corollary: but it harder than you think. Be prepared for frustrations. Even though it nice, the Python- Blender integration is far from perfecto. The lógical bien of doing things is often (but discouragingly, not always) how it Will work. Be prepared todo persevere th rouge the tough spots. While working on the script i had thre other Windows open.

    The Python scripting reference (accesible from inside Blender in the help menú), the Python Package help menú, and the scripting forum. These thre, with Lots of persistence, should guide you th rouge your seasons of scripting woes. As the script progressed from simple todo complex, y found myself discovering that my original architecture was insuficiente or highly ineficient for what i was trying todo do. I think i re-wrote every function at least once from the Ground up. Initially i was using the bevel center script todo do the beveling, but i had todo re-code parts of it todo make it work from an outside call (which would require downloading an altered versión of bevel center along with auto masonry) and it was very Slow. In the end i bit the bullet and re-coded my basic block function todo include beveling. At the beginning of the Project i had a free form approach, which i abandonar After working a few days on it. Here the fourth lesson:
    lesson 4: be willing todo re-think your approach. Even if it means starting over. Every so often step bak and say todo yourself, does it make sense todo do it this way, or is there a better way? If you want a god script, always opt for the better way. Sometimes it wont do quite what you had in mind, but that better than it not doing anything at all.

    I still have Lots of features in mind for future development. Im a los Thinking that i Will have todo re-write a lot of the structure when i get bak todo the Project (in line with lesson 4). However, once the script was mostly finished, it was time for:
    the GUI. writing the GUI can be the most fun or most heartbreaquíng part of the process, depending on how well you have managed your variables. If you have nicely written functions and variable management, the GUI should be pretty straightforward. Writing a GUI in Blender is pretty easy, and really finishes of the script. On the other hand, dont fel compelled todo include every característica in the GUI if it isnt well supported, or reliable. There are several features in auto masonry which are almost functional in the code, but not in the GUI. If your code is well documented then code-heads Will be able todo use these features anyhow, and not including them in the GUI helps reduce headaches for entry-level users.

    Future improvements

    Id like todo improve this script in several directions. Unfortunately, my time is absorbed with other projects right now. Here are a few of the things id like todo add. If you have ideas for other features por favor let me know:
    arches: right now Windows and dors are flat topped. Id like todo add both round and pointed arches. This Will require significant re-coding of the basic architecture of the script, but i think it Will be worth it.
    flaws: not all estones are perfecto. Some estones should have missing corners, or Even cracks. An early versión (while using bevel center) was able todo knok of corners, but i havent added that característica since converting todo an internal beveling Scheme. Adding cracks would be Even more dificult, but im sure it is posible.
    right now the grout is Simply a second set of blocks behind the estones. On curved surfaces this creates problems with the grout, which subsurfing helps, but doesnt fix.

    A true estone grouting algorithm would a los require a major overhaul of the code, but would a los create a much better finished product, and would allow beveled grout.
    more robust window and dor placement: right now the GUI for the window and dor placement is rather limited. The script itself can accept any configuration of window and dor placement, but i couldnt figure out how todo Simply implement the user interfaz. If there is a god bien of doing this, Will someone let me know?
    persistent settings: the ability todo save settings todo a file would make it easier todo tweak settings. It would a los allow the creation of múltiple Walls with offset Edges that Will Mesh with one-another, or angled corners with interlocking Edges. Unfortunately, this would a los require a similar code overhaul.

    So básically, when i am feeling up to another few weks of programming, ill rewrite the script todo be better than ever. When i do, y Will try todo include any característica requests i receive in the meantime. Alternativaly, if someone else is feeling bold, y encourage you todo make changes todo the script yourself. Id be happy todo learn of all the improvements that can be made, and im sure there are Many.

    I hope this script allows Many of you todo realice your dreams of realistic castles, brik Walls, roads, textures, towers, and anything else you can do with it. Id be thrilled if youd drop me ha line and let me know what youre using it for. Let me know if you run across any bugs, and ill try todo fix them right away.

    By Paul sponer.
    Miniaturas adjuntas Miniaturas adjuntas Using Auto Masonry script-0.jpg   Using Auto Masonry script-1.jpg   Using Auto Masonry script-2.jpg   Using Auto Masonry script-3.jpg   Using Auto Masonry script-4.jpg   Using Auto Masonry script-5.jpg  

    Using Auto Masonry script-6.jpg  
    Si tienes activado Adblock o alguno similar en este sitio, te estás perdiendo muchas cosas interesantes. Puedes desactivarlo para como te muestro en este enlace

    |Agradecer cuando alguien te ayuda es de ser agradecido|

Temas similares

  1. Respuestas: 2
    : 07-05-2015, 23:08
  2. Maya Script para pesado automático auto-weights Maya
    Por sloz77 en el foro Programación y Scripts
    Respuestas: 3
    : 02-09-2012, 07:55
  3. Como borrar un auto-load script
    Por Biofix en el foro Programación y Scripts
    Respuestas: 4
    : 14-09-2010, 17:05
  4. Auto
    Por darkmind52 en el foro Trabajos en Proceso
    Respuestas: 3
    : 20-02-2007, 03:25
  5. Auto Cad 3d a 2d
    Por ben90 en el foro Programas de Diseño gráfico y CAD
    Respuestas: 3
    : 24-02-2006, 18:27