span8
span4
span8
span4
Mojang Minecraft is the first true gaming format added to FME.Unlike most other formats and standards made for serious uses by professionals,Minecraft appeals to a much wider,and often younger audience.
Bringing real data into Minecraft allows turning a block-building game into a simple,yet spectacular modelling tool where everyone could try all kinds of natural or urban scenarios.What if the sea level rises or falls by 100 meters?How quickly can a forest fire spread,and what are the consequences?What would happen if a sleeping volcano suddenly erupted?How might a Moai statue fit into a cityscape of our home town?These questions can easily (and in a fun manner) be answered with Minecraft.
FME is an excellent tool for bringing real data of any kind into Minecraft.Vector layers,rasters,point clouds,and 3D models can be transformed,adjusted,and aligned to the required size and position in the Minecraft world.
For FME,a Minecraft world is a regularly spaced point cloud,so the transformation task is essentially a combining of all the necessary sources into such a cloud.Below we go through several examples that show different techniques of making Minecraft worlds.
An important thing to consider at the beginning of the world-making is its desired size.We may want to scale down the source map in order to make the world not too big.Otherwise,walking through such a world could take as much time as it would take in reality.With regard to elevation,we are limited by the range allowed by Minecraft,which goes from altitude 1 to altitude 256.Taking into account that sea level in Minecraft is at altitude 63,we usually want to scale everything,even the highest mountains,to fit into the range between 63 and 256.For bathymetric maps and underground structures (or if we simply want to),of course,we can go below 63,but not below 0.
Minecraft worlds are built from blocks.There are hundreds of block types in the game representing all kinds of stones and ores,water,trees and leaves,flowers,carpets,lava,glass,and so on.Internally these blocks are identified by two components: blockID and blockData.
Below is a table showing Minecraft blocks.The numbers above the blocks represent blockID components,and the smaller indices beside them are blockData components.So,for example,"Grass" has blockID = 2,and no blockData component."Birch Wood Planks" has blockID = 5,and blockData = 2.
Each block has its own properties.When choosing a block,we have to find out whether there are any extra requirements imposed by the block nature.
For example,vegetation blocks such as flowers or saplings will survive only on certain blocks underneath them,such as "Grass" or "Dirt".In FME we can simply copy all the points of the vegetation blocks,elevate them by 1 block,and set the blockID of those remaining on their places to "Grass".
Rail blocks need to know where their neighbor rails are located,otherwise they "won't know" how to orient themselves.This can be set through blockData component and requires some extra analysis with FME.
For some purposes,the real nature of the blocks can be unimportant,and the main role plays their color or look.For example,we may want to create a physical 3D map of the world using traditional colors - dark to light blue for oceans,green through yellow and brown to white for continents:
Minecraft Wiki (http://minecraft.gamepedia.com/Minecraft_Wiki) has a separate article about each block.The latest version of the blockID table can be found here:
http://minecraft.gamepedia.com/Blocks
In FME,there are several ways of setting blockID and blockData.If we already have a point cloud,the PointCloudComponentAdder or PointCloudExpressionEvaluator transformers can set these components directly (see the Easter Island example below).We can create blockID and blockData attributes on vector features with the AttributeCreator transformer.Then,when the vectors are turned into point cloud using the PointCloudCombiner,we should specify these attributes to be preserved as components in the lower section of the transformer's parameters:
For raster features,we have to select the necessary bands with the RasterSelector,set blockID and blockData as band names with the RasterBandNameSetter,and deselect all the bands with the RasterBandSelector.Then,when we combine a raster to a point cloud,these bands will become point cloud components:
See the Bowen Island example for more details.
The Minecraft writer in FME 2015.0 writes the worlds using whole chunks that are 16 blocks wide,16 blocks long,and 256 blocks high.This means that if on the edge of our world we don't have a whole chunk,we end up with a hole going all the way down to the bottom of the world.A possible technique to avoid this is to add a few blocks to complete the chunks.
The coordinates of the chunks along X are as follows:
.........................
-32 to -17
-16 to -1
0 to 15
16 to 31
.........................
The coordinates of the chunks along Y are as follows:
.........................
-31 to -16
-15 to 0
1 to 16
17 to 32
.........................
We can buffer the whole world,extract coordinates,round them to divisibles of 16,and make a bounding box around the world as follows:
When we do so,we should turn off the option "Center Point Cloud at 0,0" on the writer in the Navigator pane.
Then we would set the box to the desired Minecraft blockID and handle as all other features that we are going to write to the world.
Here is our simple example.Let's take some data representing this year's FME theme: a raster DEM for Easter Island,and an OBJ file with two Moai statues.
The size of Easter island is about 25 by 15 kilometers,and the highest elevation is above 500 meters.This means we need to make the island smaller to bring it to a reasonable size.For this purpose,we removed the original coordinate system from the DEM raster,where each pixel was over 27 meters,and used its pixel coordinates as its own CS.The easiest way to do so is to find the number of rows in the raster with the RasterPropertyExtractor,and then use this number in the RasterGeoreferencer:
We also made the elevation range 10 times smaller with the RasterExpressionEvaluator,so the highest hill goes up to 50 meters.The downloadable example includes the modified raster,so these steps aren't required,but it is useful to know them.
Once the DEM is read by FME,we extract the vector coastline from it with the RasterExtentsCoercer and generalize it - we will need this feature for statue orientation.The DEM raster itself is raised by 63 with the RasterExpressionEvaluator to set the proper Minecraft sea level.
The 3D model contains only two statues,but we would like to place them several times around the island.For that,we created a CSV file with XY coordinates of the locations where we would like to see our statues.Once the model is brought to FME,we add it to the library of shared items (SharedItemAdder transformer added in FME 2015) and then use the model for initiating the CSV reading with the FeatureReader transformer.Once the statue locations are brought into FME,we drape them onto the surface using the DEM.This adds the third coordinate (Z) to the locations.Then we use the NeighborFinder for finding the closest segment of the coastline to each location point.The points get the angle to that segment of the coastline.After that,we replace the points with models (SharedItemIDSetter,also new in FME 2015) and rotate them.
Now we have the DEM raster ready and the statues placed all around the island,and we can turn them into point clouds with two separate PointCloudCombiners.For each point cloud,we set the blockID and,in some cases,blockData components:
For "Tall Grass" (blockID = 31,blockData = 1),we don't forget to raise these blocks by 1 and add "Podzol" blocks (blockID = 3,blockData = 2) underneath.
The last step before saving the world is combining all the point clouds into a single point cloud.The result saved as a Minecraft world can look as follows:
Please note that opening a world for the first time can take a while,so please be patient.Minecraft should go through all blocks and add some extra information to them.
Download the example.
Download the world only.
Surprisingly,"normal" (i.e.irregularly spaced) point clouds aren't that good for direct writing to Minecraft.If the density of a point cloud is not high enough for the chosen resolution,the writer will produce an output with holes in the surface going to the bottom of the world,and we definitely don't want Steve to fall through these holes.
A possible solution that creates a smooth continuous surface is rasterization of the point clouds (and other features if necessary - see the Bowen Island example) and converting them into a point cloud again.The following example takes a LAS dataset downloaded using the Norwegian Mapping Authority demo web service (http://kartverket.no/en/Kart/Gratis-kartdata/Open-and-Free-geospatial-data-from-Norway/).
Since the source point cloud contains ground and vegetation classes (class 2 and class 5,respectively),we can split it and process each part separately.
The ground points will serve as a source for the RasterDEMGenerator.We also will use them for making a vector outline of the island (PointCloudCoercer->HullReplacer).This will allow clipping the generated raster to the shape of the island,so the rest can be filled with water.
With the vegetation point cloud,we perform a similar operation to get the vector areas that represent forest.After clipping the island with the forest,we get open areas,where we will plant flowers.
At this stage we are ready to transform everything into point clouds and set components (PointCloudCombiner,and PointCloudExpressionEvaluator or PointCloudComponentSetter,respectively).We also need to add the elevations to the point cloud made from forest areas.For that,we round up X and Y coordinates of both the point cloud made from DEM,and the point cloud made from the forest polygons,and use the PointCloudMerger (new in FME 2015) to transfer the Z component to forest points.
Again,one more important step when dealing with vegetation is adding a block type that supports vegetation under all plants.These types are "Grass" (blockID = 2),"Dirt" (blockID = 3,blockData = 0 or 1),and "Podzol" (block ID = 3,blockData = 2).In our 亚搏在线workflow,we covered all island surface with Grass blocks,so we only have to elevate all trees and flowers by one block with the PointCloudExpressionEvaluator (@Component(z)+1).
In this 亚搏在线workflow,we use a natural way of growing trees: we plant saplings (blockID = 6) of different kinds (blockData is randomly generated between 0 and 5) and they slowly grow into adult trees of different sizes and shapes.
We also need to randomly thin the forest point clouds because we don't want to plant a tree on every block - that would make a really dense impassable forest.Unfortunately,FME 2015 does not have a random number generator within PointCloudExpressionEvaluator.Instead,we use an expression that produces a more-or-less random result while calculating a number between 0 and 9.The trees will be planted on the blocks where the result of the expression is equal to 1:
@floor(@sin((@Component(x))*@Component(y)/1000-@floor(@sin(@Component(x))*@Component(y)/1000))*10)==1
Similar expressions are used for generating tree and flower types.
When we open the world first time,the scene looks as follows:
After one Minecraft day,which is about 20 minutes long,the landscape changes to this:
As we can see,a lot of trees have grown in 24 Minecraft hours.Closer inspection also reveals all kinds of animals - as well as other,not always friendly,creatures.
Download the example.
Download the world only.
An abundance of vector data in today's world suggests that it will be one of the most popular data sources for making Minecraft worlds.In this example,we will use several vector layers and a single raster DEM.
Bowen Islandis a small and beautiful island near Vancouver.For this island,we have an elevation data in the form of a raster in CDED format,Esri Shapefiles of hydrography and roads,and forest polygons in MapInfo TAB.
In this example,we will rasterize all the vector layers before going to the final point cloud.FME is a perfect tool for manipulating rasters and turning them into point clouds.This is why the rasterization approach can be quite useful in many situations.
Here is how it works: each pixel of the raster entering the PointCloudCombiner is turned into a point.The Band 0 is used for setting the elevation of each point;color bands,if present,will become color components;all other bands also are turned into components;and if the bands have names,they will be used as component names.So,for example,if band 1 was called blockID and band 2 was called blockData,they will become blockID and blockData components,respectively.
Before rasterization,we perform some operations on vector data.We buffer all linear features: residential and collector roads,and streams.Then we use all the buffers for clipping the island so there are no overlapping polygons in the dataset.These steps guarantee that when we make a single point cloud,all features get enough space and don't "fight" for the same location.
In this workspace,we assign the blockID and blockData attribute through a custom transformer called the MinecraftStyler.It lists all the block types available in Minecraft and makes it easier to pick the right block.It also allows adding a vertical offset,which may be needed for some blocks such as vegetation,as we already know.
Another custom transformer takes care of rasterizing incoming features and making the point cloud.The 3DForcer and NumericRasterizers make separate rasters for blockID,blockData,and vertical offset.As you can see,we are not limited to the bands that eventually will be used by the Minecraft writer - we can have as many intermediate auxiliary bands as we need.The RasterExpressionEvaluators allows combining all the rasters into a single image,where Band 0 is reserved for Z,Band 1 is blockID,Band 2 is blockData,and Band 3 is _vertical_offset.In the image,we assign the band names and turn everything into a point cloud.The PointCloudOnRasterComponentSetter allows transferring the Z value from the DEM to the points.
Here is the output of the translation:
For comparison,here is how the same area looks in Google Earth:
Download the example.
Download the world only.
Minecraft can serve as a very simple and interactive viewer for BIM data.We can easily transform an IFC or Revit models to a Minecraft world and go for a walk around and inside the building,climb up the stairs,look out the window,then spread our wings and take to the sky.
Download the example.
Download the world only.
We already know about the blocks that require some additional processing for proper functioning - e.g.vegetation blocks need certain types of blocks placed below them.Some blocks need to know how to connect to the similar blocks adjacent to them - for example,stairs,fences,rails,and many others.
In this example,we will try to convert Vancouver Skytrain (the light rail system) data from an Esri Shapefile to Minecraft.If we simply take Skytrain lines and turn them into rail blocks,none of them will know how to connect to their neighbors,and all rails will go from North to South even if the line goes from East to West.This is caused by the difference between "normal" block placing in Minecraft,when the blocks "get acquainted" with the surroundings and can make an educated decision about their proper placement,and writing all blocks at once.
The orientation of therail blocksis coded with the blockData component as follows:
ValueDescription0Straight rail connecting to the north and south.1Straight rail connecting to the east and west.2Sloped rail ascending to the east.3Sloped rail ascending to the west.4Sloped rail ascending to the north.5Sloped rail ascending to the south.6Curved rail connecting to the south and east.7Curved rail connecting to the south and west.8Curved rail connecting to the north and west.9Curved rail connecting to the north and east
In order to find how to properly orient each rail block,we take the following steps.First,we replace the nice smooth feature with rounded-up zigzagy-looking line,chop the zigzag into single points,and build squares from each point.Then,with the SpatialRelator,we analyse where the neighbors for each square are - we check the existence of the neighbors on the North and South sides as well as to the East and West sides.在此基础上,and using a complicated condition,we create an attribute:
Finally,we replace the squares with the points,which can be turned into the final point cloud.The illustration below shows how the original line changes during the transformation:
Placing rails on the slopes can be done in a similar way,although would require much more analysis.
Rail crossings can be difficult to deal with in FME.Once the world is created,it makes sense to manually check and correct them.SeeMinecraft wikifor more details.
The output is a world with some railways,which are fun to travel:
Download the example.
Download the world only.
This simple workspace makes a world with two identical mazes within it.It is a game within a game - in a multiplayer mode,the participants can try to beat each other in finding the quickest way from the entrance to the exit.
A short Python code generates the maze as text,and with a few transformers,the text is turned into glass walls of the Minecraft world.Let the racers enter the world,and then - ready,set,go!
Download the example.
Download the world only.
FME allows not only writing Minecraft worlds,but also reading them.Once read,the world becomes a simple point cloud with usual XYZ coordinates and two components - blockID and blockData.Within FME,we can manipulate the worlds in many different ways.
For example,we can merge two or more worlds together,or add a new feature to the world - say,place a SketchUp model of your favorite cartoon hero in the center of your town.We can replace existing blocks with some other blocks,turn iron into gold,a block of TNT into a pumpkin.
In our Kartverket example,we filled the space under the surface with glass blocks.It means that if we go under the surface,we will see through the inside of the hill.We can,for example,make a perfect tunnel using the transparency of the glass,and then replace it with the stone.
The regularity of the blocks in Minecraft worlds allows an easy change detection.Using the freshly generated Kartverket world and the same world one day older,we can see what was added in 24 Minecraft hours.FME 2015 has a PointCloudMerger transformer,which can take two point clouds,a Requestor and Supplier,match them by any number of coordinates and/or other components,and output the requestor matches through "Merged" port,no matches through "NotMerged",and for the supplier,we have "Refererenced" and "Unreferenced" ports.The image below shows the FME Data Inspector visualization of the difference between two points in time:
I'm at Iowa State University as Visiting Scholar,although I'm a Phd student from Federal University of Minas Gerais,in Brazil.I'm also part of the Geoprocessing Laboratory of the Architecture School.
The article was useful,the change detection tool will be the core of my experiment using Minecraft.Although,I would like to have more information about how to optimize the analysis process,avoid extra data production.
And,apparently,the way to work with BlockID and BlockData changed a little bit since this article,I'm note sure.
Thanks for the support.
All the best,
Ítalo
Extracting from BIM or AEC models for GIS
Use input points to place 3D COLLADA models in KML
BIM to GIS (Advanced) | IFC LOD 200 to LOD 3 CityGML
MicroStation Text Styles in FME 2015.0 and older
Adding Different Textures to a 3D City Model
Climbing Sydney Harbour Bridge with KMLTourBuilder
© 2019 亚搏在线Safe Software Inc |Legal