I can simply drag texture to 2d objects and get correct scale. But when I created a simple shader which sample the texture and output it, then drag it to a 3d plane, it looks the outcome is not correct scale when the plane object scale is (1,1,1).
I don’t understand, how can I learn about this topic?
2D “objects” (Sprites, UI images, etc.) can easily scale the mesh that’s being displayed to match the size of the texture you’re assigning. 3D meshes use pre-defined UVs to describe how a texture wraps around them that can’t be as easily scaled in all cases. UVs are a normalized 0.0 to 1.0 range across the width & height of the texture, so the resolution of the texture will change the texel density when applied to a 3D mesh.
The general options are:
A ) Use the Tiling and Offset settings on the material to get the texture to display the size you want. This is potentially labor intensive as you’d likely need a unique material per object.
B ) Use custom, unscaled meshes with the UVs scaled to how you want them. Or you can use ProBuilder (a CSG construction tool you can download in the Package Manager) to construct your scene meshes and scale the UVs in that tool.
C ) Use a triplanar shader. Though these can have problems on surfaces that aren’t axis aligned depending on the look you want. And 45 degree angled surfaces will look terrible.
Thanks for explain! I’ll learn to create mesh.