aneeshtan / jsc3d

Automatically exported from code.google.com/p/jsc3d
0 stars 0 forks source link

Problem viewing obj files? #29

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Download the zip package and extract files
2. Upload files to the server
3. Attempt to run the a demo for example:  bmw.html

What is the expected output? 

View a 3d version of a bmw

What do you see instead?

failed to load obj file "bmw/bmw.obj", the file exists but does not display?

What version of the product are you using? 

jsc3d-full-0.9.8.zip

On what operating system?

Windows 7 and on a webserver

Please provide any additional information below.

Original issue reported on code.google.com by mr.kevin...@gmail.com on 5 Jul 2013 at 12:35

GoogleCodeExporter commented 9 years ago
It seems that the model file is not loaded successfully. What browser are you 
using? How about other demos?

Original comment by Humu2...@gmail.com on 5 Jul 2013 at 3:18

GoogleCodeExporter commented 9 years ago
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 mr.kevin...@gmail.com on 5 Jul 2013 at 3:40

GoogleCodeExporter commented 9 years ago
Does this http://jsc3d.googlecode.com/svn/trunk/jsc3d/demos/bmw.html works?

Original comment by Humu2...@gmail.com on 5 Jul 2013 at 4:14

GoogleCodeExporter commented 9 years ago
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 mr.kevin...@gmail.com on 5 Jul 2013 at 5:21

GoogleCodeExporter commented 9 years ago
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 Humu2...@gmail.com on 6 Jul 2013 at 2:29

GoogleCodeExporter commented 9 years ago
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 mr.kevin...@gmail.com on 8 Jul 2013 at 5:28

Attachments:

GoogleCodeExporter commented 9 years ago
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 Humu2...@gmail.com on 9 Jul 2013 at 11:21

Attachments:

GoogleCodeExporter commented 9 years ago
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 mu...@sirinfamily.com on 19 Oct 2013 at 10:41

GoogleCodeExporter commented 9 years ago
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 bptarp...@gmail.com on 22 Oct 2014 at 9:45

GoogleCodeExporter commented 9 years ago
i solved the problem by making sure the .obj mimetype is able to be served by 
the webserver.  thanks!

Original comment by bptarp...@gmail.com on 22 Oct 2014 at 9:51