Code Monkey home page Code Monkey logo

poly-sample-web's People

Contributors

btco avatar ianmacgillivray avatar mrdoob avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

poly-sample-web's Issues

Redirection Cross-Origin from googleapis to vrassets

Hello Google Team,

We experience issues with the Web samples of Poly API : Today, the search sample is not working anymore because of this issue :

7:1 Failed to load https://poly.googleapis.com/downloads/6XXj6DSBb08/dH3skx1SVUc/materials.mtl: Redirect from 'https://poly.googleapis.com/downloads/6XXj6DSBb08/dH3skx1SVUc/materials.mtl' to 'https://vrassets-pa.googleusercontent.com/downloads/6XXj6DSBb08/dH3skx1SVUc/materials.mtl' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost/workspace' is therefore not allowed access.

We have currently hot fixed the problem by replacing the request URL of the MTL/OBJ Loader in the script.

Regards

search-sample OBJ format models don't load textures.

When loading an OBJ format object with textures, the texture loads fail as they attempt to load from server, rather than the resources actual remote directory specified by its url.

A workaround/hack is to insert the following code in the loading code in search-sample->createImage, where the MTLLoader is created:

var loader = new THREE.MTLLoader();

loader.setCrossOrigin(true);
for(var i=0;i<format.resources.length;i++){
	var resource = format.resources[i];
	if(resource.contentType.indexOf("image/")==0){
		var texPathEnd = resource.url.indexOf(resource.relativePath);
		if(texPathEnd!=-1){
			loader.setTexturePath(resource.url.slice(0,texPathEnd));
			break;
		}
	}
}

This hack finds the first image/* resource, subtracts the filename from the URL, then sets the MTLLoaders "texturePath" to that. MTLLoader uses this path in subsequent texture load attempts.
Note, this triggers cross origin request, which requires setting loader.setCrossOrigin(true);

-hth

search-sample Some assets cause renderer to throw exceptions and not render.

For instance, the "tasmanian wolf" (only occurrence when searching TASMANIAN)
assets/2yEZA3TLwVI

This is due to "lighting" being set on the LineBasicMaterial for wireframe objects.
This can be fixed by adding the following code inside "createImage" after:

	loader.load( urlOBJ, function ( object ) {
        object.traverse((node)=>{
		var materials = [];
		if(node.material instanceof Array){
			for(var i=0;i<node.material.length;i++){
				if(node.material[i].type == "LineBasicMaterial"){
					node.material[i].lights = false;
				}
			}
		}else{
			if(node.material){
				if(node.material.type == "LineBasicMaterial"){
					node.material.lights = false;
				}
			} 
		}
	})

How to keep Poly effects (lights, shaders or materials)?

This is more of a question to be honest. Would it be possible to keep the effects applied by poly.google on the model we import when using the API? If it is not possible to have them imported by Poly could you just give some clues on how to obtain the visual effect as Poly ? If it is not too much to ask ^^

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.