I am completely new here and have a - for me - really complicated question or possibly even several
I work with Cinema 4D in the current version and have created some models, which I then exported as GLTF. Nothing special, a container and a few furniture assets.
I then textured them in C4D - both with standard material and with PBR.
At first I had some problems with backface culling - but I fixed most of them already.
But I get problems when displaying the model in my code. The texture is completely chopped up, as you can see in the screenshot.
When I put the same model into the GLTF viewer, everything looks fine. As seen in the next screenshot.
I also cloned the viewer from Github and ran it locally, and it looks fine there too.
The viewer doesn’t seem to care about backface culling etc., it displays the model correctly…
I tried to look at the code of the GLTF viewer to see what is different and removed almost everything there, but still the model looks good in there, but not in my own code.
In summary, you can say that there is something in the viewer code to display the model correctly and I may be doing something wrong in my code. But unfortunately I don’t know what. You can find my test code on Github, see link.
Is it possible that it has to do with the model scaling and the camera?
Maybe I haven’t really understood it yet - I notice that I have to scale my model from C4D by a factor of 0.1 so that I can see it somehow.
My export settings for GLTF are set to centimetre…
Sorry for the extremely long text, but I wanted to describe the problem as detailed as possible.
I would be happy if you could help me with my problem.
Hello cinema4D friend.
This is a well known issue with some GLTF export without any real answers yet.
Sometimes the exporter absolutely want to scale the file at 0.1 factor whatsoever unit is used.
If you find any hints about this, don’t hesitate to post your findings. There is a long list of similar post about this very specific scaling issue (among other softwares too).
my best guess is developers are copy/pasting GLTF export code from the same source (the Blender one?) spreading it around like a curse.
if the model looks OK in some online threejs-based viewers but not your viewer, i’d guess there’s something about the application code and not the model that isn’t quite right. My first guess would be to try adjusting your camera near/far values to be closer together, so that the depth buffer’s precision is better distributed. Using an environment map is often also a good idea for any PBR material.
I use only the code from the exdample website, for testing purposes…!!!
It is exported from the current version 2023 of C4D - if I want to use the model then I have to set the units in C4D to metres instead of centimetres, then everything is displayed in a correct size. This seems to be somehow different depending on the project, but I can’t understand it.
However, I have made a little progress with the texture issue:
As soon as I add a relief/bump or normal channel to my texture in C4D, it is displayed broken.
But why is this always displayed correctly in the viewer? What is so different about the code?
The Viewer, for example, always displays a model appropriately, regardless of the size in which I have exported it - this must also be hidden somewhere in the code. But I can’t find out what it is.
A correct normal map will have a bluish or violet color. A correct occlusion map will use the red channel, this just looks like another diffuse color texture. I would suggest omitting both textures, unless you have the right textures for those slots.
Have you seen my post before, this my rebuild example of the helmet scene - I downloaded the GLTF from ThreeJS Website. And If you can see - the error with the textures and normals is occuring here too:
Webpack should e fine, I wouldn’t worry about that.
I haven’t gone through all of your website code, there is a lot to debug and it’s easier if it can be simplified… but i’d suggest double-checking:
environment map loading
Ohhh noooo I think I found one of my main problems…when I was writing my replies I thought I could be a good idea looking what ThreeJS is used in my package.json (I used my first attempts from a few months ago and they are based on the Webpack-Example from the Bruno SImon Course)
And guess what - my version of ThreeJS was 0.125. Made npm install --save three@latest and now my textures and models look like in the viewer.