How does Unity align materials to an object?

Hi All,

I’m designing parts in a CAD package called CREO, then exporting to .OBJ files. I’m getting poor results when trying to wrap a tiling pic around it. I’ve done a few tests on a simple cube to try and understand the details of how Unity works, see below (more complex parts are coming out bad). I’m adding a generic tiled image pic to simple cubes, posted below.

Here’s the start part of each test, 3 datum planes and a coordinate system

Tiled pattern I’m adding to each test:

Here’s the tests:

test #1 = creating a cube as a gameobject in Unity and then adding the material, this is how I want it to look. Pattern is nicely wrapped around the cube and matches around edges.

Other versions are with the coordinate system in different locations relative to the cube (in middle of cube, at a corner, outside the cube …etc), all look bad.

test #5= Selected a datum when exporting the .obj file instead of selecting a coordinate system (all other version I selected a csys as a reference when exporting the obj file).

At any rate, any ideas on how to get the .obj to export such that unity wraps the texture nicely would be hugely appreciated.

Hope I conveyed enough information…

Thanks,

Vanz

Well, I don’t know how this CAD program you are using works, but Unity generally uses UV maps to “wrap” a texture around an object, and usually you set that up in the 3D modeling software. I don’t have much experience with CAD, and I believe you usually have different projection modes, but I don’t know if you can edit the UVs directly. One way to do it might be a tri-planar shader, that automatically projects the texture from three directions. This can be done in Shader graph, or there are lots of free shaders to download. If shader graph is used, Position and Normal need to be overwritten to use object space, so that the texture follows the object’s position and rotation.