nwpointer / three-landscape

React-three-fiber compatible abstractions that make it easier to render high quality landscapes scenes

Home Page:https://three-landscape.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pure threejs implementation not working

grimdeathr opened this issue · comments

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
            }) 
        }) 
    }) 
})

})`

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?

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

@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

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

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

Seems to fail on :

computeDiffuse

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

thanks for the sandbox Ill take a look

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