Skip to content

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

Merged
merged 14 commits into from
May 16, 2016
Merged

sea3d update #8892

merged 14 commits into from
May 16, 2016

Conversation

sunag
Copy link
Collaborator

@sunag sunag commented May 15, 2016

@@ -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>
Copy link
Collaborator

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.

@mrdoob
Copy link
Owner

mrdoob commented May 15, 2016

  • Based in new Three.JS Animation System

Sweet! Should the examples stop including js/loaders/collada/Animation.js and co.?

@sunag
Copy link
Collaborator Author

sunag commented May 15, 2016

@mrdoob Yes! Vertex, keyframe, skeleton and others animators use only the new animation system now. Works great!

@mrdoob
Copy link
Owner

mrdoob commented May 16, 2016

@bhouston and @tschw will love to hear that 😀

@mrdoob
Copy link
Owner

mrdoob commented May 16, 2016

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;
Copy link
Contributor

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).

Copy link
Collaborator Author

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!

@sunag
Copy link
Collaborator Author

sunag commented May 16, 2016

Are you planning on removing the redundant includes?

I even have a page with builds here: https://github.com/sunag/sea3d/tree/gh-pages/Build/Three.JS

Currently the hierarchy is:

SEA3D.js - SDK only no depedencies
SEA3DDeflate.js - Only If the file use Deflate compression
SEA3DLZMA.js - Only If the file use LZMA compression

< Three.JS >
SEA3DLoader.js - Three.JS SEA3D Loader
SEA3DLegacy.js - For non-TJS files
SEA3DNodeMaterial.js Compatible with 'NodeMaterial' for fresnel effect and others
SEA3DAmmoLoader.js Compatible with Ammo Physics Engine

SEA3DNodeMaterial and SEA3DAmmoLoader I think in a PR with examples.in the next updates...

@sunag
Copy link
Collaborator Author

sunag commented May 16, 2016

How come you are not directly using THREE.EventDispatcher?

I will try to transfer the Script, DomainManager and others for SEA3DLoader for use THREE.EventDispatcher

@sunag
Copy link
Collaborator Author

sunag commented May 16, 2016

All references to THREE.EventDispatcher updated!

@sunag
Copy link
Collaborator Author

sunag commented May 16, 2016

@mrdoob Added support for filters in THREE.Audio and Legacy alert e.g:

// new
sound.setFilters( [ soundAnalyser, biquadFilter ] );

// old
sound.setFilter( biquadFilter );

and updated the example webgl_loader_sea3d.sound.html light intensity is based in sound amplitude.

@mrdoob
Copy link
Owner

mrdoob commented May 16, 2016

All references to THREE.EventDispatcher updated!

Sweet!

@mrdoob
Copy link
Owner

mrdoob commented May 16, 2016

@mrdoob Added support for filters in THREE.Audio and Legacy alert e.g:

I wouldn't deprecate setFilter() yet. Lets keep both setFilter() and setFilters() for now.

and updated the example webgl_loader_sea3d.sound.html light intensity is based in sound amplitude.

Nice! Maybe you can use AudioAnalyser though?

https://github.com/mrdoob/three.js/blob/master/examples/misc_sound.html#L143
https://github.com/mrdoob/three.js/blob/master/examples/misc_sound.html#L256

@sunag
Copy link
Collaborator Author

sunag commented May 16, 2016

Maybe you can use AudioAnalyser though?

Nice! The Biquad Filter was obstructed a bit the sound amplitude by AudioAnalyser capture the output but it was good I think.

@mrdoob
Copy link
Owner

mrdoob commented May 16, 2016

Lovely!

@mrdoob mrdoob merged commit 0eaaa84 into mrdoob:dev May 16, 2016
@mrdoob
Copy link
Owner

mrdoob commented May 16, 2016

Thanks!

@@ -20,6 +20,22 @@ Object.assign( THREE.AudioAnalyser.prototype, {
this.analyser.getByteFrequencyData( this.data );
return this.data;

},

getAverage: function() {
Copy link
Owner

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 ];

Copy link
Collaborator Author

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?

Copy link
Collaborator Author

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.

Copy link
Owner

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!

@mrdoob
Copy link
Owner

mrdoob commented May 17, 2016

Also, webgl_loader_sea3d_hierarchy doesn't seem to work now.

@sunag
Copy link
Collaborator Author

sunag commented May 17, 2016

Also, webgl_loader_sea3d_hierarchy doesn't seem to work now.

It works here in my desktop. Maybe have some compatibility problem with the hardware because now has shadow and physical material!? It has some new colors too

robot

@mrdoob
Copy link
Owner

mrdoob commented May 17, 2016

I think it has something to do with the post processing. I can see the robot for one frame when resizing then it's only vignette.

screen shot 2016-05-16 at 23 58 27

@sunag
Copy link
Collaborator Author

sunag commented May 17, 2016

Here appeared some warn too:

[.CommandBufferContext]RENDER WARNING: there is no texture bound to the unit 1

robot-console-warn

@sunag
Copy link
Collaborator Author

sunag commented May 17, 2016

I add

loader.setShadowMap = function() {}

to ignore the shadow not showed more warnings.

@mrdoob
Copy link
Owner

mrdoob commented May 17, 2016

Have you pulled from dev?

@sunag
Copy link
Collaborator Author

sunag commented May 17, 2016

Have you pulled from dev?

Yes! The 77dev last revision than two hours ago.

@mrdoob
Copy link
Owner

mrdoob commented May 17, 2016

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 );

@mrdoob
Copy link
Owner

mrdoob commented May 17, 2016

Firefox doesn't have the problem though!

@mrdoob
Copy link
Owner

mrdoob commented May 17, 2016

Also, in Safari...

screen shot 2016-05-17 at 09 51 28

@tschw
Copy link
Contributor

tschw commented May 17, 2016

Don't use TypedArray.prototype.slice - it's not portable!

Either use .subarray (it's a view and will change the original array when changed) or use new TypedArray( sourceArray.subarray( from, to ) ) if you need a slice that can be changed independently.

@@ -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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deprecated. See the warning.

Copy link
Collaborator Author

@sunag sunag May 17, 2016

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?

Copy link
Collaborator Author

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.

Copy link
Contributor

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.

Copy link
Collaborator Author

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.

Copy link
Collaborator Author

@sunag sunag May 17, 2016

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

Copy link
Contributor

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.

Copy link
Collaborator Author

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.

carlosanunes pushed a commit to carlosanunes/three.js that referenced this pull request May 18, 2016
* 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
@sunag
Copy link
Collaborator Author

sunag commented May 19, 2016

@mrdoob The robot example has bug yet?

@mrdoob
Copy link
Owner

mrdoob commented May 19, 2016

@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.

@mrdoob
Copy link
Owner

mrdoob commented May 20, 2016

Ok, seems to be an issue with Chrome only and, maybe, my setup. There seems to be an issue when using a renderTarget as source and target at the same time.

screen shot 2016-05-20 at 13 28 07

I'll check with Google next week.

@sunag
Copy link
Collaborator Author

sunag commented May 20, 2016

Ok, seems to be an issue with Chrome only and, maybe, my setup. There seems to be an issue when using a renderTarget as source and target at the same time.

I have same problem in update of postprocessing_nodes example using renderTarget and NodeMaterial issue only in Chrome too:

I tested in r74 at r76 same problem. I modified this in r77 to fix but the issue remains open. This happened recently in my Chrome.

If replace the current fadeScreen:

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 lensflare2 is rendered in Chrome, Firefox and others is done.

<- Left is Firefox
-> Right is Chrome

firefoxandchrome

@mrdoob
Copy link
Owner

mrdoob commented May 20, 2016

Yeah... I guess it's a Chrome regression.

@mrdoob
Copy link
Owner

mrdoob commented May 20, 2016

Btw, there is still one slice left.

screen shot 2016-05-20 at 14 12 48

@sunag
Copy link
Collaborator Author

sunag commented May 20, 2016

Btw, there is still one slice left.

Ops! I forgot to send in the last PR. I will send right now 👍

@mrdoob
Copy link
Owner

mrdoob commented May 21, 2016

@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... 😁

@sunag
Copy link
Collaborator Author

sunag commented May 21, 2016

Thanks @mrdoob

Still about this! I forgot to point out in postprocessing_nodes issue no warning appeared.

@bhouston
Copy link
Contributor

I think I've seen this when setting a uniform["name"].value = renderTarget instead of uniform["name"].value = renderTarget.texture. Or it may have been this erroneous form that caused that Chrome warning: uniform["name"] = renderTarget.texture. Basically once I fixed setting my uniforms correctly, this warning went away. So look for something like that.

@sunag
Copy link
Collaborator Author

sunag commented May 22, 2016

Basically once I fixed setting my uniforms correctly, this warning went away. So look for something like that.

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 mosaic example of postprocessing_nodes:

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

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 warning was showing in my tests as shown the printscreen.

Another two important detail is that this bug only happens when use lensflare2 as UV and this worked in previous Chrome versions.

Firefox version: 46.0.1
Chrome version: 50.0.2661.102 - 32bit

<- Left Firefox
-> Right Chrome

render-test

mrdoob added a commit that referenced this pull request May 25, 2016
@mrdoob
Copy link
Owner

mrdoob commented May 25, 2016

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.

carlosanunes pushed a commit to carlosanunes/three.js that referenced this pull request May 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants