Game Development Community

google .kmz questions with official documentation

by david blue · in Game Design and Creative Issues · 10/20/2009 (12:22 pm) · 13 replies

I have been struggling to get my city imported into the program and have been running into problems. working primarily in sketchup for the rendering of the city, i have spent, an entire week customizing a city, only to realize that the textures are not installing properly.

the below is where i think the problem lies, however i would like some clarification on the following comments made in the official documentation

first, is this an example of the material.cs that is necessary for problems with incorrect or no material loading?
(found in official documentation under google sketchup)

cowboy.kmz

+-doc.kml

+-models

| +-cowboy.dae

+-images

+-texture0.jpg

+-texture1.jpg

+-texture2.jpg



<b>this is my key problem. <b>

first i am only using diffuse textures there will be no other texturing in my game, this is because i am trying to keep everything as simple as possible and the few textures that have made it in game look very nice to me so i see no need in making my work harder for me,.

can anyone help me with a tutorial or a step by step guide so i can learn how to do this, or at least upload or save a material.cs so that i can look at it and learn from it?

i am mostly interested in step 2 in this document.

thank you for anyhelp you can provide me with,

here is what can be found in the official documentation that i need assistance with:
Materials are missing/wrong



A major difference between a COLLADA and a DTS model is in the naming of materials. Materials in DTS files are generally named using the diffuse texture filename. For example, a DTS material that uses the texture wood.jpg would be called wood. When the engine loads this model, if there are no script Materials defined that mapTo wood, the engine looks for a JPG, PNG or BMP file with that name in the same directory as the model.





However, in a modeling application, a material usually encompasses much more than just the diffuse texture. When a model is exported to the COLLADA file format, the name of the material in the modeling app is stored in the <material> tag in the COLLADA file.





It is this <material> name that is used by the COLLADA loader as the name of the Material in Torque. If no script Material is defined that maps to this name, the engine will look for a JPG, PNG or BMP texture in the same way. So there are two approaches to get materials to show up correctly for COLLADA models:



1. Name the material in the 3D app the same as the diffuse texture file.


<b>(this is my major problem)<b>
2. Create a materials.cs file in the same directory as the model, and define a script Material object that maps to each COLLADA material. This is the recommended approach.


(many of my buildings have several textures some have 30+ textures so i do not believe step one is feasible for me to attempt step one)

#1
10/21/2009 (3:02 pm)
I think that with T3D 1.0 you can now import models from Sketchup directly without unzipping the *.kmz file. Just put your *.kmz file in /art/shapes/ directory and T3D will recognize the zipped file in the World Editor.
#2
10/22/2009 (11:42 am)
yes that is true, Sorin. However this program only seems to want to identify 2 textures, the diffuse textures and normal textures. if you have a building with several textures it starts getting confused. here is the comments made from google sketchup forum members.

Several renderers need special material organization. It seems that torque also needs some special material organization upon export. A special exporter may need to be developed. You - or another torque developer - may learn something from the external renderer plugins. Some of those plugins are listed through the link.



Many, if not all, external renderers use an exporter plugin. Look at the 'external renderers' section and the 'relevant plugin' sections.

this quite honestly is more than i want to do, i just want to make a game, the company in my opinion as made claims as to the value of the google .kmz exporter without equating or taking into account that the majority of 3d warehouse buildings need more than just the basic textures, i

I may be taking this program of my to buy list as i was only testing it, i do not wish to spend hours trying to develop an exporter as I am not a Torque employee, and only want to create what according to the documentation was something that is drop and use.

wow this is my ONLY complaint but for me it is a major downfall since i require the development of such a big city.

has anybody created a multi textured mesh and put it in. if so can you tell me what you did?

it would be greatly appreciated. i have spent literally 2 weeks designing a city in sketch, please share with me anything you have done. that may aid me.
#3
10/23/2009 (1:42 pm)
this is a copy of an email sent to some helpful members, if you would like for me to send you the files please email me. (all the help i can get would be greatly apprectiated)

Hello, i am emailing you some of my work so that you can take a look at it, and you seem to be very helpful in the forums, also, i noticed that a lot of the people have the potential answers to my problem in private forums so i cannot see what you posted.

here you can see a small section of the city, which i hope will implant in your mind why i really need the .kmz or .dae files to work:
http://s789.photobucket.com/albums/yy173/atmadaenygma/

i am only having one problem. textures. soon i will be removing about 30% of my city and adding some buildings from the 3dwarehouse for sketchup but i really need to get his problem solved as most of these use numerous textures.

i cannot figure out what i am doing wrong, but i think it lies in the material.cs

here are some uploads for you to look at.

i have both saved a .dae and a .kmz for you to review. from my perspective the material.cs looks good but it is not as you can see in the images from photobucket.

i love this program and don't want to give up so soon.

any help you can give me, plus comments posted in the private chats that may spread light on my dilemma would be greatly appreciated.

here are the links i would love to have access to:
http://www.garagegames.com/community/forums/viewthread/96049
http://www.garagegames.com/community/forums/viewthread/90801
http://www.garagegames.com/community/forums/viewthread/95715

thank you very much for any assistance you may provide me with
#4
10/23/2009 (10:30 pm)
I tried, but I still can't figure out why I have blue tops
i226.photobucket.com/albums/dd48/stacalkas/screenshot_002-00001.png
#5
10/24/2009 (9:04 pm)
The answer to your question is easy. The reason that your materials are overlapping has everything to do on how your (clear text) *.dae file was created when it was exported from Sketchup. Since Sketchup uses the same material names in its Collada generation file. So, if you don't manually go into the .dae and make the name changes to the materials to something unique you will always have this issue! Have a great day!
#6
10/26/2009 (2:28 pm)
So, if you don't manually go into the .dae and make the name changes to the materials to something unique you will always have this issue! Have a great day!

HOW? I have attempted to change the names in the material.cs file, is that what you are referring to? if you could please explain this one step at a time or tell me. everything is very sketchy and i cant figure it out

is it better to save the file as a collada file, or a google earth file?

can i just cut and paste the file name to the generation file or do i need the path as well? is the generation file the same as the material.cs?

basically can you explain this as if you were speaking to an elementary student? Telling someone what they are doing wrong and what they need to change is good and all, but it is much better to tell someone HOW to do it, or HOW to change it is much better
#7
10/26/2009 (2:40 pm)
@ Britt - i think the roofs are incorrect because i do not have any roof textures, yet so it may be default. and the images are wrong even thought you appear to have the skyscrapers all textured, i am using a black and white technique with only segments being in color, whereas your buildings are all in color.
#8
10/26/2009 (3:37 pm)
@ David - I changed the textures to color, so I could see easier what textures were getting loaded. I just changed the materials.cs That's why the roofs are wrong.
#9
10/26/2009 (4:21 pm)
@ Britt - really, great. can you send me your material.cs and the files? i would love to compare your material.cs to mine, i think i can troubleshoot my errors
that way, i greatly appreciate your help.
#10
10/26/2009 (5:15 pm)
@ David - Email sent. I did figure out something, I should have already known. When Exporting the .dae file from sketchup it exports a folder in the same directory as the .dae file and in it contains all the textures. The .dae depends upon that folder for loading the textures. Where I was just dropping the textures in the shapes folder without them being in a folder. So, I exported a cube, added it to the scene and it was the same from sketchup. So no messing with the material.cs!
#11
10/27/2009 (11:21 am)
@ Britt - AWESOME, i can't wait to try it after I am done teaching class!! this means i can get on to the next part of my process. Thank you so much for your aid a you have gone beyond the call of duty.

your name will go in the "with much appreciation" section of my credits.
#12
10/27/2009 (11:23 am)
@ Britt - AWESOME, i can't wait to try it after I am done teaching class!! this means i can get on to the next part of my process. Thank you so much for your aid a you have gone beyond the call of duty.

your name will go in the "with much appreciation" section of my credits.
#13
10/28/2009 (11:49 am)
problem solved:

my problem was something that could not be figured out as the problems where not in fact Torque or sketchup as I originally though......for me, they were in photoshop.

1. whenever i edited an image in photoshop, for whatever reason they would not save properly, I do not have the answer as to why.

2. my solution, Britt helped me with his final comment, he had no problems with his file yet i did, so i loaded an unedited .dae file into torque, it loaded perfectly, all the textures where perfectly linked and everything. i did this 4 times all 4 times perfect with different imagaes.

3. i then edited the exact same .skp file, and saved it under a different name and exported it via .dae. loaded it into torque..... terrible it showed 1 or 2 textures the rest of the image black. which was my complaint.

4. i then looked at the material selector in torque and noticed that my edited files where always garbled.

5. however the folder containing the files where perfect no errors.

SOLUTION

6. I took the textures from my edited folder cut and pasted them directly over the original texture folder, restarted torque and they all loaded perfectly with the edited textures in place of the originals.

they loaded because the textures had the exact same name, and it was the exact number of textures since all i did was alter them in photoshop.

well this dilemma is over, I wish to thank Britt for his patience and helping me with this. and all the others who posted here with comments.