I did host now the textures from external sources our own server, but I got an issue, whenever I use my custom material picker, it seems like it removes the material. like this screenshot below:
I’ve use the material.baseTexture.name and I couldnt make it appear anything, what are the methods inside material? my goal is to show the base texture name instead of the material name.
@Half_stack can you configure the server to return one of the following two headers with texture related responses: Access-Control-Allow-Origin: smartview-media.shapespark.com
or Access-Control-Allow-Origin: *
Without such header browsers won’t allow the textures from your server to be used in WebGL.
It looks like CloudFlare that your server is using still returns a cached texture without this header. When I inspect the header in the Network panel of the browser debug console (F12) the header is missing and there is a cf-cache-status: HIT header that indicates that the response is served from CloudFlare cache. If I open the texture with some string added to the URL to bypass the cache, like: https://justcaravansaustralia.com.au/sample/textures/floor1_156_parquet_medium_color_texture.jpg?foo=bar the header is present.
You can wait until CloudFlare cache clears, or force CloudFlare to refresh the cache.
Thank you @jan, It solved my problems for the textures.
I have 2 questions for the API
Is there a way to target this for the custom material picker.
Also I plan to create a separate button to trigger the same functionality with this arrow:
this would make our custom picker uniform with the separate button, just want to ask what function do I trigger to show and hide similar with that arrow on that screenshot.
You can set these material properties in the following way:
var material = viewer.findMaterial(‘someMaterialName’);
material.baseColorTextureCorrection = true;
material.baseColorTextureContrast = 0.8;
material.baseColorTextureHslOffset.h = 0.1;
material.baseColorTextureHslOffset.s = 0.2;
material.baseColorTextureHslOffset.l = 0.3;
material.setUniforms();
We are finalizing a new Shapespark release that will add functions to hide menu via API. We are adding a property Viewer.menuVisible that allows to set and get the menu visibility. We are also adding Viewer.onMenuVisibilityChanged(callback) to allow to synchronize the visibility state of custom menu elements and built-in elements.
There are two options that could allow to customize menu based on a user location (See this doc):
You can listen for notifications when the user switches to views using right-top menu.
You can query camera x.y.z location
Shapespark doesn’t have semantic information about a model (room names, room boundaries, etc.), so it is not possible to for example get notifications when a user enters a kitchen.