nwpointer / three-landscape

React-three-fiber compatible abstractions that make it easier to render high quality landscapes scenes
https://three-landscape.vercel.app
MIT License
138 stars 19 forks source link

pure threejs implementation not working #18

Closed grimdeathr closed 2 years ago

grimdeathr commented 2 years ago

Having trouble getting this going. Seems onBeforeCompile does not run.

`new GLTFLoader().load('models/mesh.glb', (gltf) => { model = gltf.scene scene.add(model) new TextureLoader().load('models/splatmap_01.jpg', (texture) => { new TextureLoader().load('models/brush1.png', (brush1) => { new TextureLoader().load('models/brush2.png', (brush2) => { new TextureLoader().load('models/brush3.png', (brush3) => { model.material = new SplatStandardMaterialImpl({_splats:[texture], _diffuseMaps:[brush1, brush2, brush3]}); console.log(model.material)

                model.material.needsUpdate = true
            }) 
        }) 
    }) 
})

})`

grimdeathr commented 2 years ago

turns out onbeforecompile was not being called, but now that works

However there is now a shader error.

At a minimum are all the parameters needed for the material to work?

nwpointer commented 2 years ago

Hey @grimdeathr thanks for trying out the lib! If you could share a codesandbox with your code its much more likely I'll be able to help

grimdeathr commented 2 years ago

@nwpointer in the process of creating that example here :

https://codesandbox.io/s/adoring-grothendieck-uz6nmr

While I do that, is it possible that there could be a plain vanilla JS and threejs example without react ?

im having to convert useProgressiveTextures to vanilla JS as it contains react hooks, and some of the other files which is confusing things

grimdeathr commented 2 years ago

Having some problems

/src/three-landscape/useProgressiveTexture.js: Support for the experimental syntax 'classProperties' isn't currently enabled (51:11):

Same issue, had to comment out those properties at the top of the classes

not sure how to fix this in codesandbox

grimdeathr commented 2 years ago

i just want to be able to implement the shader in a simple manner in pure threejs

grimdeathr commented 2 years ago

Seems to fail on :

computeDiffuse

grimdeathr commented 2 years ago

No idea how to decouple this from React unfortunately will have to leave it there

nwpointer commented 2 years ago

thanks for the sandbox Ill take a look

grimdeathr commented 2 years ago

Turns out all i had to do was remove the React.CreateElements("mesh etc and it works