SketchUp Observations:

I had some trouble finding information about using SketchUp with Panda3D. So I decided to put some of my discoveries up here.

(I am new around here so please let me know if any of this information is inaccurate or otherwise worthless)

Components:
In SketchUp items can be made into components. While these are useful, when you export to DAE and then use dae2egg these items turn up missing. To fix this I made sure to “explode” everything before exporting. To explode the components, you select the component (or everything ctrl+a) right click the selected and choose explode, repeat until the explode option is unavailable. I found that many items downloaded from the Google 3D Warehouse required this.

Hidden Items:
This might seem intuitive but I found that hidden items are not exported to DAE so if you hide most of your model, to create collision geometry for example, the hidden parts will not export.

Scale:
While SketchUp has templates for meters and feet it appears that it likes inches. Any models I made using the meters or feet templates still had their values converted to inches and rounded. So creating a 10m x 10m plane actually results in 393.7007unit x 393.7007unit plane when you examine the .egg file.

This can be handled by using the -ui (units in) and -uo (units out) flags with dae2egg.

dae2egg -ui in -uo m -o model.egg model.dae

Would convert the file back into meters for use in panda. (thanks to drwr for this info)

[size=75]Old: The best way I found to work with this is: to model items in feet, use .1 scale in Panda3D and know that 10’ in SketchUp = 12 units in Panda.

You could also model stuff in feet and scale it to .08333… and that would make 1’ in SketchUp = 1 unit in Panda (not sure if rounding would make models placed against one another to intersect slightly).[/size]

Collision: (Roaming Ralph friendly)
To use a SketchUp model in the Roaming Ralph example you must add the following around the Geometry you would like to detect collisions with. This can be done by opening the .egg file in a text editor.

<Group> terrain {
     <Collide> { Polyset keep descend }
     (Geometry goes here)
}

If you only need to collision detection with the floor you probably only need to add these lines around a small portion of the code in the .egg file. To find these lines you could find the image of the ground texture you used in the top of the file.

<Texture> ID138 {
  "rockBlock/texture0.jpg"
  <Scalar> type { 2d }
  <Scalar> wrapu { repeat }
  <Scalar> wrapv { repeat }
  <Scalar> envtype { modulate }
  <Scalar> uv-name { UVSET0 }
}

and match it to the geometry that uses that texture ID (ID138 in this example). Unfortunately the texture ID is listed after the geometry so it can be a hassle.

  • Daniel.

To automatically scale the dae file from inches to whatever units you like, you can pass “-ui in -uo ft” (or “-ui in -uo m”) on the dae2egg command line. This means “units-in inches, units-out feet” (or “units-in inches, units-out meters”).

Does the dae format have an internal indication of real-world units? If so, this should be built into dae2egg, and you can omit the “-ui in” part of the options.

David

This is great! I will update my post to with this information.

  • Daniel.