Coder Social home page Coder Social logo

Problem viewing obj files? about jsc3d HOT 10 OPEN

humu2009 avatar humu2009 commented on May 23, 2024
Problem viewing obj files?

from jsc3d.

Comments (10)

GoogleCodeExporter avatar GoogleCodeExporter commented on May 23, 2024
It seems that the model file is not loaded successfully. What browser are you 
using? How about other demos?

Original comment by [email protected] on 5 Jul 2013 at 3:18

from jsc3d.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 23, 2024
Thank you for getting back to me.

This example works fine turtle.html, the obj file examples do not.

turtle.html works in Firefox 22 and IE 10, bmw.html does not work.

Original comment by [email protected] on 5 Jul 2013 at 3:40

from jsc3d.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 23, 2024
Does this http://jsc3d.googlecode.com/svn/trunk/jsc3d/demos/bmw.html works?

Original comment by [email protected] on 5 Jul 2013 at 4:14

from jsc3d.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 23, 2024
The problem is not viewing your online samples, the problem is using your 
online samples offline.

Yes, I can view this online sample along with all your online samples without 
issue.

I can not get your sample to work on my machine or my web server.  Some 
component or path is missing.  

Maybe the issue could be related to how this portion of the code has been setup:

JSC3D.Viewer.prototype.loadScene = function() {
                this.scene = null;
                this.isLoaded = false;

                if(this.sceneUrl == '')
                                return false;

                var lastSlashAt = this.sceneUrl.lastIndexOf('http://jsc3d.googlecode.com/');
                if(lastSlashAt == -1)
                                lastSlashAt = this.sceneUrl.lastIndexOf('\\');

                var fileName = this.sceneUrl.substring(lastSlashAt + 1);
                var lastDotAt = fileName.lastIndexOf('.');
                if(lastDotAt == -1)
                                return false;

                var fileExtName = fileName.substring(lastDotAt + 1);
                var loader = JSC3D.LoaderSelector.getLoader(fileExtName);
                if(!loader)
                                return false;

                var self = this;

                loader.onload = function(scene) {
                                self.setupScene(scene);
                };

                loader.onerror = function(errorMsg) {
                                self.scene = null;
                                self.isLoaded = false;
                                self.isFailed = true;
                                self.errorMsg = errorMsg;
                                self.update();
                };

                loader.onprogress = function(task, prog) {
                                self.reportProgress(task, prog);
                };

                loader.onresource = function(resource) {
                                if((resource instanceof JSC3D.Texture) && self.isMipMappingOn && !resource.hasMipmap())
                                                resource.generateMipmaps();                  
                                self.update();
                };

                loader.loadFromUrl(this.sceneUrl);

                return true;
};

...but, we have changed the url http://jsc3d.googlecode.com/ to ours without 
any luck.

Any additional help would be great.  Ideally, a zipfile with a working example 
that works on a different server than yours.  This then, will more than likely 
work on any server.

Thanks,

Kevin

Original comment by [email protected] on 5 Jul 2013 at 5:21

from jsc3d.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 23, 2024
I don't think the code snippet you posted above is logically correct. This line

  var lastSlashAt = this.sceneUrl.lastIndexOf('http://jsc3d.googlecode.com/');

should be

  var lastSlashAt = this.sceneUrl.lastIndexOf('/');

Its purpose is to extract the file name and then guess the file type by the 
extension. If you changed that it won't work properly.

Additionally, when sending the URL of a model file to jsc3d (through 
viewer.setParameter() before initialization or viewer.replaceSceneFromUrl() at 
runtime), it's recommended to specify a relative path instead of an absolute 
one. The latter may result in an cross-domain issue that makes jsc3d fail to 
access the model file.

Original comment by [email protected] on 6 Jul 2013 at 2:29

from jsc3d.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 23, 2024
Thank you for your assistance.

I can get the following attachment to work offline inside Firefox 22 but not IE 
10.

Any help would be great!

Thanks,

Kevin

Original comment by [email protected] on 8 Jul 2013 at 5:28

Attachments:

from jsc3d.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 23, 2024
I see. It is relative to a defect of jsc3d's obj loader implementation. It 
tends to generate incorrect face indices and lose materials when parsing 
obj/mtl files exported by some versions of 3DsMax. These peculiar data make the 
browser either do not draw anythig or draw with abnormal long delay. All 
depends.

This has already been fixed in the latest repository edition but not made a new 
release yet. You can download it using svn tools or from the direct link 
http://jsc3d.googlecode.com/svn/trunk/jsc3d/jsc3d.js.

I tested your model using IE9 and a local server (see the attached picture) and 
it looks all right.

Original comment by [email protected] on 9 Jul 2013 at 11:21

Attachments:

from jsc3d.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 23, 2024
I do not have any experience in programing and we use joomla for our web site. 
It is about 3d scanning and printing. We want to show our scanns in 3D using 
jsc3d.
we have copied the jsc3d and all related files under image/test/jsd3d/.... and 
our obj file is under image/test/...
I have tried to use the coding:
<!DOCTYPE html>
<html>
    <head>
        <title>Getting Started with JSC3D</title>
    </head>
    <body>
        <canvas id="cv" width=640 height=480>
        It seems you are using an outdated browser that does not support canvas.
        </canvas>
        <script type="text/javascript" src="image/test/jsc3d/jsc3d.js"></script>
        <script type="text/javascript">
            var viewer = new JSC3D.Viewer(document.getElementById('cv'));
            viewer.setParameter('SceneUrl',         'image/test/test.obj');
            viewer.setParameter('ModelColor',       '#CAA618');
            viewer.setParameter('BackgroundColor1', '#E5D7BA');
            viewer.setParameter('BackgroundColor2', '#383840');
            viewer.setParameter('RenderMode',       'flat');
            viewer.init();
            viewer.update();
        </script>
    </body>
</html>

The only thing happened is that it has created the 640x480 area.

Can you help me with the coding please.??

Original comment by [email protected] on 19 Oct 2013 at 10:41

from jsc3d.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 23, 2024
i'm trying to get your demos to work using the latest release of jsc3d.  
neither on my local machine nor on my webserver am i able to load most the 
demos--the canvas is drawn fine, but none of the demos that specify a sceneurl 
work.  the message that is displayed is "failed to load obj file."

with certain demos, like jollyship.html, the model shows up, but these demos 
don't have a sceneurl specified.

Original comment by [email protected] on 22 Oct 2014 at 9:45

from jsc3d.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 23, 2024
i solved the problem by making sure the .obj mimetype is able to be served by 
the webserver.  thanks!

Original comment by [email protected] on 22 Oct 2014 at 9:51

from jsc3d.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.