[sketchfab id=”vj4S4foHFOZ8Lv9ckcyA0cAhdXQ” start=”1″ spin=”.5″ controls=”1″]
Model with shininess (Phong shader)
If you export a COLLADA DAE model from SketchUp (using either the 3D Model Export feature in SketchUp or my Sketchfab plugin), then you will notice that any materials in the model (colors or textures) look flat (like you can see in the model shown in the web viewer below). Although shininess is not always appropriate, a slight amount of reflectivity can “dress up” such a model significantly.
[sketchfab id=”pcsOZXUgCjrpNgtf9s84fPlqcsd” controls=”1″]
The flat textures appear because SketchUp exports COLLADA files in a way that assigns a “Lambert” shader to all materials. This provides accurate texturing, color and transparency but no reflections. A better shading approach is actually written into the COLLADA specification (p. 8-84) and is readily available in many COLLADA viewers (including WebGL viewers like Sketchfab) – it’s a Phong shader. If we want any glossiness, that’s the one we want.
To add glossiness to an already exported COLLADA file, open it in a text editor and use find/replace or any other method you like to replace lines like these:
<lambert> <diffuse><color>1.0 0.0 0.0 1.0</color></diffuse> </lambert>
<phong> <ambient><color>0.0 0.0 0.0 1.0</color></ambient> <specular><color>1.0 1.0 1.0 1.0</color></specular> <shininess><float>100.0</float></shininess> <reflective><color>1.0 1.0 1.0 1.0</color></reflective> <reflectivity><float>0.2</float></reflectivity> <diffuse><color>1.0 0.0 0.0 1.0</color></diffuse> </phong>
Do this for every material that is defined in the file. Just change “lambert” to “phong” but leave the “diffuse” line alone. Then add the other lines. Feel free to modify the parameters to your liking.