washington, dc 2005 brickfest 2005 is a production of amh events llc, all rights reserved. basic...

24
BrickFest 2005 is a production of AMH Events LLC, all rights reserved. Washington, DC 2005 Basic Parts Authoring in LDraw • Getting started on the path to create you own parts for the LDraw library By Orion Pobursky

Upload: adeline-gambell

Post on 14-Dec-2015

220 views

Category:

Documents


0 download

TRANSCRIPT

  • Slide 1

Washington, DC 2005 BrickFest 2005 is a production of AMH Events LLC, all rights reserved. Basic Parts Authoring in LDraw Getting started on the path to create you own parts for the LDraw library By Orion Pobursky Slide 2 Washington, DC 2005 BrickFest 2005 is a production of AMH Events LLC, all rights reserved. Why Make Parts? Not all LEGO parts are modeled in the official library Custom part designs Basic CAD objects Slide 3 Washington, DC 2005 BrickFest 2005 is a production of AMH Events LLC, all rights reserved. What do you need? An LDraw compatible 3D viewer LDView L3Lab An LDraw code editor LDraw Design Pad (LDDP) LDraw Add On (LDAO) MLCad Notepad Slide 4 Washington, DC 2005 BrickFest 2005 is a production of AMH Events LLC, all rights reserved. Part Dimensions LDraw part are measured in LDraw Units (LDU) 1 brick width/depth = 20 LDU 1 brick height = 24 LDU 1 stud width = 12 LDU Real Life Conversion 1 LDU = 1/64 in 1 LDU =.397 mm Slide 5 Washington, DC 2005 BrickFest 2005 is a production of AMH Events LLC, all rights reserved. Plan Your Process Analyze the Part Graph paper helps Take Measurements Two Techniques Comparison to other parts Calipers or Ruler Generally speaking, features less than 1 LDU need not be modeled Slide 6 Washington, DC 2005 BrickFest 2005 is a production of AMH Events LLC, all rights reserved. The LDraw File Format All LDraw files are text based Every line of the file is one command The type of command for each line is determined by the first number the appears on each line There are 5 different types of commands or linetypes Slide 7 Washington, DC 2005 BrickFest 2005 is a production of AMH Events LLC, all rights reserved. Linetype 0: The Comment Form: 0 // can be any length Additionally, Linetype 0 is used for any meta-commands. These commands essentially tell the LDraw program to do some non-drawing action. For those with a programming background, these meta-commands are essentially like pre-processor directives While there a few official meta-commands, there are many unofficial ones as these are added by program authors to suit their needs. For example, LPub uses many of these custom meta- commands to allow the user to dictate page layout. Slide 8 Washington, DC 2005 BrickFest 2005 is a production of AMH Events LLC, all rights reserved. Linetype 1: The Subfile Form: 1 x y z a b c d e f g h i is the LDraw color number x y z is the part position a I is a standard 3D transformation matrix is the referenced file Most model are completely Linetype 1. Also used in part files for primitive and subpart references Slide 9 Washington, DC 2005 BrickFest 2005 is a production of AMH Events LLC, all rights reserved. Linetypes 2 and 3: The Line and Triangle Linetype 2 Form: 2 x1 y1 z1 x2 y2 z2 Most linetype 2s are color 24 (edge color) Linetype 3 Form: 3 x1 y1 z1 x2 y2 z2 x2 y2 z2 x1 y1 z1 x2 y2 z2 x3 y3 z3 x1 y1 z1 Slide 10 Washington, DC 2005 BrickFest 2005 is a production of AMH Events LLC, all rights reserved. Linetype 4: The Quad Form: 4 x1 y1 z1 x2 y2 z2 x2 y2 z2 x4 y4 z4 Be aware of coordinate order Avoid concave quads: Bad This is what is called a bowtie quad Good 12 34 12 34 x2 y2 z2 x3 y3 z3 x1 y1 z1 x4 y4 z4 Slide 11 Washington, DC 2005 BrickFest 2005 is a production of AMH Events LLC, all rights reserved. Linetype 5: The Optional Line Form: 5 x1 y1 z1 x2 y2 z2 x2 y2 z2 x4 y4 z4 is the LDraw color number x1 y1 z1 is the position of the 1 st point of the line x2 y2 z2 is the position of the 2 nd point of the line x3 y3 z3 is the position of the 1 st control point x4 y4 z4 is the position of the 2 nd control point Used to highlight the curvature of rounded aspects of the part Since Lintype 5s are used on surfaces that are rounded, programs can use them to implement smooth curves. Linetype 5 is by far the least understood linetype and is best explained with an example Slide 12 Washington, DC 2005 BrickFest 2005 is a production of AMH Events LLC, all rights reserved. Linetype 5: The Optional Line (cont.) The LDraw program defines a line between the first two points. If the projections of the two control points onto the screen are on the same side of the projection of the defined line then the line is drawn, otherwise it is not Say we have an optional line from 1 to the bottom of the cylinder. In this case the control points should be set at 8 and 2. Since points 8 and 2 are not on the same side of the line below 1 the line is not drawn Now say we have an optional line from 2 to the bottom of the cylinder. In this case the control points should be set at 1 and 2. Since 1 and 3 are on the same side of the line below 2 the line is drawn 1 2 3 4 5 6 7 8 Slide 13 Washington, DC 2005 BrickFest 2005 is a production of AMH Events LLC, all rights reserved. Color Definition All colors are represented by a number The RGB values and other characteristics of official colors are defined in a special file in the LDRAW directory name ldconfig.dat Two color numbers (16,24) are reserved for special functions This method of defining colors was recently adopted and currently LDView is the only widely used program to implement support The legacy method is still the most widely supported format Slide 14 Washington, DC 2005 BrickFest 2005 is a production of AMH Events LLC, all rights reserved. Legacy Color Definition Color RGB values are hard coded and defined by a number. There are 16 basic official colors (0-15) Transparent colors are limited to transparent versions of the solid colors. (Original Color #) + 32 Extended colors (256 511) are defined by dithering two of the official colors. (Color 1) * 16 + (Color 2) + 256 Slide 15 Washington, DC 2005 BrickFest 2005 is a production of AMH Events LLC, all rights reserved. Colors 16 and 24 Color 16 is defined as Main Color This mean that if the part file is referenced by another file, all the color 16 lines are displayed using the color of the line that referenced it. Example: 1 4 0 0 0 1 0 0 0 1 0 0 0 1 part.dat All the color 16 lines in part.dat will be displayed using color 4 (Red) This is what allows one part file to be represented in many different colors in one model file Color 24 is defined as Edge Color This works exactly like color 16, only the display color is the complement color. Using the example above, all the color 24 line will display using the complement to color 4, color 12 (Light Red) The list of complement colors can be found on LDraw.orgs color chart Slide 16 Washington, DC 2005 BrickFest 2005 is a production of AMH Events LLC, all rights reserved. Primitives LDraw primitives are shortcut files for commonly used structures. These are found in the P folder Included in this are: CylindersRingsDisksNegative Disks BoxesTorusStuds Other specialized primitives such as peg holes, axle holes, connect pins are also found in the P folder. Slide 17 Washington, DC 2005 BrickFest 2005 is a production of AMH Events LLC, all rights reserved. Putting it all together Lets examine the code for a 1x2 brick This file has 4 quads, 3 studs, and 2 references to box5.dat Box5 is a primitive found in the P folder: Well examine these lines one group at a time. 1 16 0 4 0 1 0 0 0 -5 0 0 0 1 stud3.dat 1 16 0 24 0 16 0 0 0 -20 0 0 0 6 box5.dat 4 16 20 24 10 16 24 6 -16 24 6 -20 24 10 4 16 -20 24 10 -16 24 6 -16 24 -6 -20 24 -10 4 16 -20 24 -10 -16 24 -6 16 24 -6 20 24 -10 4 16 20 24 -10 16 24 -6 16 24 6 20 24 10 1 16 0 24 0 20 0 0 0 -24 0 0 0 10 box5.dat 1 16 10 0 0 1 0 0 0 1 0 0 0 1 stud.dat 1 16 -10 0 0 1 0 0 0 1 0 0 0 1 stud.dat Slide 18 Washington, DC 2005 BrickFest 2005 is a production of AMH Events LLC, all rights reserved. Putting it all together (cont.) The four quads make the bottom: The first box 5 makes up the inside: 4 16 20 24 10 16 24 6 -16 24 6 -20 24 10 4 16 -20 24 10 -16 24 6 -16 24 -6 -20 24 -10 4 16 -20 24 -10 -16 24 -6 16 24 -6 20 24 -10 4 16 20 24 -10 16 24 -6 16 24 6 20 24 10 1 16 0 24 0 16 0 0 0 -20 0 0 0 6 box5.dat Slide 19 Washington, DC 2005 BrickFest 2005 is a production of AMH Events LLC, all rights reserved. Putting it all together (cont.) The second box5 makes up the outside: The 2 stud.dat add the top studs and the stud3 adds the bottom stud: 1 16 0 24 0 20 0 0 0 -24 0 0 0 10 box5.dat 1 16 10 0 0 1 0 0 0 1 0 0 0 1 stud.dat 1 16 -10 0 0 1 0 0 0 1 0 0 0 1 stud.dat 1 16 0 4 0 1 0 0 0 -5 0 0 0 1 stud3.dat Slide 20 Washington, DC 2005 BrickFest 2005 is a production of AMH Events LLC, all rights reserved. Additional Topics BFC (Back Face Culling) Winding Standard File specification originally did not define a standard polygon winding. The BFC standard was introduced to uniformly wind the polygons in a parts file. This allows for culling of unseen faces and other functions tied to winding Slide 21 Washington, DC 2005 BrickFest 2005 is a production of AMH Events LLC, all rights reserved. Im Done. What Now? Create a model with you part Make sure it fits as it should Examine you part from all angles and ensure there are no gaps and the lines are in the position Ensure the all the quads/triangle are color 16 and line are color 24 except those that need to be hard coded a certain color (e.g. patterns) Run you part through L3P with the check option set or use LDDPs error check function. Submit your work to LDraw.org The LDraw.org Contributor Agreement Agreement is required if you want to submit your work to LDraw.org for inclusion in the Official Library Basically licenses your part under the Creative Commons Attribution License Slide 22 Washington, DC 2005 BrickFest 2005 is a production of AMH Events LLC, all rights reserved. Additional Topics Additional rules for Official Parts Essentially a more stringent set of rules applied to parts in consideration for the Official Library. Examples include: Proper part file headings Part numbering and pattern codes Actions for L3P check errors Part Origin requirements Slide 23 Washington, DC 2005 BrickFest 2005 is a production of AMH Events LLC, all rights reserved. BFC BFC (Back Face Culling) Winding Standard Most standard 3D rendering engine require uniform winding of polygons The LDraw file specification does not define a standard polygon winding. The BFC standard was introduced to uniformly wind the polygons in a parts file. This allows for, amongst other functions, the culling of unseen polygon which leads to faster rendering times While conforming to the BFC standard is not currently required for Official Library parts, it is highly encouraged. Slide 24 Washington, DC 2005 BrickFest 2005 is a production of AMH Events LLC, all rights reserved. Resources and Conclusion Many resources can be found on LDraw.org. These include a primitive reference, color chart, the LDraw File Specification, and download link for many utilities. Any questions?