-
-
Notifications
You must be signed in to change notification settings - Fork 35.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
r72 : .computeTangents() has been removed #7190
Comments
What were you using Tangents for may I ask? It isn't clear to me with a quick look. It seems like whole objects are missing frmo your scene and also that some material brightnesses are completely out of whack. |
I didn't use it. |
Hi @RemusMar Have you tried it with SEA3D 1.7v? Also have the SEA3D TJS version optimized for Three.JS. Cheers. |
SEA3DLoader for Three.JS r72, only TJS files |
With that you cannot even load the SEA file. "SEA3D 1.7.0.0" SEA3D.js Another issue: the latest minified SEA3D loader does not include DEFLATE ... !?! |
Ben, |
@RemusMar Animation names, blending, warping is supported by the AnimationMixer/AnimationClip system - including the ability to animate material properties, skinning, node properties, and morph targets, and blend shapes. I think the new animation system can easily be used by the Sea3D loader: #6934 So I am suggesting an improvement to Sea3D, not denigrating it in any way. |
Are they included into the main package? model.play('walk', 0.5); |
The PR is for inclusion of the new animation system within the core of ThreeJS: #6934
The new animation system supports cross fade between animation clips as well as warps (where it slowly adjusts the length of the cycles to match whlie doing the cross fade between the animations):
It was because the functionality of the new animation system matches the needs of Sea3D, I was suggesting that it also adopt it, rather than maintaining a separate but similar animation system. |
A not very inspired syntax.
p.s. |
I have a play function as well called
I'll modify the code now to have the optional fade out of everything else using this exactly syntax.
THREE.AnimationMixer is a general mixer and can support mixing together any number of animations -- such as facial animations, multiple bone animations, etc. So you can have a shoot animation for the arms bones, while fading from walk to run on the leg bones -- because it supports any number of concurrent animations, you likely do not just want to fade out all of them in favor of a new one -- thus the mixer itself needs to know which to fadeOut, especially if you are doing a warp. There is also fadeIn, fadeOut, play, warp etc functions -- so you can full control over what happens. Also, Sea3D doesn't have to change the UI they are providing to you as a user of the Sea3D classes, rather they could use the new animation mixer behind the scenes because it does more than their current animation system and it will reduce the amount of JavaScript required to download to run Sea3D scenes. |
This is getting off-topic... I think the main issue is that @remoe is not happy with the new SEA3D loader. |
Hi @RemusMar it is necessary to export from SEA3D Studio in File -> Publish... and choose Three.JS as output. The file turns with a TJS tag. About the changes, my idea is to simplify the game creation process for increased productivity, for advanced users they can create their own characteristics over SEA3D. The interface of SEA3D was based on the use in our company and it has worked for several games, if migrating from Flash, Director for THREE will also be easier. We have examples of animation Basics and Advanced here: Cheers |
.computeTangents() has been removed
I don't want to REexport anything. A tip to all the software developers: p.s. |
@RemusMar can you try adding this to your code? THREE.BufferGeometry.prototype.computeTangents = function () {
var index = this.index;
var attributes = this.attributes;
// based on http://www.terathon.com/code/tangent.html
// (per vertex tangents)
if ( index === null ||
attributes.position === undefined ||
attributes.normal === undefined ||
attributes.uv === undefined ) {
console.warn( 'THREE.BufferGeometry: Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()' );
return;
}
var indices = index.array;
var positions = attributes.position.array;
var normals = attributes.normal.array;
var uvs = attributes.uv.array;
var nVertices = positions.length / 3;
if ( attributes.tangent === undefined ) {
this.addAttribute( 'tangent', new THREE.BufferAttribute( new Float32Array( 4 * nVertices ), 4 ) );
}
var tangents = attributes.tangent.array;
var tan1 = [], tan2 = [];
for ( var k = 0; k < nVertices; k ++ ) {
tan1[ k ] = new THREE.Vector3();
tan2[ k ] = new THREE.Vector3();
}
var vA = new THREE.Vector3(),
vB = new THREE.Vector3(),
vC = new THREE.Vector3(),
uvA = new THREE.Vector2(),
uvB = new THREE.Vector2(),
uvC = new THREE.Vector2(),
sdir = new THREE.Vector3(),
tdir = new THREE.Vector3();
function handleTriangle( a, b, c ) {
vA.fromArray( positions, a * 3 );
vB.fromArray( positions, b * 3 );
vC.fromArray( positions, c * 3 );
uvA.fromArray( uvs, a * 2 );
uvB.fromArray( uvs, b * 2 );
uvC.fromArray( uvs, c * 2 );
var x1 = vB.x - vA.x;
var x2 = vC.x - vA.x;
var y1 = vB.y - vA.y;
var y2 = vC.y - vA.y;
var z1 = vB.z - vA.z;
var z2 = vC.z - vA.z;
var s1 = uvB.x - uvA.x;
var s2 = uvC.x - uvA.x;
var t1 = uvB.y - uvA.y;
var t2 = uvC.y - uvA.y;
var r = 1.0 / ( s1 * t2 - s2 * t1 );
sdir.set(
( t2 * x1 - t1 * x2 ) * r,
( t2 * y1 - t1 * y2 ) * r,
( t2 * z1 - t1 * z2 ) * r
);
tdir.set(
( s1 * x2 - s2 * x1 ) * r,
( s1 * y2 - s2 * y1 ) * r,
( s1 * z2 - s2 * z1 ) * r
);
tan1[ a ].add( sdir );
tan1[ b ].add( sdir );
tan1[ c ].add( sdir );
tan2[ a ].add( tdir );
tan2[ b ].add( tdir );
tan2[ c ].add( tdir );
}
var groups = this.groups;
if ( groups.length === 0 ) {
groups = [ {
start: 0,
count: indices.length
} ];
}
for ( var j = 0, jl = groups.length; j < jl; ++ j ) {
var group = groups[ j ];
var start = group.start;
var count = group.count;
for ( var i = start, il = start + count; i < il; i += 3 ) {
handleTriangle(
indices[ i + 0 ],
indices[ i + 1 ],
indices[ i + 2 ]
);
}
}
var tmp = new THREE.Vector3(), tmp2 = new THREE.Vector3();
var n = new THREE.Vector3(), n2 = new THREE.Vector3();
var w, t, test;
function handleVertex( v ) {
n.fromArray( normals, v * 3 );
n2.copy( n );
t = tan1[ v ];
// Gram-Schmidt orthogonalize
tmp.copy( t );
tmp.sub( n.multiplyScalar( n.dot( t ) ) ).normalize();
// Calculate handedness
tmp2.crossVectors( n2, t );
test = tmp2.dot( tan2[ v ] );
w = ( test < 0.0 ) ? - 1.0 : 1.0;
tangents[ v * 4 ] = tmp.x;
tangents[ v * 4 + 1 ] = tmp.y;
tangents[ v * 4 + 2 ] = tmp.z;
tangents[ v * 4 + 3 ] = w;
}
for ( var j = 0, jl = groups.length; j < jl; ++ j ) {
var group = groups[ j ];
var start = group.start;
var count = group.count;
for ( var i = start, il = start + count; i < il; i += 3 ) {
handleVertex( indices[ i + 0 ] );
handleVertex( indices[ i + 1 ] );
handleVertex( indices[ i + 2 ] );
}
}
}; |
As per your question... The reason |
That's also a problem which I've encountered when migrating to r72 today. Temporarily adding
to my code too until sea3d exporter for 3ds max will be compatible with r72 also adding:
just to mute the warnings. Will it make any difference if instead of including full body of
|
It doesn't change anything. |
How? Do you mind zipping the test so I can investigate locally? |
Ricardo, if you take a look at the page source you'll find: |
@sunag thanks! |
I found the two problems he was generating this. Lightmap moved of multiply to additive, is necessary to use aoMap for the same purpose and BufferGeometry loader also had problems. I am sending a fix. https://fhscript.com/12jP/sea3d.min.js Still I will clean up for a update in root. @RemusMar Your lightmap is inverted with diffuseMap. It will no longer work in r72. Cheers. |
I didn't find any fix.
The same problem with the minified version: DEFLATE is not included !?!
In r71 if it's not inverted, it doesn't work !! |
Again, that file cannot be loaded (it does not exist).
As I said before, the BACKWARD COMPATIBILITY is a must in any serious project. |
We are the first ones to hate breaking backwards compatibility. We go great lengths to avoid that but some times we have no option than correcting bad designs and decisions. On those cases we try to add code to warn the user and if possible to keep it working still. It's hard for us to cover all the possible use cases, so it's imposible not to break some thing. For those cases, the last thing we want is to get attacked with a demanding tone like the one you give us. It may be a language issue and it may not be your intention to come across like that. But, please, try to be respectful to us the same way we are to you. |
I totally agree with that. |
Hi, I finished the loader update now hybrid, it works both for the TJS as to the Legacy. @RemusMar @DVLP Compiler and files included. hello world threejs-r72 (legacy) Cheers. |
I see some improvements: all the models are loaded and I don't get errors.
r71: perfect r72: issues cheers |
@RemusMar thanks for tests, the 1 and 2 items apparently they have been fixed. @mrdoob aoMap only works with Ambient Light? Cheers. |
@sunag An ambient occlusion map occludes only ambient light sources. Hence its name. Another term for ambient light is indirect light. There are currently three models of indirect, diffuse light: The AO map occludes all three. |
Thaks @WestLangley! But if I want to give the same effect of a shadowmap it is possible? Also because in my design AO is a soft shadow, looking by physics |
That's right. Anyway, I found a new bug: animation related |
That bug was fixed, but there is another one: multiple animations related. Press key 3, after a few seconds press key 1, after a few seconds press key 2. |
See the "aoMapIntensity" value (1 by default) cheers |
Hi @RemusMar
I'll be updating the Legacy to the next versions.
The problem with this technique that just worked if there Indirect Light (in case Ambient Light). I made a change in native shader to AO be a Shadow Map for THREE.SEA3D.StandardMaterial.
Try use the SEA3D AnimationHandler in updater:
Cheers. |
Don't forget about that.
That did the trick |
Many thanks guys! |
Hi, I'm not sure if i should open up another issue, but i missed this one and there is a ton of stuff here about some specific loader. Why was this removed? Is the idea to rely on derivatives and fragment shaders always? If so, i think this will more or less be useful for procedural surface like textures (orange skin, brick wall etc.) very not useful for any kind of a bake (maya, max, xnormal etc.). |
How so? |
r71: perfect
http://necromanthus.com/Test/html5/SMC.html
r72: a mess
http://necromanthus.com/Test/html5/SMC_r72.html
No other comments.
The text was updated successfully, but these errors were encountered: