rhgrafix Posted December 23, 2017 Share Posted December 23, 2017 Hi, I'm testing code at: https://www.babylonjs-playground.com/?shadows and want to try my own image for the ground. On line 35 I put “http://www.rhgrafix.com/images/ground.jpg” instead of "textures/ground.jpg", I control+click on it and sure enough my image comes up in browser, but when I hit Run I just get the default checkered image. Why is this happening? Thanks, R.L. Hamm Quote Link to comment Share on other sites More sharing options...
Wingnut Posted December 24, 2017 Share Posted December 24, 2017 Hiya @rhgrafix, welcome to the forum. This could be happening because of CORs security. rhgrafix.com might need to be configured for CORs. Try this... https://tinyurl.com/ycgow6mn It is a Google IMAGE search... for 'ground texture', and I set the tools for 'labeled-for-reUse'... AND added 'wikimedia'... because I KNOW wikimedia images are always CORs-clear. So, click some of those images, get some URLs to some of those textures, and see if THOSE work as a URL for your texture. IF they do, then yeah, your server needs to be CORs activated, and I have no idea how to do that. Sorry. Others know how... and so does a web search. I also have a free github account, and it lets me store a few textures there, and that is a CORs-cleared way. (I'm no pro on CORs stuff, sorry. Web reading available) Somewhere in your f12 browser tools, there may be a 'net' tab/choice... that will show the results of all file-retrievals attempts... that happened during the scene RUN. In there, you might see a CORs security report... which might have happened when that texture tried to load. Hope this helps. Report back, please. thx. aWeirdo 1 Quote Link to comment Share on other sites More sharing options...
aWeirdo Posted December 24, 2017 Share Posted December 24, 2017 Hi @rhgrafix Definitely a CORs issue as @Wingnut pointed out, i suggest using github raw; https://www.babylonjs-playground.com/#QM62ZM Quote Link to comment Share on other sites More sharing options...
rhgrafix Posted December 24, 2017 Author Share Posted December 24, 2017 Thanks for replying and for the link to the textures. 18 hours ago, Wingnut said: Hiya @rhgrafix, welcome to the forum. I’ve never heard of CORs-clear images, I read up on it a bit and saw some code on mozilla.org but don’t understand yet where it goes. I do have a working version of it on my domain: http://www.rhgrafix.com/shadows.htm Is it the babylon playground that is rejecting my domain/image? I will ask my webhost (FastComet) on how to enable CORs, there was no trace of it in their help section. One more problem: When I was trying to run it local, on my C:drive, I have with my index, the folder “textures” with the 2 images in it, and the code calls as “textures/ground.jpg” and it won’t work, other similar pages work locally (I don’t have a server emulator except GitHub Desktop and I’m not using it). So I am using the same images from the playground, bypassing my domain and it doesn’t work, any ideas on that? Thanks much and Merry Christmas! R.L. Hamm Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted December 26, 2017 Share Posted December 26, 2017 It is not the playground which rejects the request but your host. It will reject the request as it does not accept request from the PG domain. You have to check with your webhost here Regarding accessing local files: this should not work as this is against security constraints. The best option is to run a local server Quote Link to comment Share on other sites More sharing options...
rhgrafix Posted December 26, 2017 Author Share Posted December 26, 2017 2 hours ago, Deltakosh said: It is not the playground which rejects the request but your host. It will reject the request as it does not accept request from the PG domain. You have to check with your webhost here Ok, thank you, I submitted a ticket to my domain. About the local server, I have certain indexes that work fine locally with an "images" folder in same folder as the index.html, what exactly determines whether or not it works? Something in the js files that are called up? Thanks! Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted December 27, 2017 Share Posted December 27, 2017 Yeah some files are not considered harmful (like images) but others are (like JS :)) Quote Link to comment Share on other sites More sharing options...
rhgrafix Posted January 11, 2018 Author Share Posted January 11, 2018 I finally got this resolved, I added SSL to my domain and now it works, it solved the same problem I was having on CodePen and probably explains why a slew of other places I tried didn't work. My domain host gives us free access to Let’s Encrypt which was a really easy fix, even I figured it out and set it up in about 2 minutes :O) . Now I know CORS exists, I don’t understand it but I hope I don’t have to deal with it anymore. I’m not sure how many other domain hosts offer free SSL (https) but please spread the word of this possible fix to paths to files not working, it caused me hours upon hours of frustration. Thanks again for helping me. R.L. Hamm GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.