{"id":140,"date":"2008-07-23T00:53:25","date_gmt":"2008-07-22T15:53:25","guid":{"rendered":"http:\/\/clockmaker.jp\/blog\/?p=140"},"modified":"2008-07-23T00:53:25","modified_gmt":"2008-07-22T15:53:25","slug":"papervision3d_shading","status":"publish","type":"post","link":"https:\/\/clockmaker.jp\/blog\/2008\/07\/papervision3d_shading\/","title":{"rendered":"Papervision3D 2.0(GreateWhite)\u3067\u53cd\u5c04\u3092\u6bd4\u8f03\u3059\u308b"},"content":{"rendered":"<p><a href=\"\/blog\/2008\/07\/papervision3d_greatewhite\/\">\u524d\u56de\u306e\u8a18\u4e8b<\/a>\u306b\u7d9a\u3044\u3066PV3D 2.0\u306e\u52c9\u5f37\uff12\u56de\u76ee\u3002\u4eca\u65e5\u306f\u69d8\u3005\u306a\u53cd\u5c04(\u30b7\u30a7\u30fc\u30c7\u30a3\u30f3\u30b0)\u3092\u6bd4\u8f03\u3057\u3066\u8a66\u3057\u3066\u307f\u307e\u3059(\u6bd4\u8f03\u30ad\u30e3\u30d7\u30c1\u30e3\u3092\u8f09\u305b\u3066\u307e\u3059)\u3002<\/p>\n<p class=\"photo\"><a href=\"http:\/\/clockmaker.jp\/labs\/as3_pv3d_gw_02\/Main.swf\" rel=\"shadowbox;width=720;height=480;\"><img decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-141\" title=\"pv3d_gw\" src=\"https:\/\/clockmaker.jp\/blog\/wp-content\/uploads\/2008\/07\/pv3d.jpg\" alt=\"Papervision3D 2.0 GreateWhite \u30e9\u30a4\u30c8\u6a5f\u80fd\" width=\"460\" height=\"227\" \/><\/a><\/p>\n<p>\u30b5\u30f3\u30d7\u30eb\u306f10&#215;10\u306e\u4e8c\u6b21\u5143\u914d\u5217\u30923D\u30b0\u30e9\u30d5\u72b6\u306b\u8868\u793a\u3057\u305f\u3082\u306e\u3067\u3059\u3002<\/p>\n<ul>\n<li><a href=\"http:\/\/clockmaker.jp\/labs\/as3_pv3d_gw_02\/Main.swf\" rel=\"shadowbox;width=720;height=480;\">\u30c7\u30e2(\u8981FlashPlayer 9)<\/a><\/li>\n<\/ul>\n<p>\u30e9\u30a4\u30c8\u6a5f\u80fd\u306f\u300cGouraudMaterial\u300d\u3092\u4f7f\u3044\u307e\u3057\u305f\u3002\u3053\u306e\u300cGouraudMaterial\u300d\u306f\u30b0\u30fc\u30ed\u30fc\u30b7\u30a7\u30fc\u30c7\u30a3\u30f3\u30b0\u306e\u7167\u660e\u6a5f\u80fd\u3067\u3059\u3002\u4ed6\u306b\u3082 \u300cFlatShadeMaterial\u300d\u300cCellMaterial\u300d\u300cPhongMaterial\u300d\u306a\u3069\u30e9\u30b7\u30a7\u30fc\u30c7\u30a3\u30f3\u30b0\u306e\u7a2e\u985e\u304c\u9078\u3079\u307e\u3059\u3002\u3082\u306e\u306b\u3088\u3063\u3066\u30ec\u30f3\u30c0\u30ea\u30f3\u30b0\u7d50\u679c\u3068\u51e6\u7406\u8ca0\u8377\u304c\u5909\u308f\u3063\u3066\u304f\u308b\u306e\u3067\u3001\u3069\u308c\u3092\u9078\u3076\u304b\u306f\u8981\u691c\u8a0e\u3068\u3044\u3063\u305f\u3068\u3053\u308d\u3067\u3057\u3087\u3046\u304b\u3002<\/p>\n<p><!--more--><\/p>\n<h3>shadematerials\u306e\u6bd4\u8f03<\/h3>\n<p>\u4ee5\u4e0b\u306forg.papervision3d.materials.shadematerials\u30d1\u30c3\u30b1\u30fc\u30b8\u306b\u3042\u308b\u8907\u6570\u306e\u30de\u30c6\u30ea\u30a2\u30eb\u306b\u5207\u308a\u66ff\u3048\u3066\u30ec\u30f3\u30c0\u30ea\u30f3\u30b0\u3057\u305f\u3082\u306e\u3067\u3059\u3002<\/p>\n<p class=\"photo\"><a title=\"FlatShadeMaterial\" href=\"https:\/\/clockmaker.jp\/blog\/wp-content\/uploads\/2008\/07\/flatshadematerial1.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-144\" title=\"flatshadematerial1\" src=\"https:\/\/clockmaker.jp\/blog\/wp-content\/uploads\/2008\/07\/flatshadematerial1-460x269.png\" alt=\"\" width=\"460\" height=\"269\" \/><\/a><\/p>\n<p>\u2191<strong>FlatShadeMaterial(\u30d5\u30e9\u30c3\u30c8\u30b7\u30a7\u30fc\u30c7\u30a3\u30f3\u30b0)<\/strong><br \/>\n\u3079\u3063\u305f\u308a\u3068\u9762\u306b\u7167\u660e\u3092\u5358\u4e00\u306b\u5f53\u3066\u308b\u30de\u30c6\u30ea\u30a2\u30eb\u3067\u3059\u3002\u7c21\u6613\u306a\u304c\u3089\u3082\u3063\u3068\u3082\u9ad8\u901f\u3067\u3057\u305f\u3002<br \/>\n<a href=\"http:\/\/ja.wikipedia.org\/wiki\/3%E6%AC%A1%E5%85%83%E3%82%B3%E3%83%B3%E3%83%94%E3%83%A5%E3%83%BC%E3%82%BF%E3%82%B0%E3%83%A9%E3%83%95%E3%82%A3%E3%83%83%E3%82%AF%E3%82%B9\">3\u6b21\u5143\u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u30b0\u30e9\u30d5\u30a3\u30c3\u30af\u30b9 &#8211; Wikipedia<\/a>\u306b\u3088\u308b\u3068\u300c\u5358\u7d14\u306a\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u306a\u306e\u3067\u8a08\u7b97\u901f\u5ea6\u304c\u9ad8\u901f\u3067\u3042\u308b\u304c\u3001\u30dd\u30ea\u30b4\u30f3\u306e\u7d99\u304e\u76ee\u3054\u3068\u306b\u4e0d\u9023\u7d9a\u7684\u306b\u8272\u304c\u5909\u5316\u3059\u308b\u305f\u3081\u3001\u6ed1\u3089\u304b\u306b\u306f\u898b\u3048\u306a\u3044\u3002\u300d\u3068\u306e\u3053\u3068\u3067\u3059\u3002<\/p>\n<p class=\"photo\"><a title=\"EnvMapMaterial\" href=\"https:\/\/clockmaker.jp\/blog\/wp-content\/uploads\/2008\/07\/envmapmaterial.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-143\" title=\"envmapmaterial\" src=\"https:\/\/clockmaker.jp\/blog\/wp-content\/uploads\/2008\/07\/envmapmaterial-460x269.png\" alt=\"\" width=\"460\" height=\"269\" \/><\/a><\/p>\n<p>\u2191<strong>EnvMapMaterial<\/strong><br \/>\nBitmapData\u3092\u7167\u660e\u306b\u5272\u308a\u5408\u3048\u3066\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p class=\"photo\"><a title=\"CellMaterial\" href=\"https:\/\/clockmaker.jp\/blog\/wp-content\/uploads\/2008\/07\/cellmaterial.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-145\" title=\"cellmaterial\" src=\"https:\/\/clockmaker.jp\/blog\/wp-content\/uploads\/2008\/07\/cellmaterial-460x269.png\" alt=\"\" width=\"460\" height=\"269\" \/><\/a><\/p>\n<p>\u2191<strong>CellMaterial<\/strong><br \/>\n\u7167\u660e\u306e\u5f53\u305f\u308a\u5177\u5408\u3092\u6bb5\u3005\u7551\u72b6\u306b\u8a2d\u5b9a\u3059\u308b\u30de\u30c6\u30ea\u30a2\u30eb\u3002\u6bb5\u3005\u7551\u306e\u56de\u6570\u306f\u8a2d\u5b9a\u3067\u304d\u307e\u3059\u3002<\/p>\n<p class=\"photo\"><a href=\"https:\/\/clockmaker.jp\/blog\/wp-content\/uploads\/2008\/07\/gouraudmaterial.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-147\" title=\"gouraudmaterial\" src=\"https:\/\/clockmaker.jp\/blog\/wp-content\/uploads\/2008\/07\/gouraudmaterial-460x269.png\" alt=\"\" width=\"460\" height=\"269\" \/><\/a><\/p>\n<p>\u2191<strong>GouraudMaterial(\u30b0\u30fc\u30ed\u30fc\u30b7\u30a7\u30fc\u30c7\u30a3\u30f3\u30b0)<\/strong><br \/>\n\u30b0\u30e9\u30c7\u30fc\u30b7\u30e7\u30f3\u98a8\u306b\u9069\u7528\u3055\u308c\u308b\u30de\u30c6\u30ea\u30a2\u30eb\u3002<br \/>\n\u3053\u308c\u306f<a href=\"http:\/\/ja.wikipedia.org\/wiki\/3%E6%AC%A1%E5%85%83%E3%82%B3%E3%83%B3%E3%83%94%E3%83%A5%E3%83%BC%E3%82%BF%E3%82%B0%E3%83%A9%E3%83%95%E3%82%A3%E3%83%83%E3%82%AF%E3%82%B9\">3\u6b21\u5143\u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u30b0\u30e9\u30d5\u30a3\u30c3\u30af\u30b9 &#8211; Wikipedia<\/a>\u306b\u3088\u308b\u3068\u300c\u9802\u70b9\u9593\u306f\u4e00\u6b21\u88dc\u9593\u3057\u3066\u30d4\u30af\u30bb\u30eb\u306e\u8272\u3092\u7b97\u51fa\u3059\u308b\u3002\u30d4\u30af\u30bb\u30eb\u9593\u306e\u7d99\u304e\u76ee\u306f\u76ee\u7acb\u305f\u306a\u304f\u306a\u308b\u3002\u300d\u3068\u306e\u3053\u3068\u3067\u3059\u3002\u306a\u308b\u307b\u3069\u3002<\/p>\n<p class=\"photo\"><a title=\"PhongMaterial\" href=\"https:\/\/clockmaker.jp\/blog\/wp-content\/uploads\/2008\/07\/phongmaterial.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-146\" title=\"phongmaterial\" src=\"https:\/\/clockmaker.jp\/blog\/wp-content\/uploads\/2008\/07\/phongmaterial-460x269.png\" alt=\"\" width=\"460\" height=\"269\" \/><\/a><\/p>\n<p>\u2191<strong>PhongMaterial(\u30d5\u30a9\u30f3\u30b7\u30a7\u30fc\u30c7\u30a3\u30f3\u30b0)<\/strong><br \/>\nGouraudMaterial\u3068\u4f3c\u3066\u307e\u3059\u304c\u3001\u30b0\u30e9\u30c7\u30fc\u30b7\u30e7\u30f3\u98a8\u306b\u304b\u304b\u3063\u3066\u307e\u3059\u3002<br \/>\n\u3053\u308c\u306f<a href=\"http:\/\/ja.wikipedia.org\/wiki\/3%E6%AC%A1%E5%85%83%E3%82%B3%E3%83%B3%E3%83%94%E3%83%A5%E3%83%BC%E3%82%BF%E3%82%B0%E3%83%A9%E3%83%95%E3%82%A3%E3%83%83%E3%82%AF%E3%82%B9\">3\u6b21\u5143\u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u30b0\u30e9\u30d5\u30a3\u30c3\u30af\u30b9 &#8211; Wikipedia<\/a>\u306b\u3088\u308b\u3068\u300c\u30b0\u30fc\u30ed\u30fc\u30b7\u30a7\u30fc\u30c7\u30a3\u30f3\u30b0\u306b\u304a\u3051\u308b\u5149\u6ca2\u306e\u4e0d\u81ea\u7136\u3055\u3092\u6539\u5584\u3059\u308b\u3002\u300d\u3068\u306e\u3053\u3068\u3002\u78ba\u304b\u306b\u5468\u56f2\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306b\u5bfe\u3057\u3066\u7167\u660e\u304c\u8a08\u7b97\u3055\u308c\u3066\u308b\u6c17\u304c\u3057\u307e\u3059\u306d\u3002<\/p>\n<p>\u30b7\u30a7\u30fc\u30c7\u30a3\u30f3\u30b0\u306e\u7a2e\u985e\u306f\u306f\u3058\u3081\u3066\u77e5\u308a\u307e\u3057\u305f\u3002\u3046\u301c\u3093\u30013D\u306f\u5965\u304c\u6df1\u3044\u3067\u3059\u306d\u3002<\/p>\n<h3>\u691c\u8a3c\u7528\u306e\u30bd\u30fc\u30b9\u306f\u4ee5\u4e0b\u306b\u63b2\u8f09\u3057\u307e\u3059\u3002<\/h3>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\npackage\n{\n\timport flash.display.*;\n\timport flash.events.*;\n\timport flash.utils.*;\n\n\timport org.papervision3d.cameras.*;\n\timport org.papervision3d.render.BasicRenderEngine;\n\timport org.papervision3d.scenes.Scene3D;\n\timport org.papervision3d.view.Viewport3D;\n\timport org.papervision3d.materials.*;\n\timport org.papervision3d.objects.*;\n\timport org.papervision3d.objects.primitives.*\n\timport org.papervision3d.materials.utils.*;\n\timport org.papervision3d.materials.shadematerials.*;\n\n\timport org.papervision3d.lights.*;\n\n\t[SWF(width = &quot;450&quot;, height = &quot;300&quot;, frameRate = &quot;60&quot;, backgroundColor = &quot;#000000&quot;)]\n\n\tpublic class Main extends MovieClip\n\t{\n\t\t\/\/ const vars\n\t\tstatic private const GRAPH_CUBE_LENGTH :int = 100;\n\t\tstatic private const GRAPH_CUBE_MARGIN :int = 25;\n\t\tstatic private const CAMERA_Z_POINT    :int = -1500;\n\t\tstatic private const CAMERA_Z_DEG      :int = 750;\n\n\t\t\/\/ plot data\n\n\t\tstatic private const PLOT_2x2_DATA :Array =\n\t\t[\n\t\t\t[0, 20, 40, 60, 80, 100, 120, 140, 160, 180],\n\t\t\t[10, 50, 100, 200, 300, 400, 300, 200, 100, 50],\n\t\t\t[20, 100, 200, 300, 400, 500, 400, 300, 200, 100],\n\t\t\t[40, 50, 100, 200, 400, 600, 400, 200, 100, 50],\n\t\t\t[10, 120, 200, 860, 880, 800, 700, 200, 100, 10],\n\t\t\t[80, 220, 450, 500, 900, 1000,800, 600, 400, 200],\n\t\t\t[30, 20, 40, 350, 600, 800, 600, 400, 200, 100],\n\t\t\t[20, 100, 200, 300, 400, 500, 400, 300, 200, 100],\n\t\t\t[10, 50, 100, 200, 300, 400, 300, 200, 100, 50],\n\t\t\t[30, 120, 140, 160, 180, 200, 220, 240, 260, 280],\n\t\t\t[10, 20, 40, 60, 80, 0, 20, 40, 60, 80],\n\t\t];\n\n\t\t\/\/ 3d vars\n\t\tprivate var camera   :Camera3D;\n\t\tprivate var viewport :Viewport3D;\n\t\tprivate var render   :BasicRenderEngine\n\t\tprivate var scene    :Scene3D;\n\t\tprivate var light    :PointLight3D;\n\t\tprivate var wrap     :DisplayObject3D;\n\n\t\t\/\/ for test EnvMapMaterial\n\t\t\/\/[Embed(source = 'Dock.jpg')] private var MyBitmap:Class;\n\n\t\t\/**\n\t\t * Constructor\n\t\t *\/\n\t\tpublic function Main()\n\t\t{\n\t\t\t\/\/ init swf\n\t\t\tstage.scaleMode = StageScaleMode.NO_SCALE;\n\t\t\tstage.align     = StageAlign.TOP_LEFT;\n\t\t\tstage.quality   = StageQuality.HIGH;\n\n\t\t\t\/\/ init 3d\n\t\t\tscene    = new Scene3D()\n\t\t\tcamera   = new Camera3D();\n\t\t\trender   = new BasicRenderEngine();\n\t\t\tviewport = new Viewport3D(0, 0, true, false);\n\t\t\taddChild(viewport);\n\n\t\t\t\/\/camera\n\t\t\tcamera.focus     = 500;\n\t\t\tcamera.zoom      = 1;\n\t\t\tcamera.x         = 0;\n\t\t\tcamera.y         = 750;\n\t\t\tcamera.z         = CAMERA_Z_POINT;\n\t\t\tcamera.rotationX = 20;\n\n\t\t\t\/\/ light\n\t\t\tlight = new PointLight3D(false);\n\t\t\tlight.z = 0;\n\t\t\tlight.x = 1000;\n\t\t\tlight.y = 1000;\n\n\t\t\t\/\/ wrap\n\t\t\twrap = new DisplayObject3D();\n\t\t\tscene.addChild(wrap);\n\n\t\t\t\/\/ cell length\n\t\t\tvar cellLength:Number = GRAPH_CUBE_LENGTH + GRAPH_CUBE_MARGIN;\n\n\t\t\t\/\/ 2x2 loop\n\t\t\tfor (var i:int = 0; i &lt; PLOT_2x2_DATA.length; i++)\n\t\t\t{\n\t\t\t\tvar color:uint = Math.random() * 0x335533 + 0x0000AA;\n\n\t\t\t\tfor (var j:int = 0; j &lt; PLOT_2x2_DATA[i].length; j++ )\n\t\t\t\t{\n\t\t\t\t\tvar cube:Cube = new Cube(\n\t\t\t\t\t\t\/\/new MaterialsList( { all:new CellMaterial(light, 0xFFFFFF, 0x666666, 10) } ), \/\/ heavey...\n\t\t\t\t\t\t\/\/new MaterialsList( { all:new EnvMapMaterial(light, new MyBitmap().bitmapData ) } ), \/\/ most light...\n\t\t\t\t\t\t\/\/new MaterialsList( { all:new FlatShadeMaterial(light, 0xFFFFFF, 0x666666) } ), \/\/ most light...\n\t\t\t\t\t\t\/\/new MaterialsList( { all:new GouraudMaterial(light, 0xFFFFFF, 0x666666) } ), \/\/ heavey...\n\t\t\t\t\t\t\/\/new MaterialsList( { all:new PhongMaterial(light, 0xFFFFFF, 0x666666, 10) } ), \/\/ heavey...\n\n\t\t\t\t\t\tnew MaterialsList( { all:new GouraudMaterial(light, 0xFFFFFF, color) } ), \/\/ heavey...\n\t\t\t\t\t\tGRAPH_CUBE_LENGTH,\n\t\t\t\t\t\tGRAPH_CUBE_LENGTH,\n\t\t\t\t\t\tPLOT_2x2_DATA[i][j],\n\t\t\t\t\t\t1,\n\t\t\t\t\t\t1,\n\t\t\t\t\t\t1);\n\t\t\t\t\tcube.x = i * cellLength - PLOT_2x2_DATA.length * cellLength \/ 2;\n\t\t\t\t\tcube.y = PLOT_2x2_DATA[i][j] \/ 2;\n\t\t\t\t\tcube.z = j * cellLength - PLOT_2x2_DATA[i].length * cellLength \/ 2;\n\t\t\t\t\twrap.addChild(cube);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis.addEventListener(Event.ENTER_FRAME, enterFrameHandler);\n\t\t}\n\n\t\t\/**\n\t\t* Render\n\t\t* @param\tevent\n\t\t*\/\n\t\tprivate function enterFrameHandler(event:Event):void\n\t\t{\n\t\t\twrap.yaw(-2);\n\t\t\tcamera.z = Math.sin(getTimer() \/ 1000) * CAMERA_Z_DEG + CAMERA_Z_POINT;\n\t\t\trender.renderScene(scene, camera, viewport);\n\t\t}\n\t}\n}\n<\/pre>\n<h3>\u3053\u306e\u30d6\u30ed\u30b0\u5185\u306e\u95a2\u9023\u8a18\u4e8b<\/h3>\n<p><a href=\"https:\/\/clockmaker.jp\/blog\/2008\/07\/papervision3d_greatewhite\/\">Papervision3D 2.0(GreateWhite)\u306e\u7fd2\u4f5c<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u56de\u306e\u8a18\u4e8b\u306b\u7d9a\u3044\u3066PV3D 2.0\u306e\u52c9\u5f37\uff12\u56de\u76ee\u3002\u4eca\u65e5\u306f\u69d8\u3005\u306a\u53cd\u5c04(\u30b7\u30a7\u30fc\u30c7\u30a3\u30f3\u30b0)\u3092\u6bd4\u8f03\u3057\u3066\u8a66\u3057\u3066\u307f\u307e\u3059(\u6bd4\u8f03\u30ad\u30e3\u30d7\u30c1\u30e3\u3092\u8f09\u305b\u3066\u307e\u3059)\u3002 \u30b5\u30f3\u30d7\u30eb\u306f10&#215;10\u306e\u4e8c\u6b21\u5143\u914d\u5217\u30923D\u30b0\u30e9\u30d5\u72b6\u306b\u8868\u793a\u3057\u305f\u3082\u306e\u3067\u3059\u3002 \u30c7\u30e2 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[2,4],"tags":[],"_links":{"self":[{"href":"https:\/\/clockmaker.jp\/blog\/wp-json\/wp\/v2\/posts\/140"}],"collection":[{"href":"https:\/\/clockmaker.jp\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/clockmaker.jp\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/clockmaker.jp\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/clockmaker.jp\/blog\/wp-json\/wp\/v2\/comments?post=140"}],"version-history":[{"count":0,"href":"https:\/\/clockmaker.jp\/blog\/wp-json\/wp\/v2\/posts\/140\/revisions"}],"wp:attachment":[{"href":"https:\/\/clockmaker.jp\/blog\/wp-json\/wp\/v2\/media?parent=140"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/clockmaker.jp\/blog\/wp-json\/wp\/v2\/categories?post=140"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/clockmaker.jp\/blog\/wp-json\/wp\/v2\/tags?post=140"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}