-
-
Notifications
You must be signed in to change notification settings - Fork 35.9k
sea3d update #8892
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
sea3d update #8892
Conversation
@@ -33,7 +33,7 @@ | |||
<a href="http://threejs.org" target="_blank">three.js</a> - Node-Based Material | |||
</div> | |||
|
|||
<script src="../build/three.js"></script> | |||
<script src="../build/three.min.js"></script> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are using the un-minified build in examples now.
Sweet! Should the examples stop including |
@mrdoob Yes! Vertex, keyframe, skeleton and others animators use only the new animation system now. Works great! |
Are you planning on removing the redundant includes? |
@@ -4749,7 +4159,7 @@ SEA3D.EventDispatcher.prototype = { | |||
|
|||
}; | |||
|
|||
SEA3D.EventDispatcher.apply = function ( object ) { | |||
SEA3D.EventDispatcher.apply = function( object ) { | |||
|
|||
object.addEventListener = SEA3D.EventDispatcher.prototype.addEvenListener; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not that this line has been changed, but it jumped right at me skimming the code: Should it read addEventListener
- note the extra "t"?
Also worth mentioning: We have recently deprecated THREE.EventListener.prototype.apply
and instead do
Object.assign( AClass.prototype, THREE.EventListener.prototype /* , { ... methods } */ );
now (there's a polyfill in Three.js
, so yes, this works with all browsers).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @tschw . I updated EventDispatcher at https://github.com/mrdoob/eventdispatcher.js/ and some other things with Object.assign. Nice!
I even have a page with builds here: https://github.com/sunag/sea3d/tree/gh-pages/Build/Three.JS Currently the hierarchy is:
< Three.JS >
|
I will try to transfer the |
All references to |
@mrdoob Added support for filters in // new
sound.setFilters( [ soundAnalyser, biquadFilter ] );
// old
sound.setFilter( biquadFilter ); and updated the example |
Sweet! |
I wouldn't deprecate
Nice! Maybe you can use AudioAnalyser though? https://github.com/mrdoob/three.js/blob/master/examples/misc_sound.html#L143 |
Nice! The |
Lovely! |
Thanks! |
@@ -20,6 +20,22 @@ Object.assign( THREE.AudioAnalyser.prototype, { | |||
this.analyser.getByteFrequencyData( this.data ); | |||
return this.data; | |||
|
|||
}, | |||
|
|||
getAverage: function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, wouldn't be more efficient to do this?
var analyser = new THREE.AudioAnalyser( sound, 2 );
var average = analyser.getData()[ 0 ];
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I think so. Sound great. I'll update the examples to an other PR. We remove getAverage
function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe I did not update the cache. I reload and show:
Uncaught IndexSizeError: Failed to set the 'fftSize' property on 'AnalyserNode': The FFT size provided (2) is outside the range [32, 32768].
In console message. The the minimum is 32.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, interesting. Never mind then!
Also, |
I add loader.setShadowMap = function() {} to ignore the |
Have you pulled from |
Yes! The |
Strange... If I comment out the vignette it works. var vignettePass = new THREE.ShaderPass( THREE.VignetteShader );
vignettePass.uniforms[ "darkness" ].value = 1.0;
// composer.addPass( vignettePass ); |
Firefox doesn't have the problem though! |
Don't use Either use |
@@ -120,6 +116,9 @@ | |||
renderer.setPixelRatio( window.devicePixelRatio ); | |||
renderer.setSize( window.innerWidth, window.innerHeight ); | |||
renderer.setClearColor( 0x333333, 1 ); | |||
renderer.shadowMap.enabled = true; | |||
renderer.shadowMap.type = THREE.PCFSoftShadowMap; | |||
renderer.shadowMap.cullFace = THREE.CullFaceBack; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deprecated. See the warning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tschw About the Mixer
you know if it is possible to change the timeScale
from action?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I found it. I'll update it after I make a new PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, certainly is.
You can also call setDuration
passing how much global mixer time your animation is supposed to take as a more high-level way of setting .timeScale
.
The value of .timeScale
is effective when the action is not paused and not being time warped. The effective time scale during warping can be queried with getEffectiveTimeScale
. The result is zero when the action is paused. The corresponding setter stops all warping, but does not release the .paused
state.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tschw Thanks! I'll test as soon as possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tschw In unification of mixers
I had a problem.
AnimationMixer
works with unique names of AnimationClip
but the variable name
not represents an uuid
semantically. If rename name
to uuid
or ns
open space to declare the real animation name in name
slot like idle
, walk
, run
, etc.
https://github.com/mrdoob/three.js/blob/dev/src/animation/AnimationClip.js#L11
For example in skinning example I have:
https://github.com/mrdoob/three.js/blob/dev/examples/webgl_loader_sea3d_skinning.html#L171
if (player.currentAnimation.name == "idle")
currentAnimation
is an AnimationClip
. I could assign currentAnimation.ns
or currentAnimationName
but I think it would be clearer this way currentAnimation.name
and currentAnimation.uuid
for clip name currently.
In keyframe
example I had the same problem by the names conflict.
https://github.com/mrdoob/three.js/blob/dev/examples/webgl_loader_sea3d_keyframe.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sunag
Yes, I remember having the same problem porting one of the examples and worked around it prefixing with the target uuid. I'm not much an expert when it comes to loaders and all the formats we support or halfway support, so I didn't really know how to best fix the underlying problem.
You OTOH seem to be having a plan, so I'll be grateful if you fixed it. I guess your changes will be sound and so there shouldn't be any problem getting them merged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tschw It will be a pleasure. I will present a possible solution in the next PR.
* node material r5 + mirror nodes example * threejs.min in node material examples * sea3d update * reverted to un-minified * update mrdoob EventDispatcher.js * fix eventdispatcher update * proto defines replace by Object.assign * native script support transferred to loader * sound filters support * light intensity from sound amplitude * keep .setFilter() method * get freq amplitude average * cleanup * use THREE.AudioAnalyser to get amplitude
@mrdoob The robot example has bug yet? |
@sunag It's still broken here yes... It's the only sea3d example that is broken though. The turtle one also has a vignette so I'm not sure where the issue is. |
I have same problem in update of I tested in If replace the current https://github.com/mrdoob/three.js/blob/master/examples/webgl_postprocessing_nodes.html#L435 to: var fadeScreen = new THREE.Math3Node(
uv,
coord,
new THREE.Math1Node( new THREE.TextureNode( lensflare2 ), THREE.Math1Node.INVERT ),
THREE.Math3Node.MIX
); only the <- Left is Firefox |
Yeah... I guess it's a Chrome regression. |
Ops! I forgot to send in the last PR. I will send right now 👍 |
@sunag I checked with the Chrome guys. The behaviour is as intended. Chrome set that limitation because some mobiles can't render to a texture while they're using it. So I guess we'll have to do some pingponging... 😁 |
Thanks @mrdoob Still about this! I forgot to point out in |
I think I've seen this when setting a |
I did some tests about this but without success. I thought that the problems were into Three.JS core until test in others browsers. I did a minimal reproduction of the problem in replace of JavaScript lensflare2.name = "lensflare2";
var uv = new THREE.UVNode();
var fadeScreen = new THREE.Math3Node(
uv,
uv,
new THREE.Math1Node( new THREE.TextureNode( lensflare2 ), THREE.Math1Node.INVERT ),
THREE.Math3Node.MIX
);
nodepass.value = new THREE.ScreenNode( fadeScreen ); NodeMaterial GLSL fragment: #ifdef GL_EXT_shader_texture_lod
#define texCube(a, b) textureCube(a, b)
#define texCubeBias(a, b, c) textureCubeLodEXT(a, b, c)
#define tex2D(a, b) texture2D(a, b)
#define tex2DBias(a, b, c) texture2DLodEXT(a, b, c)
#else
#define texCube(a, b) textureCube(a, b)
#define texCubeBias(a, b, c) textureCube(a, b, c)
#define tex2D(a, b) texture2D(a, b)
#define tex2DBias(a, b, c) texture2D(a, b, c)
#endif
varying vec2 vUv;
uniform sampler2D renderTexture;
uniform sampler2D nVu1;
void main(){
gl_FragColor = tex2D(renderTexture,mix(vec4(vUv,0.0,1.0),vec4(vUv,0.0,1.0),(1.0-tex2D(nVu1,vUv))).xy);
} Chrome uniforms Textures names composer.render(); // to first rtt
console.log( nodepass.node.uniforms.nVu1.value.name ); // output: "lensflare2"
console.log( nodepass.node.uniforms.renderTexture.value.name ); // output: "" Result The strange is that no Another two important detail is that this bug only happens when use Firefox version: 46.0.1 <- Left Firefox |
Ok, I think I figured it out. It was tricky... What was "funny" was that if I duplicated the vignette pass the problem went away. So it only happened when the number of passes was odd. |
…r to be the same. See mrdoob#8892.
loader.clone()
to clone complex assets