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

How to load 3ds with bmp file as texture? #164

Open
GoogleCodeExporter opened this issue Aug 7, 2015 · 4 comments
Open

How to load 3ds with bmp file as texture? #164

GoogleCodeExporter opened this issue Aug 7, 2015 · 4 comments

Comments

@GoogleCodeExporter
Copy link


The jsc3d works very nice. I have a question when load 3ds files:

How to load 3ds file with a texture of bmp file?

For example: RoseR.3ds with RoseRT.bmp.  
                  -> currentMaterial.colorMap.url = 'rose/RoseRT.bmp'; ???

    var canvas = document.getElementById('cv');
    var viewer = new JSC3D.Viewer(canvas);
    viewer.setParameter('SceneUrl', 'rose/RoseR.3ds');
    viewer.setParameter('InitRotationX', 0);
    viewer.setParameter('InitRotationY', 0);
    viewer.setParameter('InitRotationZ', 0);
    viewer.setParameter('ModelColor', '#AAAAAA');
    viewer.setParameter('BackgroundColor1', '#007FFF');
    viewer.setParameter('BackgroundColor2', '#007FFF');
    viewer.setParameter('RenderMode', 'texturesmooth');
    viewer.setParameter('MipMapping', JSC3D.PlatformInfo.supportWebGL ? 'off' : 'on');
    viewer.setParameter('Renderer', 'webgl');
    viewer.init();
    viewer.update();


Thank you.

Original issue reported on code.google.com by [email protected] on 11 Jul 2015 at 1:49

@GoogleCodeExporter
Copy link
Author

You can get test 3ds files from 
http://www.toucan.co.jp/3DCG/3ds/FlowerModelsE.html

Original comment by [email protected] on 11 Jul 2015 at 1:51

@GoogleCodeExporter
Copy link
Author

Found a way to load texture bmp file as following:
      // create a new Texture instance
      var myTexture = new JSC3D.Texture;
      // setup the handler which will be called when texture is ready
      myTexture.onready = function() {
            // assume a single model has already been loaded
            var scene = viewer.getScene();
            var myMesh = scene.getChildren()[0];
            // set texture to the model
            myMesh.setTexture(this);
            // notify viewer to deliver a new frame
            viewer.update();
      }
      // begin to load this texture from a given url
      myTexture.createFromUrl('rose/RoseRT.bmp');

Original comment by [email protected] on 11 Jul 2015 at 2:18

@GoogleCodeExporter
Copy link
Author

This ticket can be closed. Thanks.

Original comment by [email protected] on 11 Jul 2015 at 2:20

@GoogleCodeExporter
Copy link
Author

The only drawback is jsc3d does not have good lightness to the object. 

You can compare with http://www.ibiblio.org/e-notes/webgl/deflate/roseR.html

A little disappoint with the results. Any way to improve the lightness?

    var canvas = document.getElementById('cv');
    var viewer = new JSC3D.Viewer(canvas);
    viewer.setParameter('SceneUrl', 'rose/RoseR.3ds');
    viewer.setParameter('InitRotationX', 0);
    viewer.setParameter('InitRotationY', 0);
    viewer.setParameter('InitRotationZ', 0);
    viewer.setParameter('ModelColor', '#AAAAAA');
    viewer.setParameter('BackgroundColor1', '#007FFF');
    viewer.setParameter('BackgroundColor2', '#007FFF');
    viewer.setParameter('RenderMode', 'texturesmooth');
    viewer.setParameter('MipMapping', JSC3D.PlatformInfo.supportWebGL ? 'off' : 'on');
    viewer.setParameter('Renderer', 'webgl');
    viewer.init();
    viewer.update();

      var myTexture = new JSC3D.Texture;
      myTexture.onready = function() {
            var scene = viewer.getScene();
            var myMesh = scene.getChildren()[0];
            myMesh.setTexture(this);
            viewer.update();
      }
      myTexture.createFromUrl('rose/RoseRT.bmp');

Original comment by [email protected] on 11 Jul 2015 at 2:34

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant