Hi everyone! By advance, sorry for my syntax errors, english is not my native language and I don’t master it.
I exported a character mesh model from 3dsMax with a multiMaterial attached to it in the intention to seperate the face and the body textures renderings, because I animate the face texture for expressions and the body texture has no changes, excepting after some click events on the scene. You can maybe understand better what I’m talking about here, testing to click on the colored spheres on the ground and wait for the random idle animation face time (in seconds) of the character (sorry if it’s too long to wait, i’ll balance it) :
Searching a way to have dynamic textures rendering changes without clipping, I tried to test the dynamic texture after reading a discussion on the forum about it, but!
When I attach the dynamic texture to the body material, push the body material on the multiMaterial and edit the submeshes indexes to render the both materials, draw the loaded image with the dynamic texture context and update, the body texture is rendering as a black color on my local version and as transparent on this playground :
I surely missed something on the dynamic texture application but I don’t understand what. I tested to play with many attributes of the DynamicTexure Object, delete the multimaterial to test it in a simplest way, trying with .jpg or .png picture but nothing works…
You can uncommented the standard diffuse texture line (54) on the top of the dynamic diffuse texture line (55), comment this last line and run the playground again to see by the good diffuse texture rendering that it’s not either a problem about a wrong image path…
If someone has an idea to solve it, i’m going to be very grateful
I’m sorry but I don’t understand this error message, and I don’t know what is the CORS enforcing. I saw in the Firefox console F12 tools that the onLoad event line creates an error message, I forgot to say that in the first topic message, sorry. However the message was not talkative as yours, it only returns “Unable to import meshes from scene.babylon: Error in onSuccess callback”.
Thank for the test you did. I tried to give the width and height loaded picture setup on the dynamictexture declaration (as you did ) before creating the topic, but it didn’t work too… The playground gives the same result :
I will search about the server enforcing CORS, thank you
@Deltakosh do you need that I put my textures somewhere else the dropbox servers? The documentation talks about https://imgur.com/. Can you debug without cross-origin resource sharing troubles from this domain?
Ok, I understood that the error message you shared came from the Google Chrome Playground F12 Tools Console . Actually, the playground console is more talkative than in my local Firefox version.
Thank you for sharing this link, reading this documentation a new time made me realize that I didn’t read the wiki CORS specifications. However, I followed it when I built the playground and copy/past the babylon scene and pictures dropbox paths. I also tried with the diffuse texture stored in https://imgur.com/ as specified in this link but the security error message persists in the playground, without changing the initial material from the 3dsMax scene this time, worse than with the dropbox path…
I initially wanted to try those methods in the playground to avoid to configure my web server for https protocol now, considering that is not my priority…
I discovered that the standard diffuse texture is not rendered in Google Chrome but works in Firefox without returning a security error message in the playground. I write it in the case it can be usefull to know that about the playground.
Concerning the CORS behaviour on my online version, i don’t uderstand why all my XMLHttpRequests work good (clicking on the right top screen button for example to load and create the events contents), all the standard textures load and are displayed without problems, and only the diffuse texture in the dynamic texture doesn’t render good. And the browsers return a success loading feedback in the F12 Tools Network…
I cleared all the console messages on my online version to allow you to take a look inside if it’s possible/usefull : http://51.68.226.225/
I also added a appendChild(bodyDiffuse) line in the scene script to check if the loaded image can really be displayed, and it can be… The html image element is created in the #content div.
If you or someone definitely can’t do anything with it, I’ll finish all I have to do before configuring my server for https protocol and allow the playground to load the texture from it and I’ll come back on the topic.
Please open this link with Firefox, it doesn’t work with Google Chrome. You can notice that this rendering works uncommenting the standard diffuse texture attribution line (54) and commenting the dynamic diffuse texture attribution line (55). In image, it gives this :
With the same code as in the playground #4 you shared in your last message, apart from the dropbox paths babylon scene and textures I only wrote for the playground purposes. My local and online versions have relative paths.
Error: WebGL warning: drawElements: TEXTURE_2D at unit 0 is not a depth texture with TEXTURE_COMPARE_MODE, but the shader sampler is a shadow sampler. 2 babylon.js:16:114011
It might help to if you use babylon.max.js in your on-line version to get closer to where errors are being logged.
I’m using a dynamic texture in the diffuseTexture of a standard material pushed in a multimaterial assigned on the character mesh, wich has 2 subMeshes, one for the face and the other one for the body.
The character body texture is black in my local and online version when I use the dynamic texture, and not rendered in the playground due to the CORS security problem returning by the SecurityError on wich @Deltakosh and @JohnK told.
But, if I use a standard texture for the diffuseTexture of the body material, it works good on my local and online version and on the playground only with Firefox. Like this
Chrome render the red and black default babylon material like in this picture, showind that the texture isn’t loaded, so it doesn’t work :
It’s not the point of my issue, but I talk about it because I discovered it in the tests i did after having talked to @Deltakosh. I’m only talking about it in the goal to give the information in a maybe usefull way for anyone…
A difference to understand between my local/online version and the playground version is that in my local/online version I use relatives paths and in the playground I use dropbox external paths as specified in this documentation link : https://www.babylonjs-playground.com/#0EL6Y9#4 shared by @Deltakosh.
I put the scene.min.js in my on-line version but nothing seems to change. The F12 Tools Console still returns the same message.
What do you mean with “get closer to where errors are being logged” ? I never used .min.js files until now.
First I built a little local scene only with the code I needed as in the playground. I added an appendChild() function to create the html image element from the loaded picture to be sure that this picture was really loaded and usable. I had this result, the same as usual :
Then I tried to see what was possible with an other texture and the result was the following, make me sure that the loaded picture was drawn in the canvas :
It was like only the first pixel of the loaded picture was drawn in the whole diffuse texture.
So after some tests, l found that setting the 1 value to the wrapU and the wrapV attributes, and removing the appendChild() function for the loaded picture in my case, gave the expected result :
Thank you for your playground examples with the local textures. I understood why the playground didn’t work with external sources.
And thank you for all your answers too
If someone doesn’t understand the way I’m describing how I solved the problem, don’t hesitate to ask me anything.