#Issue with loading textures and Images

28 messages · Page 1 of 1 (latest)

drowsy kelp
#

keep in mind that to load any file locally you still need a locally-running webserver

#

with properly set up routing

#

(vite will do that for you automatically)

#

it's not possible to access local files without a webserver

#

you just give them it together with vite

#

wait, actually for an assignment it may be possible cat_think

#

if they'd just opened the html file in the browser directly, not via an URL

#

but then use ./ instead of / for your textures

#

and check devtools console if the paths are correct

drowsy kelp
#

we can guess here - but devtools will just tell you right away

#

also - in this structure all your textures look to be at the same level as the index file, and in your code they are in ./textures dir?

#

no, not blah

#

read what the blah is - that's exactly the point.

#

compare it to the actual correct path

drowsy kelp
#

pls show screenshot of Console & Network panels of devtools

#

(including header of that devtools console window 🙏 )

#

een moment

#

Just needed to test locally

#

nope - by default Three / WebGL does not allow rendering potentially tainted images (ie. images loaded from shady places, like file:// protocol)

#

trying to avoid CORS when loading the texture via canvas / img will result in the following:

#

long story short - you need to either put these images online and load the via URLs, or submit your assignment together with a runnable webserver script (ex. vite)

drowsy kelp
#

I did reply - but I ain't reading whole snippets of code

#

if there's something specific that's blocking you - just ask, but debugging someone elses code takes way too much time

west sandal
#

assuming you are using vite

do npm run build

put the contents of the dist folder on a public github repo,
enable github pages in settings ,
and your site should run on the www