Copyright © 2015 Curt Hill Models and Textures Making your entity interesting.

Slides:



Advertisements
Similar presentations
Drawing In One-Point Perspective
Advertisements

Objects in Alice: Positioning and Moving Them By Jenna Hayes under the direction of Professor Susan Rodger Duke University July
Defining the Viewing Coordinate System
Furnishing 1-Point Perspective Drawings
CSS Layout Crash Course An Advance CSS Tutorial. Inline vs. Block Many HTML elements have a default display setting of Block. Block elements take up the.
Chapter 4: Trees Part II - AVL Tree
One-Dimensional Motion in the Vertical Direction (y – axis) or Freely Falling Bodies Montwood High School Physics R. Casao.
Click here to enter. Click a menu option to view more details Starters Main Courses Desserts Click on the coffee cup to return when Navigating For Vocabulary.
CHOCOLATE MOLD If there is anything missing from this PowerPoint beyond what is acknowledged, please tell Grant Dunbar. Thanks!!!
MODULE THREE SCALES AND DIMENSIONS
SE 313 – Computer Graphics Lecture 14: Armatures Lecturer: Gazihan Alankuş 1.
MECHANICAL DRAWING MULTIVIEW DRAWINGS.
Chapter 23 Mirrors and Lenses.
Google SketchUp Castle
Chapter 7: Vectors and the Geometry of Space
Squares, Square Roots and other radicals.
BG Spider Tutorial. Notes 1. Save A Lot (possibly after each step in case you make any mistakes – THERE IS NO UNDO, and it gets complicated to correct.
Describing Motion: Kinematics in One Dimension AP Physics Chapter 2.
Tutorial for Arrays and Lists By Ruthie Tucker. Description This presentation will cover the basics of using Arrays and Lists in an Alice world This presentation.
Chapter 23 Mirrors and Lenses.
You are going 25 m/s North on I-35. You see a cop parked on the side of the road. What is his velocity related to you. A.25 m/s South B.25 m/s North C.0.
Free-body Diagrams To help us understand why something moves as it does (or why it remains at rest) it is helpful to draw a free-body diagram. The free-body.
Motion and Rotation. 3 Dimensional Space  An Alice object o Is located in a 3D world, positioned at (x, y, z) o has 3 dimensions o height, width, depth.
Copyright © 2009 Curt Hill The Picture Object Getting and displaying.
Characteristics of a Good Perspective
CS 638, Fall 2001 Multi-Pass Rendering The pipeline takes one triangle at a time, so only local information, and pre-computed maps, are available Multi-Pass.
Vectors and the Geometry of Space 9. Three-Dimensional Coordinate Systems 9.1.
Kinematics in One Dimension We will focus today on problem- solving. Note: some problems are hard, some are not so hard. Part of the learning is recognizing.
Copyright © Curt Hill First Window Builder Program Easy GUIs in Eclipse.
Chapter 3 Acceleration Lecture 1
Copyright © Curt Hill Generic Classes Template Classes or Container Classes.
Chapter 36 Image Formation.
Copyright © Curt Hill Visualization of 3D Worlds How are these images described?
Sky Boxes and Vector Math 2 Course Information CVG: Programming 4 My Name: Mark Walsh Website:
Copyright © – Curt Hill Types What they do.
Animation in Minecraft Movement within Movement Copyright © 2015 – Curt Hill.
Sight Words.
Fall 2007ACS-1805 Ron McFadyen1 Chapter 2 Creating Your First Animation (An Introduction to Programming)
Speed Tree Let’s Make a Forest Copyright © 2015 – Curt Hill.
Higher Dimensions. x Let's say we use a pencil to mark a point on paper. x is this point. We pick a direction and move the pencil along this direction.
Copyright © 2015 Curt Hill Building a Simple Level No UnrealScript but several editors.
VECTORS AND THE GEOMETRY OF SPACE 10. VECTORS AND THE GEOMETRY OF SPACE In this chapter, we introduce vectors and coordinate systems for three-dimensional.
Mirror and Reflection.
Copyright © Curt Hill Meshes A Little More to Know.
Recipes How to craft items from others Copyright © 2015 Curt Hill.
Copyright © Curt Hill Common Dialogs Easily Obtaining File Names in DevC++ Windows Programs.
Part 10 Optics --Mirrors and Lenses Chapter 24 Geometric Optics.
Building a Simple Level Player Location among other things Copyright © 2015 Curt Hill.
List 1 List 1 able about above across after again able about
Getting started in Alice
Vectors and the Geometry
Copyright © Cengage Learning. All rights reserved.
Putting Objects in Motion
List 1 List 1 able about above across after again able about
Modeling 101 For the moment assume that all geometry consists of points, lines and faces Line: A segment between two endpoints Face: A planar area bounded.
Copyright © Cengage Learning. All rights reserved.
Copyright © Cengage Learning. All rights reserved.
Forging new generations of engineers
Organizing common actions
Doing things more than once
Vectors and the Geometry
Arrays in Java What, why and how Copyright Curt Hill.
Cubes Orthographic projections One and Two-point Perspective
Sketching Multiview Drawings
Step 1: Get Organized Draw a picture.
Tutorial for Arrays and Lists
Forging new generations of engineers
Sketching Multiview Drawings
Sketching Multiview Drawings
Forging new generations of engineers
Presentation transcript:

Copyright © 2015 Curt Hill Models and Textures Making your entity interesting

Introduction Single cubes are not impressive Rather we wish to build up our entity with a series a various sized cubes to go with the cubist theme We have to be able to: –Size them –Place them –Connect them –Texture them First the coordinate system Copyright © 2015 Curt Hill

Coordinate System You should all be familiar with Cartesian coordinates –X is left right –Y is up down This is not enough for a 3D space We need X, Y, Z –This is the order we always specify them However, it is not the extension we would expect Copyright © 2015 Curt Hill

3D Coordinates In this coordinate system, the Cartesian plane is turned 90° rotating on the Y axis: X comes out of the screen toward us –Positive is moving towards the viewer Y is up-down –Positive is down Z is left-right –Positive moves towards the right Copyright © 2015 Curt Hill

Pixels The units of position, size and other things are always in pixels –Size must be an integer –Position may be fractional, so a float The Minecraft pixel is not the screen pixel A block is a cube 16 pixels on a side If we have a 32 by 32 texture each Minecraft pixel gets four texture pixels Copyright © 2015 Curt Hill

Coordinate Zero In some sense the X and Z zero points are relative –Thus we do not care The Y zero point is 23 pixels above the surface Thus the Y zero is about a block and half above the floor Copyright © 2015 Curt Hill

Coordinate Diagram Copyright © 2015 Curt Hill

Box Creation As we saw in previous presentation the box is created by the addBox method –This is a method of the ModelRenderer object Each box will have an addBox call that sizes and positions it Copyright © 2015 Curt Hill

Unit Cube Copyright © 2015 Curt Hill public class CurtCubeModel extends ModelBase{ public ModelRenderer body; public CurtCubeModel(){ body = new ModelRenderer(this,20,0); body.addBox(0F,0F,0F,1,1,1); body.setRotationPoint(.5F,.5F,.5F); }

The addBox The first three parameters are floats –These are the X, Y, Z positions respectively The second three parameters are integers in pixels –Again X, Y, Z respectively –These determine size The zero Y will make this thing float in the air –Normally it would have legs or some such support Copyright © 2015 Curt Hill

Produces This Copyright © 2015 Curt Hill

Commentary The unit cube is somewhat in front of the back wall and the camera is above it Therefore it looks like it is more like Minecraft pixels from the floor Copyright © 2015 Curt Hill

One More Time What does the setRotationPoint do? Describes the center of the object When the entity turns it rotates around this location By default this becomes 0,0,0 which is a corner We will now drop the cube to the floor Copyright © 2015 Curt Hill

Down To Earth Copyright © 2015 Curt public class CurtCubeModel extends ModelBase{ public ModelRenderer body; public CurtCubeModel(){ body = new ModelRenderer(this, 0, 0); body.addBox(0F,22.5F,0F,1,1,1); body.setRotationPoint(.5F,.5F,.5F); }

Floored Copyright © 2015 Curt Hill

Commentary Since the center is set by setRotationPoint to the cube’s midpoint we must set the Y to 22.5 rather than 23 –Otherwise half the cube is below the floor Typically the main body of an entity is the middle of a cube Appendages usually specify the joint location –That is where we want it to rotate, not the middle Copyright © 2015 Curt Hill

addBox Again The positional parameters define a corner The three integers do not define sizes but distances to travel from the corner –Thus they may also be negative Thus we cannot determine which corner the positions specify until we look If the Y integer is negative then the positions determine a bottom corner Copyright © 2015 Curt Hill

addBox Again We typically want to center the X and Z values and make the Y the height Thus if X size is 8 we often make the X position -4 –The X then varies from -4 to 4 If we do this then the item falls into the middle of its shadow Copyright © 2015 Curt Hill

Interlude Now we can size and place multiple pieces Now we have to connect them The Minecraft method is addChild A child maintains its spatial relationship with the parent as Minecraft moves the parent Copyright © 2015 Curt Hill

Modeling Two common approaches: The first is to just build the thing in Java code The second is to build it with Techne and then import the results into Minecraft – I will do the first –You are free to do either –However, you still need to know the connection thing Copyright © 2015 Curt Hill

Example My example will to make an Emu like entity It will contain a body, two legs, head and neck When that part works we will animate the legs and head Three classes: –CurtEmu –CurtModelEmu –CurtRenderEmu Copyright © 2015 Curt Hill

Process It is easy to mess this up, so you should use an incremental approach Get one thing right, then add the next –Alas, 30 second compiles slow things After modeling is right, animate You may do textures before or after animation I will now abandon the CurtCube and start developing the CurtEmu Copyright © 2015 Curt Hill

Directionality Minecraft must guess as to which end of your entity is front The guess it makes is that it is always facing the negative Z direction Thus for a cow the Z dimension will be larger than the X dimention A crab would be the reverse Copyright © 2015 Curt Hill

Connection We would like several pieces that move as one This is most easily done with the addChild method Each new piece becomes a child of an existing piece Typically start at the most important or bulkiest piece and work outward For the Emu the body is the center Copyright © 2015 Curt Hill

Body Copyright © 2015 Curt Hill public ModelRenderer body; public ModelRenderer leg1; public ModelRenderer leg2; public ModelRenderer neck; public ModelRenderer head; … body = new ModelRenderer(this, 0, 0); body.addBox(-3F,10F,-1.5F,3,-3,6); body.setRotationPoint(0F, 8.5F, 0F);

Observations The body will be 3 by 3 by 6 –The Z is the longest dimension It will be positioned 10 pixels from ground Y size is negative so bottom corner is origin The Y value of 10 puts the body in the air Copyright © 2015 Curt Hill

One more time with addBox The coordinates for children are different than the parent The parent’s position is relative to the coordinate system The child’s position is relative to the parent Of course we cannot tell until we do the addChild Copyright © 2015 Curt Hill

The addChild method Takes only one parameter: parent.addChild(child); See the example in next screen and observe that the new item is relative to the old Copyright © 2015 Curt Hill

Apply the neck Copyright © 2015 Curt Hill body = new ModelRenderer(this, 0, 0); body.addBox(-3F, 10F, -1.5F, 3, -3, 6); body.setRotationPoint(0F, 8.5F, 0F); neck = new ModelRenderer(this, 0, 0); neck.addBox(-2F, 2F, 0F, 1, 5, 1); neck.setRotationPoint(0F, 0F, 0F); body.addChild(neck); Notice the 0F for Y position – relative to the body not the regular coordinate system

The Rest The legs go below and attach to the body –We will not put feet on the legs, but could The head attaches to the neck Thus a child may also have children Copyright © 2015 Curt Hill

Rest of Body Copyright © 2015 Curt Hill head = new ModelRenderer(this, 0, 0); head.addBox(0F, 2F, 0, -1, -1, -3); head.setRotationPoint(-1F, 0F, 1F); neck.addChild(head); leg1 = new ModelRenderer(this, 0, 0); leg1.addBox(-3F, 5F, 0F, 1, 6, 1); leg1.setRotationPoint(0F, 5F, 0F); body.addChild(leg1); leg2 = new ModelRenderer(this, 0, 0); leg2.addBox(-1.0f, 5F, 0F, 1, 6, 1); leg2.setRotationPoint(0F, 5F, 0F); body.addChild(leg2);

Doofuss Bird Copyright © 2015 Curt Hill

Modeling Summary Not an awful lot of science Create your boxes and attach them The addBox, setRotationPoint and addChild are the most important now The rotation point becomes more important as we animate Copyright © 2015 Curt Hill

Rotation Point The animation process works better if the rotation point is properly set relative to the addBox positions I found at least three combinations of addBox, setRotationPoint settings that made the head sit properly on the neck Only one of them allowed proper turning of the head on the neck Copyright © 2015 Curt Hill

Textures Again The textures are not applied in the modeler, but the renderer –CurtModelEmu and CurtRenderEmu respectively Rather there is just one texture and it must be used by all parts –This may have changed before or after 1.7 for I have seen other ways The trick then is to use offsets in a single png file Copyright © 2015 Curt Hill

ModelRenderer The constructor comes in several forms First parameter is always the parent ModelBase –In most of our code that will be this –A self reference One –Second parameter is a string name Other –Second and third are offsets Copyright © 2015 Curt Hill

Three Parameter Signature ModelRenderer( ModelBase m, int xoffset, int yoffset); Example: body = new ModelRenderer( this,300,300); We will see this in the next screens Copyright © 2015 Curt Hill

The Graphic Copyright © 2015 Curt Hill This is a 512 by 512 png file

Textured Copyright © 2015 Curt Hill

Interlude Minecraft only moves the main object It does this based on what it thinks is front It moves in a semi-random motion Now we want to move the legs, when Minecraft moves the whole item We will see this in an animation presentation Copyright © 2015 Curt Hill

Conclusion We construct the structure from rectanguloid boxes –addBox determines size and position –The setRotationPoint determines “center” We connect them with addChild Textures are applied in the renderer Next: On to animation Copyright © 2015 Curt Hill