programming colors in COLLADA

Hi,

i’ve built a mongo COLLADA file (29KB) and it seems asif my ‘effects’ cannot handle the size. When I have a small mesh, the colors are fine, if I make a big mesh (over 610 triangles) its almost asif it pics out colors (phong shading) at random :? what am I missing?

second, where can I find the translation fro HEX colors to phong shading?

cheers - Gj

Hi,

You need to provide more information if you want to get an answer.
What tool did you use to create the COLLADA file ?
What tool did you use to visualize the mesh ?
Can you attach both files you are having problem with ?
What do you mean by translating HEX colors to phong shading ?

Regards

Hi remi. Thanks for you time

  • I used google sketchup 6 to generate a template to work with
  • With my own C# program I can make custom KMZ files to be shown in Google Earth
  • code follows below
  • the polygons in the collada file are built using data privided by an external source. The external data are coordinates and HEX color codes, like ‘19b’. So my question here would be: “what is 19b in phong shading?”

the C# program I am making constructs the geometry coordinate list and the

triangle combination list. Using relatively small ploygons (~10 triangles) the colour behaves. Going to the larger polygons (~600 triangles), the colors seem to have a life of their own… (The ploygons I am making are flat).

cheers - Gj



<?xml version="1.0" encoding="utf-8"?>
<COLLADA xmlns="http://www.collada.org/2005/11/COLLADASchema" version="1.4.1">
   <asset>
      <contributor>
         <authoring_tool>Google SketchUp 6.0.515</authoring_tool>
      </contributor>
      <created>2007-08-06T12:04:13Z</created>
      <modified>2007-08-06T12:04:13Z</modified>
      <unit name="inches" meter="0.0254"/>
      <up_axis>Z_UP</up_axis>
   </asset>
		<library_materials>
		  <material id="COLORmesh1noCullingID" name="COLORmesh1noCulling">
		    <instance_effect url="#COLORmesh1noCulling-effect"/>
		  </material>
		</library_materials>
		<library_materials>
		  <material id="COLORmesh3noCullingID" name="COLORmesh3noCulling">
		    <instance_effect url="#COLORmesh3noCulling-effect"/>
		  </material>
		</library_materials>
		<library_materials>
		  <material id="COLORmesh5noCullingID" name="COLORmesh5noCulling">
		    <instance_effect url="#COLORmesh5noCulling-effect"/>
		  </material>
		</library_materials>

   <library_effects>
	  <effect id="COLORmesh1noCulling-effect" name="COLORmesh1noCulling-effect">
         <profile_COMMON>
            <technique sid="COMMON">
               <phong>
                  <emission>
                     <color>0.000000 0.000000 0.000000 1</color>
                  </emission>
                  <ambient>
                     <color>0.000000 0.000000 0.000000 1</color>
                  </ambient>
                  <diffuse>
                     <color>0.000000 0.000000 1.000000 1</color>
                  </diffuse>
                  <specular>
                     <color>0.330000 0.330000 0.330000 1</color>
                  </specular>
                  <shininess>
                     <float>20.000000</float>
                  </shininess>
                  <reflectivity>
                     <float>0.100000</float>
                  </reflectivity>
                  <transparent>
                     <color>1 1 1 1</color>
                  </transparent>
                  <transparency>
                     <float>0.000000</float>
                  </transparency>
               </phong>
            </technique>
            <extra>
               <technique profile="GOOGLEEARTH">
                  <double_sided>1</double_sided>
               </technique>
            </extra>
         </profile_COMMON>
      </effect>
	  <effect id="COLORmesh3noCulling-effect" name="COLORmesh3noCulling-effect">
         <profile_COMMON>
            <technique sid="COMMON">
               <phong>
                  <emission>
                     <color>0.000000 0.000000 0.000000 1</color>
                  </emission>
                  <ambient>
                     <color>0.000000 0.000000 0.000000 1</color>
                  </ambient>
                  <diffuse>
                     <color>0.000000 1.000000 0.000000 1</color>
                  </diffuse>
                  <specular>
                     <color>0.330000 0.330000 0.330000 1</color>
                  </specular>
                  <shininess>
                     <float>20.000000</float>
                  </shininess>
                  <reflectivity>
                     <float>0.100000</float>
                  </reflectivity>
                  <transparent>
                     <color>1 1 1 1</color>
                  </transparent>
                  <transparency>
                     <float>0.000000</float>
                  </transparency>
               </phong>
            </technique>
            <extra>
               <technique profile="GOOGLEEARTH">
                  <double_sided>1</double_sided>
               </technique>
            </extra>
         </profile_COMMON>
      </effect>
	  <effect id="COLORmesh5noCulling-effect" name="COLORmesh5noCulling-effect">
         <profile_COMMON>
            <technique sid="COMMON">
               <phong>
                  <emission>
                     <color>0.000000 0.000000 0.000000 1</color>
                  </emission>
                  <ambient>
                     <color>0.000000 0.000000 0.000000 1</color>
                  </ambient>
                  <diffuse>
                     <color>1.000000 0.000000 0.000000 1</color>
                  </diffuse>
                  <specular>
                     <color>0.330000 0.330000 0.330000 1</color>
                  </specular>
                  <shininess>
                     <float>20.000000</float>
                  </shininess>
                  <reflectivity>
                     <float>0.100000</float>
                  </reflectivity>
                  <transparent>
                     <color>1 1 1 1</color>
                  </transparent>
                  <transparency>
                     <float>0.000000</float>
                  </transparency>
               </phong>
            </technique>
            <extra>
               <technique profile="GOOGLEEARTH">
                  <double_sided>1</double_sided>
               </technique>
            </extra>
         </profile_COMMON>
      </effect>

   </library_effects>
	<library_geometries>
      <geometry id="mesh1-geometry" name="mesh1-geometry">
         <mesh>
            <source id="mesh1-geometry-position">
               <float_array id="mesh1-geometry-position-array" count="1836"> snipped </float_array>
               <technique_common>
                  <accessor source="#mesh1-geometry-position-array" count="612" stride="3">
                     <param name="X" type="float"/>
                     <param name="Y" type="float"/>
                     <param name="Z" type="float"/>
                  </accessor>
               </technique_common>
            </source>
            <source id="mesh1-geometry-normal">
               <float_array id="mesh1-geometry-normal-array" count="3">1.000000 0.000000 0.000000 </float_array>
               <technique_common>
                  <accessor source="#mesh1-geometry-normal-array" count="1" stride="3">
                     <param name="X" type="float"/>
                     <param name="Y" type="float"/>
                     <param name="Z" type="float"/>
                  </accessor>
               </technique_common>
            </source>
            <source id="mesh1-geometry-uv">
               <float_array id="mesh1-geometry-uv-array" count="2">0.000000 0.000000 </float_array>
               <technique_common>
                  <accessor source="#mesh1-geometry-uv-array" count="1" stride="2">
                     <param name="S" type="float"/>
                     <param name="T" type="float"/>
                  </accessor>
               </technique_common>
            </source>
            <vertices id="mesh1-geometry-vertex">
               <input semantic="POSITION" source="#mesh1-geometry-position"/>
            </vertices>
            <triangles material="mesh1noCulling" count="1220">
               <input semantic="VERTEX" source="#mesh1-geometry-vertex" offset="0"/>
               <input semantic="NORMAL" source="#mesh1-geometry-normal" offset="1"/>
               <input semantic="TEXCOORD" source="#mesh1-geometry-uv" offset="2" set="0"/>
               

 snipped </p>
            </triangles>
         </mesh>
      </geometry>
      <geometry id="mesh3-geometry" name="mesh3-geometry">
         <mesh>
            <source id="mesh3-geometry-position">
               <float_array id="mesh3-geometry-position-array" count="1836"> snipped </float_array>
               <technique_common>
                  <accessor source="#mesh3-geometry-position-array" count="612" stride="3">
                     <param name="X" type="float"/>
                     <param name="Y" type="float"/>
                     <param name="Z" type="float"/>
                  </accessor>
               </technique_common>
            </source>
            <source id="mesh3-geometry-normal">
               <float_array id="mesh3-geometry-normal-array" count="3">1.000000 0.000000 0.000000 </float_array>
               <technique_common>
                  <accessor source="#mesh3-geometry-normal-array" count="1" stride="3">
                     <param name="X" type="float"/>
                     <param name="Y" type="float"/>
                     <param name="Z" type="float"/>
                  </accessor>
               </technique_common>
            </source>
            <source id="mesh3-geometry-uv">
               <float_array id="mesh3-geometry-uv-array" count="2">0.000000 0.000000 </float_array>
               <technique_common>
                  <accessor source="#mesh3-geometry-uv-array" count="1" stride="2">
                     <param name="S" type="float"/>
                     <param name="T" type="float"/>
                  </accessor>
               </technique_common>
            </source>
            <vertices id="mesh3-geometry-vertex">
               <input semantic="POSITION" source="#mesh3-geometry-position"/>
            </vertices>
            <triangles material="mesh3noCulling" count="1220">
               <input semantic="VERTEX" source="#mesh3-geometry-vertex" offset="0"/>
               <input semantic="NORMAL" source="#mesh3-geometry-normal" offset="1"/>
               <input semantic="TEXCOORD" source="#mesh3-geometry-uv" offset="2" set="0"/>
               

 snipped </p>
            </triangles>
         </mesh>
      </geometry>
      <geometry id="mesh5-geometry" name="mesh5-geometry">
         <mesh>
            <source id="mesh5-geometry-position">
               <float_array id="mesh5-geometry-position-array" count="1836"> snipped </float_array>
               <technique_common>
                  <accessor source="#mesh5-geometry-position-array" count="612" stride="3">
                     <param name="X" type="float"/>
                     <param name="Y" type="float"/>
                     <param name="Z" type="float"/>
                  </accessor>
               </technique_common>
            </source>
            <source id="mesh5-geometry-normal">
               <float_array id="mesh5-geometry-normal-array" count="3">1.000000 0.000000 0.000000 </float_array>
               <technique_common>
                  <accessor source="#mesh5-geometry-normal-array" count="1" stride="3">
                     <param name="X" type="float"/>
                     <param name="Y" type="float"/>
                     <param name="Z" type="float"/>
                  </accessor>
               </technique_common>
            </source>
            <source id="mesh5-geometry-uv">
               <float_array id="mesh5-geometry-uv-array" count="2">0.000000 0.000000 </float_array>
               <technique_common>
                  <accessor source="#mesh5-geometry-uv-array" count="1" stride="2">
                     <param name="S" type="float"/>
                     <param name="T" type="float"/>
                  </accessor>
               </technique_common>
            </source>
            <vertices id="mesh5-geometry-vertex">
               <input semantic="POSITION" source="#mesh5-geometry-position"/>
            </vertices>
            <triangles material="mesh5noCulling" count="1220">
               <input semantic="VERTEX" source="#mesh5-geometry-vertex" offset="0"/>
               <input semantic="NORMAL" source="#mesh5-geometry-normal" offset="1"/>
               <input semantic="TEXCOORD" source="#mesh5-geometry-uv" offset="2" set="0"/>
               

 snipped </p>
            </triangles>
         </mesh>
      </geometry>

	</library_geometries>
   <library_cameras>
      <camera id="Camera-camera" name="Camera-camera">
         <optics>
            <technique_common>
               <perspective>
                  <xfov>46.666667</xfov>
                  <yfov>35.000000</yfov>
                  <znear>1.000000</znear>
                  <zfar>1000.000000</zfar>
               </perspective>
            </technique_common>
         </optics>
      </camera>
   </library_cameras>
   <library_visual_scenes>
      <visual_scene id="SketchUpScene" name="SketchUpScene">
         <node id="Model" name="Model">
		<node id="Group1" name="Group1">
		  <node id="mesh1" name="mesh1">
		    <instance_geometry url="#mesh1-geometry">
		      <bind_material>
		        <technique_common>
		          <instance_material symbol="COLORmesh1noCulling" target="#COLORmesh1noCullingID"/>
		        </technique_common>
		      </bind_material>
		    </instance_geometry>
		  </node>
		</node>
		<node id="Group1" name="Group1">
		  <node id="mesh3" name="mesh3">
		    <instance_geometry url="#mesh3-geometry">
		      <bind_material>
		        <technique_common>
		          <instance_material symbol="COLORmesh3noCulling" target="#COLORmesh3noCullingID"/>
		        </technique_common>
		      </bind_material>
		    </instance_geometry>
		  </node>
		</node>
		<node id="Group1" name="Group1">
		  <node id="mesh5" name="mesh5">
		    <instance_geometry url="#mesh5-geometry">
		      <bind_material>
		        <technique_common>
		          <instance_material symbol="COLORmesh5noCulling" target="#COLORmesh5noCullingID"/>
		        </technique_common>
		      </bind_material>
		    </instance_geometry>
		  </node>
		</node>

         </node>
         <node id="Camera" name="Camera">
            <matrix>
               0.987748 -0.010811 0.155681 659.133283
               0.156056 0.068427 -0.985375 -6028.039012
               -0.000000 0.997598 0.069276 567.242137
               0.000000 0.000000 0.000000 1.000000
            </matrix>
            <instance_camera url="#Camera-camera"/>
         </node>
      </visual_scene>
   </library_visual_scenes>
   <scene>
      <instance_visual_scene url="#SketchUpScene"/>
   </scene>
</COLLADA>