Skip to content
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 new examples and revision #6896

Merged
merged 2 commits into from
Jul 23, 2015
Merged

sea3d new examples and revision #6896

merged 2 commits into from
Jul 23, 2015

Conversation

sunag
Copy link
Collaborator

@sunag sunag commented Jul 22, 2015

Hi @mrdoob .

I have a few more examples, I hope you enjoy... morph seems that still is not working in r72dev?

console.warn( 'TOFIX: material.program is undefined' );

Thks

@@ -25,12 +25,12 @@ THREE.ShaderLib.replaceCode = function(src, target, replace) {
THREE.ShaderLib['phong'].fragmentShader_StandardMaterial =
THREE.ShaderLib.replaceCode( THREE.ShaderLib['phong'].fragmentShader, [
Copy link
Collaborator

Choose a reason for hiding this comment

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

I did not realize this was in your previous version, too.

Why do you feel it is necessary to modify the Phong shader code in the sea3d loader?

I notice you set material.emissive.set( 0.2, 0.2, 0.2 ) (or something similar) on almost all your models.

You appear to want emissive to be modulated by both material.color and material.map.

In the Phong shader, material.emissive is simply additive to the reflected color.

@WestLangley
Copy link
Collaborator

I like webgl_loader_sea3d_hierarchy. : - )

Consider using OrbitControls instead, so your scenes remain right-side-up. If you do so, you should not need to call controls.update() in the render loop unless there is camera animation.

@sunag
Copy link
Collaborator Author

sunag commented Jul 23, 2015

Hi @WestLangley

'OrbitControls' looks much better. Thanks : )

Emissive has a different result of AmbienteColor. Many people who use 3ds Max and Sea3D Studio like of Ambient Color and it seems that he is no longer available. So I made this hack to not need create a custom shader for it.

@sunag
Copy link
Collaborator Author

sunag commented Jul 23, 2015

I almost forgot... It is possible load without the hack.

loader = new THREE.SEA3D( {
    autoPlay : true, // Auto play animations
    container : scene, // Container to add models
    parser : THREE.SEA3D.AUTO, // Auto choose THREE.BufferGeometry and THREE.Geometry
    multiplier : 1, // Light multiplier
    ambientColor : false // emissiveToAmbientColor, true is default
} );

Creating manually a material with emissive to ambient color.

var mat = new THREE.MeshPhongMaterial();
mat.emissiveToAmbientColor = true; // false is default

@@ -72,7 +72,7 @@

autoPlay : true, // Auto play animations
container : scene, // Container to add models
parser : THREE.SEA3D.DEFAULT, // THREE.SEA3D.BUFFER to THREE.GeometryBuffer
parser : THREE.SEA3D.AUTO, // Auto choose THREE.BufferGeometry and THREE.Geometry
Copy link
Owner

Choose a reason for hiding this comment

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

I would suggest not producing THREE.Geometry at all (thus removing all the code for it). And let the user convert on their code if needed.

@mrdoob
Copy link
Owner

mrdoob commented Jul 23, 2015

I have a few more examples, I hope you enjoy... morph seems that still is not working in r72dev?

Yes, still working on that. I'm hoping to be able to spend some time tomorrow 😊

mrdoob added a commit that referenced this pull request Jul 23, 2015
sea3d new examples and revision
@mrdoob mrdoob merged commit 2111828 into mrdoob:dev Jul 23, 2015
@mrdoob
Copy link
Owner

mrdoob commented Jul 23, 2015

Thanks!

@WestLangley
Copy link
Collaborator

@mrdoob @dubejf @tschw etc..

What are the implications/consequences of the first 400 lines of SEA3DLoader.js?

@WestLangley
Copy link
Collaborator

Emissive has a different result of AmbientColor. Many people who use 3ds Max and Sea3D Studio like of Ambient Color and it seems that he is no longer available. So I made this hack to not need create a custom shader for it.

material.ambient was removed from the interface. In the model, it was hardwired to match material.color.

I see that you are adding emissive to most materials to accommodate for something you do not like. You should be able to get the same effect by increasing AmbientLight.

Your hack to the Phong shader is not appropriate. We need to find another solution. emissive should not be modulated by the diffuse color and diffuse map.

@dubejf
Copy link
Contributor

dubejf commented Jul 23, 2015

What are the implications/consequences of the first 400 lines of SEA3DLoader.js?

You mean extending THREE objects? Are all those extensions that really necessary?

I guess it's okay for application code to clobber the THREE objects, but ideally, it would be a lot cleaner to extend the library with new classes (e.g. Sea3DSkinnedMesh extends THREE.SkinnedMesh).

@sunag
Copy link
Collaborator Author

sunag commented Jul 23, 2015

material.ambient was removed from the interface. In the model, it was hardwired to match material.color.

At least in my tests in r71 mat.color took another result, like a * b

I see that you are adding emissive to most materials to accommodate for something you do not like. You should be able to get the same effect by increasing AmbientLight.

The value .2 can vary from material to material. I can not make a standard value for this at the time.

Your hack to the Phong shader is not appropriate. We need to find another solution. emissive should not be modulated by the diffuse color and diffuse map.

Also I do not think appropriate, I had talked about changing the way of how the fragment shader is built for easy extension without having create a custom shader for this, like a node material #5673 for the LayeredTexture that I want implement. Away3D make this architecture very well, I possibly do something like node material for the next updates of sea3d.

video demo of sea3d LayeredTexture.
https://www.youtube.com/watch?v=lQ-VIni5Q68

You mean extending THREE objects? Are all those extensions that really necessary?
I guess it's okay for application code to clobber the THREE objects, but ideally, it would be a lot cleaner to extend the library with new classes (e.g. Sea3DSkinnedMesh extends THREE.SkinnedMesh).

Yes has several extensions, all with a purpose. Sea3DSkinnedMesh seems like a good idea, just do not know if I could with THREE.Object3D for relative keyframe animation and Morph+Skin also be a problem with the interface.

I will do everything possible to improve this, possibly I make a separate version for this extension.

Cheers

@WestLangley
Copy link
Collaborator

@sunag material.emissive is used for objects that glow. You are using it for another purpose.

Are you hacking the shader code because you want material.ambient to be different from material.color -- and in r.71 they are hardwired to be the same?

@sunag
Copy link
Collaborator Author

sunag commented Jul 23, 2015

@sunag material.emissive is used for objects that glow. You are using it for another purpose.

I converted emissive to ambient because I have not found another method to do this without custom shader. The best way for me here is create a node material even for custom layers in albedo output without edit shader code. I can do this in the next sea3d updates

@mrdoob
Copy link
Owner

mrdoob commented Jul 25, 2015

morph seems that still is not working in r72dev?

I think it should be working fine now.

@sunag
Copy link
Collaborator Author

sunag commented Jul 25, 2015

I think it should be working fine now.

Thanks! Works great.

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.

4 participants