It keeps showing up as blank or a blank canvas, I set a plane for a model and only the lights and shadows from it showed, my orbit controls worked and everything - is there something the matter with my model?
Cool yeah! I fixed that bit - I think I was trying to make a custom fragment shader/vertex Shader to get a rainbow chrome material on it. Do you know of an easier way to do that?
I’ve updated the import + THREE from ‘three’; line and now all my imports are loading properly, looks like it’s a black screen, which is better than before. So I’ll try to add a few more lights and keep ya’ll updated.
BUT if you have any suggestions on getting this rainbow iridescent effect, lmk.
You should locally download the model and them import it, or one thing what I do is create a Glitch and upload the model as an asset and you will have a cdn URL that you can use to import it.
import vertexShader from './shaders/vertexShader.vert';
import fragmentShader from './shaders/fragmentShader.frag';
import glbFileUrl from './models/pow-mylar-grape-escape.glb';
import { DRACOLoader } from 'three/addons/loaders/DRACOLoader.js';
also rename the shader to use the appropriate extension, otherwise the plugin doesn’t compile it correctly.
Copy over Draco Decoder files to /public/draco from /node_modules/three/examples/jsm/libs/draco
Replace the loading code:
const loader = new GLTFLoader();
const dracoloader = new DRACOLoader();
dracoloader.setDecoderPath( '/draco/' );
loader.setDRACOLoader( dracoloader );
loader.load(glbFileUrl, (gltf) => {
add assetsInclude to vite.config.mjs if not already:
Anything in /public/ you can use as simple string url ‘/file’. If it’s not in /public you have to import it, so it get’s bundled and/or copied over to the dist folder. Special file extensions will have to appear in assetsInclude. Also see Vite Static Asset Handling