kool-engine/kool

(help wanted) "Attach" a model to the CharacterTrackingCamRig

Protoxy22 opened this issue · 7 comments

Hi, I have some difficulties to "attach" an object to the camera.
I've tried different matrix transformations, but I think I'm missing something

Here is my code:
image

gunModel is a Model (you could imagine that)

Here is a the result:
https://streamable.com/c9sq26

I also tested to translate to the real camera position by translating X by 0.8

I have read different tutorials about transformations, but I can't figure it out.
Thank you very much for your work

PS: I asked the last week for an arm64 compatibility, I succeeded to build the bindings + natives, but there was too much problems to solve with opengl / lwjgl 3.3.0. I'll try to continue later, I'll content to Windows for now

Found it ! I had to use the camera position instead of the character

image

Preview: https://streamable.com/bplrek

I just have some glitches when I sprint or moves, I could use a linear interpolation to fix it

There is also sort of issue on the blue sky too, there is brown pixels and artefacts
image

Looks nice! Another, maybe simpler, solution is to put your camera and your model into a Group and only move that group around. This way, camera and gun are in the same reference frame and should always have the same orientation and distance.

For the broken sky: I just noticed this in my tree demo as well. I guess I broke that some time ago when I fiddeled around with the skybox generator.

Sky is fixed!

Cool, thanks for the fast reply. I will test with your solution tomorrow

Have a good night

I resolved the laggy position/rotation, by invoking the method sync() of ProxyCamera before translate/rotation the gunModel.

By the way, one question, do you know how can I disable this kind of blur/specular on my gun texture (the real-time PBR Methodoly)

I would like have a raw albedo textures, like this
image

Preview video: (what I have in game)
https://user-images.githubusercontent.com/30320751/136268867-5ea8e935-6e8c-4a82-a67c-9679e566a202.mp4

Second question is there a runnable not related to the rendering pipeline, to use some functions with for example (20 ticks / second), for entites updates, and maybe multiplayer synchronisation in the future

Thanks
Protoxy.

I assume your model is a gltf model? By default, the gltf loader creates a PbrShader for each mesh in the model and uses the textures included in the model. You should be able to take the shaders of the model meshes, cast them to PbrShader, and set or remove the textures as you like.

For your second question: No, there is not. But it shouldn't be too hard to start a second thread for that.

I assume your model is a gltf model? By default, the gltf loader creates a PbrShader for each mesh in the model and uses the textures included in the model. You should be able to take the shaders of the model meshes, cast them to PbrShader, and set or remove the textures as you like.

For your second question: No, there is not. But it shouldn't be too hard to start a second thread for that.

I think I have to switch a texture propertie from LINEAR to NEAREST, maybe the minFilter and magFilter.
I will test soon, thanks

https://github.com/fabmax/kool/blob/92a0b4ac4485c96447a4cc50793003474bb07015/kool-core/src/commonMain/kotlin/de/fabmax/kool/pipeline/Texture.kt#L141