Jump to content

Texture loading for json model fails. Why?


silentimp
 Share

Recommended Posts

Ho.

May you help me to find out why material don't apply to loaded from json mesh?

http://websaints.net/model/index2.html — loading model with THREE.MeshNormalMaterial() material — ок. 

http://websaints.net/model/index.html — trying to load with texture — not ok.

  • I create model with makehuman.org,
  • save model as obj
  • then convert obj to json with help of grunt-three-obj
  • loading it with THREE.JSONLoader

I think I do everything right … but somewhere I am wrong and get err:

Uncaught TypeError: Cannot set property 'needsUpdate' of undefined

 

 

Code:

var angle = .05,scene = new THREE.Scene(),camera = new THREE.PerspectiveCamera(63, 4/3, 0.1, 1000),renderer = new THREE.WebGLRenderer({canvas: document.getElementById("screen"),antialias: true}),json_loader = new THREE.JSONLoader(),model = nulljson_loader.load('http://websaints.net/model/json/human.js', modelLoaded, 'http://websaints.net/model/json/');renderer.setSize(600, 400);camera.position.x = 0;camera.position.y = 0;camera.position.z = -10;function render() {if(model!=null){model.rotation.y+=.05;}requestAnimationFrame(render);renderer.render(scene, camera);}render();function modelLoaded(geometry, materials){model = new THREE.Mesh(geometry, new THREE.MeshNormalMaterial());model.position.z = 10;model.position.y = -8;scene.add(model);camera.lookAt({x:0,y:0,z:0});}

With all best regards. Anton.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...