Closed longsamaa closed 9 months ago
Are you sure the issue is related the projectionMatrix
? I can't immediately see anything in the code that should affect this based on that value. Could it be the material settings? How does it look with the PerspectiveCamera
?
Are you sure the issue is related the
projectionMatrix
? I can't immediately see anything in the code that should affect this based on that value. Could it be the material settings? How does it look with thePerspectiveCamera
?
I just reassigned the projection matrix to the camera. Let threepp render my model like this: https://docs.mapbox.com/mapbox-gl-js/example/add-3d-model/ Do I need to edit anything to make threepp render correctly? Thank you!
I really can't say. The example provided isn't plain three.js either (external library / custom shaders etc.), so you'd have to share your code I think.
yep sure!! i use threepp with maplibre native with my custom layer. I initialize scene and camera in my layer like this:
main_render = std::make_shared<threepp::GLRenderer>(window_size); // size of maplibre native window
main_render->autoClear = false;
main_render->checkShaderErrors = true;
main_camera = std::make_shared<threepp::Camera>();
main_scene = threepp::Scene::create();
main_obj = loader.load("\\data\\models\\collada\\youbot.dae");
main_obj->rotateX(M_PI * 0.5);
and when rendering I use this:
auto matrix = par.matrix // matrix of tile maplibre
threepp::Matrix4 m;
m.fromArray(matrix.data());
main_render->resetState();
main_camera->projectionMatrix = m;
main_render->render(*main_scene, *main_camera);
My model has the correct position on the tile. very interesting but it seems the dept test has an error like this:
You have autoClear = false
, but I don't see any clearing of the threepp rendering?
yeah I tried clearing of the threepp rendering before render:
main_render->clearDepth();
main_render->clearStencil();
But it still doesn't work
Could you share more complete example code (or complete proeject) that highlights the issue?
Yes, how can I share source code with you?
You could zip the project to me by mail (visible on my profile)
sorry for the late reply!!. I get a error depth when when I use threepp with 1 available gl context. When i use Threepp::Canvas to create opengl context then threepp renders correctly.
Are you saying the issue was related to using a custom Window/OpenGL context?
Might I ask what you used?
tks for help!. I can fix it by turning off glCullface when render. My scene can render correctly. Nice project!!
I already have a projection matrix. For each render I want to use threepp to render the model with that projection matrix. I reassigned the camera's projection matrix like this:
My model was rendering properly on screen. But it seems the depth test doesn't work. Is there any way for me to fix this ? Thanks for help!