Author Topic: Kitchen Project  (Read 9513 times)

There were too many vertices for a straight export.  So I used decimate to reduce the number of vertices.



oops.
« Last Edit: April 19, 2017, 07:59:06 PM by Tendon »

oh stuff

you shoul djust break it up into multiple .dts files and place the sections with code?

also whatever you're using to import and convert map interiorobjects into blender files, please post that.

It basically goes torque game editor v1 to dae to Maya to fbx to blender.  I'll post more details after dinner.

EcstaticEggplant gave me the info on getting it to dae.

Very nice!
How well does collision work with map so far?

You'll need 2 pieces of software, and an interior w/it's related files.

Torque3D v1: https://github.com/GarageGames/Torque3D/releases/tag/v1
Maya LT: http://www.autodesk.com/products/maya-lt/free-trial

Unzip Torque3D
Exec Torque3D.exe
Click New Project
Click Template > Empty
Click Create
Minimize Torque3D
Move [interiorname].dif and it's resources to Torque3D-1\My Projects\New Project\game\art\shapes\
Maximize Torque3D
Click "Play Game"
Click "Play"
Click "Go"
Hit F11 on the keyboard
On the right side of the screen, click "Library", then click "Meshes", then double-click "art", then double-click "shapes", then double-click [interiorname]
You should see it pop up in the game, you may have to hold right-click and look at the ground before double-clicking [interiorname].

On the top left, click "File", then "Export Interiors To COLLADA".
Click your interior, deselect "Export interiors with transforms baked in", and click Export.
Close Torque3D.

Install Maya LT (It's a 30-day trial)
Open Maya LT
Click File > Import
On the bottom of the menu, change "Files of type:" to "DAE_FBX"
Navigate to [filepath]\Torque3D-1\My Projects\New Project\game\art\shapes\
Click [interiorname].dae
Your interior should appear.
You can rotate, pan, and zoom with Alt+LeftClick, Alt+MiddleClick, and Alt+RightClick.
You can also use the scroll wheel to zoom.
Click File > Export All
Navigate to [filepath]\Torque3D-1\My Projects\New Project\game\art\shapes\
Change "Files of type:" to FBX export
On the options pane to the right, go to File Type Specific Options > Advanced Options > FBX File Format and change "Version:" to "FBX 2014/2015"
Change "File name:" to "[filename].fbx"
Click "Export All"
Close Maya LT

Open Blender and import [filename].fbx from [filepath]\Torque3D-1\My Projects\New Project\game\art\shapes\

Alternatively, in Maya, while exporting, you can also select File Type Specific Options > Include > Embed Media > Embed Media
If you do that, you can put the fbx file wherever you want.
But I think it'd better to keep the fbx file with it's resources.  You'll need them if you plan on turning it into a .dts.

All of the pictures on the fridge are flipped upside down.  I wish I knew why.  A workaround is to just flip all of the the texture files upside down w/paint.

Very nice!
How well does collision work with map so far?
doesn't.

I mean uh- it's a work in progress.  The detail32 layer (the visible part) can pretty much just be exported directly.  And that's all I've tried so far.

For the collision I plan to write a mass export script which both exports each collision object seperately, and writes a blockland script to place them ingame.
I figured out all of the technical stuff for that while doing Map_DMBOXA, and Server_ModTerCollision.
And for making the collision shapes in blender, it's as simple as selecting a cloud of vertices and clicking Mesh > Vertices > Convex Hull
It just like- makes a convex shape.  Boom.

I don't think I'll do kitchen r/n.  It's too complex to start with.
Did you know the tutorial map in v1 only has 8 rooms?  No eventing, no tutorial on how to use the wrench at all.  Just looking, moving, jumping, ducking, building, hammering, jetting, and using the light.

All of the pictures on the fridge are flipped upside down.  I wish I knew why.  A workaround is to just flip all of the the texture files upside down w/paint.
doesn't.
UV mesh was probably distorted in the transition, or certain faces were flipped/reversed

Couldn't you just import the Collada file in Blender, and that way skip 2 formats?

Yeah, i think going through multiple file types like that is what kills the UV mapping, different programs export file types with differing formatting and import those file types differently, so things tend to get lost in transition, textures, UV mapping, normals, smoothing groups, etc

So the less file types you deal with, the better

unrelated but are you trying to port kitchen to static maps or something? i'm just curious

Couldn't you just import the Collada file in Blender, and that way skip 2 formats?
Blender screws up the import.  Deleting everything between the <diffuse> tags (as suggested on an online forum) allows blender to import it, but none of the textures are imported.  I looked at the content between the diffuse tags, and saw it mention "MAYA".  So I installed Maya LT and it was able to import the file with the textures intact.

unrelated but are you trying to port kitchen to static maps or something? i'm just curious
Dunno if I'll finish, but stuff is going in that direction, yes.

Blender screws up the import.  Deleting everything between the <diffuse> tags (as suggested on an online forum) allows blender to import it, but none of the textures are imported.
I went through the exact same process and ended up using an old version of blender with an older collada importer. This crashed when I tried to import it, so after reading the console errors I had to change the date format (yes a wrong date format crashed the importer) and then remove the diffuse tags. This imported textures, but they were all over the place, some not even assigned at all.

I think maya is definitely the way to go here, never noticed that in the file.

Edit: fun fact about the kitchen, the stove tops were separate static shapes from the actual map like the clocks. Maybe Badspot had planned to make them interactive? :0
« Last Edit: March 30, 2017, 09:26:58 AM by EcstaticEggplant »



It's getting better.  I seperated a bunch of the internal stuff from the rest of the kitchen, and it reduced the glitchyness.  There are a TON of vertices in the cabinets, I think there are just too many for it to export correctly r/n.
There is more splitting to be done.

I wrote an mass exporting script for python.  It uses an old version of port's dts exporter which I modified to export selection only.
Port's exporter has that option baked in now, but I just haven't bothered to update yet.

Code: (export.py) [Select]
import bpy
import os

def dodtloveports(exportpath,blpath):
#setup script files
if os.path.exists(exportpath + 'server.cs') == False:
textserver = open(exportpath + 'server.cs', "w")
textserver.write("exec(\"./data.cs\");")
textserver.close()
if os.path.exists(exportpath + 'description.txt') == False:
textdesc = open(exportpath + 'description.txt', "w")
textdesc.write("Title: MAPNAME")
textdesc.write("Author: NOT AVAILABLE")
textdesc.write("THIS FILE WAS AUTOGENERATED")
textdesc.close()
textdata = open(exportpath + 'data.cs', "w")
textdata.write("package LoadMapPackage\n")
textdata.write("{\n")
textdata.write("\tfunction GameConnection::startLoad(%client)\n")
textdata.write("\t{\n")
textdata.write("\t\tif(!isObject(\"MapGroup\"))\n")
textdata.write("\t\t{\n")
textdata.write("\t\t\texec(\"" + blpath + "place.cs\");\n")
textdata.write("\t\t\tMissionCleanup.add(\"MapGroup\");\n")
textdata.write("\t\t}\n")
textdata.write("\t\tParent::startLoad(%client);\n")
textdata.write("\t}\n")
textdata.write("};\n")
textdata.write("activatepackage(LoadMapPackage);\n\n")
textplace = open(exportpath + 'place.cs', "w")
textplace.write("new SimGroup(MapGroup)\n")
textplace.write("{\n")
#export detail32
if bpy.data.groups.get("detail32") is not None:
objects = bpy.data.groups['detail32'].objects
for object in objects:
bpy.ops.object.select_all(action='DESELECT')
object.select = True
bpy.ops.object.duplicate(linked=False,mode='DUMMY')
dupe = bpy.context.selected_objects[0]
dupe.name = "DETTEMPSHAPE"
bpy.context.scene.objects.active = dupe
bpy.ops.transform.translate(value=dupe.location*-1)
bpy.ops.object.transform_apply(location=True,scale=True,rotation=True)
bpy.ops.export_scene.dts(filepath=exportpath + "shapes\\" + object.name + ".dts")
textdata.write("datablock staticShapeData(SS" + object.name.replace(".","DOT") + "Data)\n")
textdata.write("{\n")
textdata.write("\tshapefile = \"" + blpath + "shapes/" + object.name + ".dts\";\n")
textdata.write("};\n")
textplace.write("\tnew StaticShape(\"SS" + object.name.replace(".","DOT") + "\")\n")
textplace.write("\t{\n")
textplace.write("\t\tposition = \"" + "%.6f" % object.location[0] + " " + "%.6f" % object.location[1] + " " + "%.6f" % object.location[2] + "\";\n")
textplace.write("\t\trotation = \"1 0 0 0\";\n")
textplace.write("\t\tscale = \"1 1 1\";\n")
textplace.write("\t\tdataBlock = \"SS" + object.name.replace(".","DOT") + "Data\";\n")
textplace.write("\t\tcansetIFLS = \"0\";\n")
textplace.write("\t};\n")
bpy.ops.object.delete(use_global=False)
else:
print("detail32 group not found.  No visible meshes to export.")
#export collision-1
if bpy.data.groups.get("Collision-1") is not None:
#create NULL SHAPE for detail32 layer of collision objects.
bpy.ops.object.select_all(action='DESELECT')
scene = bpy.context.scene
me = bpy.data.meshes.new("NULLTEMPSHAPE")
me.vertices.add(1)
nullob = bpy.data.objects.new("NULLTEMPSHAPE", me)
nullob.location = (0,0,0)
nullob.select = True
scene.objects.link(nullob)
scene.objects.active = nullob
scene.update()
if bpy.data.groups.get("detail32") is not None:
bpy.ops.object.group_link(group='detail32')
else:
bpy.ops.object.group_add()
nullob.users_group[0].name = "detail32"
objects = bpy.data.groups['Collision-1'].objects
for object in objects:
if object != nullob:
bpy.ops.object.select_all(action='DESELECT')
object.select = True
bpy.ops.object.duplicate(linked=False,mode='DUMMY')
dupe = bpy.context.selected_objects[0]
dupe.name = "COLTEMPSHAPE"
bpy.context.scene.objects.active = dupe
bpy.ops.transform.translate(value=dupe.location*-1)
bpy.ops.transform.resize(value=(2,2,2))
bpy.ops.object.transform_apply(location=True,scale=True,rotation=True)
nullob.select = True
bpy.ops.export_scene.dts(filepath=exportpath + "shapes\\" + object.name + ".dts")
textdata.write("datablock staticShapeData(SS" + object.name.replace(".","DOT") + "Data)\n")
textdata.write("{\n")
textdata.write("\tshapefile = \"" + blpath + "shapes/" + object.name + ".dts\";\n")
textdata.write("};\n")
textplace.write("\tnew StaticShape(\"SS" + object.name.replace(".","DOT") + "\")\n")
textplace.write("\t{\n")
textplace.write("\t\tposition = \"" + "%.6f" % object.location[0] + " " + "%.6f" % object.location[1] + " " + "%.6f" % object.location[2] + "\";\n")
textplace.write("\t\trotation = \"1 0 0 0\";\n")
textplace.write("\t\tscale = \"0.5 0.5 0.5\";\n")
textplace.write("\t\tdataBlock = \"SS" + object.name.replace(".","DOT") + "Data\";\n")
textplace.write("\t\tcansetIFLS = \"0\";\n")
textplace.write("\t};\n")
nullob.select = False
bpy.ops.object.delete(use_global=False)
nullob.select = True
bpy.ops.object.delete(use_global=False)
else:
print("Collision-1 group not found. No collision meshes to export.")
#close script files
textdata.close()
textplace.write("};")
textplace.close()

dodtloveports('C:\\Users\\USERNAME\\Documents\\Blockland\\Add-Ons\\Map_Kitchen\\',"Add-Ons/Map_Kitchen/")
Basically it just exports all of the objects in the scene separately, and writes some Blockland scripts and files.  I can just start up a server to test the map as soon as I make a change I want to test.

I got the visible part of the kitchen into Blockland.  No glitchyness aside from the lighting being kinda weird.  Dark in some places, light in others.  And the textures are still flipped.

I've been working on the collision.  So far the closet, rug, ceiling light, hanging shelves, table, and paper towel roll all have collision.  I'm not looking forward to doing the inside of the counter. :c