three.js new version 99 and morphanimation - three.js

Is the new skinnedMesh assumed to work also with both skeleton animation and morphTargets ? I updated my software to work with R99 , bones animation is OK but get TypeError: attribute.onUploadCallback is not a function in the render loop (createBuffer function) when morphTarget included.

Related

Three.js Orbitcontrols issue with colladaloader2

When I load a .dae file in a scene with colladaloader (first one with the 2 behind it) it works all OK except that transparent objects aren't shown as transparent, the controls work like the OrbitControls should work.
But when I try to change the colladaloader 1 to the 2 version it loads all objects and the threejs scene is fine but the controls are like trackballcontrols.
If you need an example, I can make one.
i found out, that on colladaloader 1 the object isn't correctly converted to its position, so i repositioned it by rotation.x to 4.70.
on the loader2 i didn't had to do this and it also fixed my problem!

Render scene onto custom mesh with three.js

After messing around with this demo of Three.js rendering a scene to a texture, I successfully replicated the essence of it in my project: amidst my main scene, there's a now sphere and a secondary scene is drawn on it via a THREE.WebGLRenderTarget buffer.
I don't really need a sphere, though, and that's where I've hit a huge brick wall. When trying to map the buffer onto my simple custom mesh, I get an infinite stream of the following errors:
three.js:23444 WebGL: INVALID_VALUE: pixelStorei: invalid parameter for alignment
three.js:23557 Uncaught TypeError: Cannot read property 'width' of undefined
My geometry, approximating an annular shape, is created using this code. I've successfully UV-mapped a canvas onto it by passing {map: new THREE.Texture(canvas)} into the material options, but if I use {map: myWebGLRenderTarget} I get the errors above.
A cursory look through the call stack makes it look like three.js is assuming the presence of the texture.image attribute on myWebGLRenderTarget and attempting to call clampToMaxSize on it.
Is this a bug in three.js or am I simply doing something wrong? Since I only need flat rendering (with MeshBasicMaterial), one of the first thing I did when adapting the render-to-texture demo above was remove all trace of the shaders, and it worked great with just the sphere. Do I need those shaders back in order to use UV mapping and a custom mesh?
For what its worth, I was needlessly setting needsUpdate = true on my texture. (The handling of needsUpdate apparently assumes the presence of a <canvas> that the texture is based on.)

ThreeJs and Blender model without texture

I'm new to both Blender and ThreeJs and searched a lot before asking. I created a model with Blender and esported it as .dae so I can load it in the html canvas. The problem is that only the model is loaded and not the textures. I'm doing something wrong or it's the loader that somehow causes the problem?
Here is the sample:
http://provasitimek.herobo.com/firstImport2.html
and the code:
https://github.com/MarcinKwiatkowski1988/learningThreeJs/tree/master/ThreeJs_and_blender
PS. the blender version is 2.70 (so maybe the problem lays here?)
PS2: So, after many attempts, these are my conclusions:
to get the color of the object, you have to choose the Blender renderer and not Cycles renderer
the export to the file .dae is not realy significant, should working with all options (or at least I didn't find any differences between files exported with different options)
if you use Blender renderer and any basic materials (Basic, Lambert, Phong) you get only the color on the object rendered in threeJs: so, for example, if you apply a trasparency to you object on blender, you will not see it on the rendered object on threeJs
with my current level (i just started to learn threeJs and blender 2 weeks ago) this is as far as I can help. Hope someone with higher skills like #mrdoob would figure out what the problem is
THREE.js does not pair models and textures until you actually make a mesh. Export The model and texture separately, load them separately and call
new THREE.Mesh(blenderGeometry,blenderTexure)

Messed up UVs and Lightmap

I want to bake my model lightmap in blender then load them all in three.js.
So in blender i set two uvs for each objects and baked ambient occlusion in second uv. finally i exported whole scene via three.js exporter into js file.
(exporter has problem that the baked texture goes for diffuse-map not light-map which is correctable by editing exported js file).
But the problem is when i load js with SceneLoader, the textures especially for my floor goes wrong, like upside down.
here is my test files: Test Light Map
So is there something wrong with my blender file or ...? Which loader i should use for it?
Thanks.
I just upload some images to see what i mean:
Messed up textures:
After edit js file, it's get better. but still there is problem at the edges:
And specially at floor, the light-map goes wrong:
Ok, i don't know why, but it seems my uvs was messed up in blender. i did some recaculate normals and flip normals in blender and now textures map fine on objects.
But i still need to edit exported scene to change map:texture.png to lightMap:texture.png.
[EDIT]
Actually this is a bug related to three.js scene exporter: Blender Exporter - Scene Exporting
[Final Answer]
The problem was about my model which had a negative scale in blender. i select my model, hit crtl+a then choose scale. now everything's fine.

Got errors when the project was updated with three.min.js (revision 55)

I haven't updated my project for a while (it is based on three.js library) and when I did it recently (with three.min.js: revision 55) I got the following errors:
With the following line I got "Uncaught TypeError: undefined is not a function"
controls = new THREE.TrackballControls(camera, renderer.domElement);
and "Uncaught TypeError: Cannot read property '0' of undefined" with:
axe_b.geometry.materials[0].opacity = opacity;
What should I change in these lines to make it running?
With the previous version of three.js the above code was fine.
Many thanks.
See the Migration Wiki for help upgrading to the current version.
TrackballControls.js is part of the examples now, and must be added explicitly. See the three.js examples.
Materials are no longer part of Geometry.
three.js r.55
THREE.TrackballControls is no longer part of three.js or three.min.js. It is now in example/js/controls/TrackballControls.js so you'll need to add something similar to this in the head of you HTML.
<script type="text/javascript" src="https://raw.github.com/mrdoob/three.js/master/examples/js/controls/TrackballControls.js"></script>
Materials are in the mesh in a variable called material so yours may now be in
axe_b.material.materials[0].opacity = opacity;
or
axe_b.material.opacity = opacity;
Depending on whether you've defined a list of materials for a mesh or just one material.

Resources