- Home /
Texture tiling difference between unlit and surface shader?
Hello everyone! I am writing on a project with two shaders, a unlit shader for "thermal vision" and a surface shader. While the unlit shader is used to create materials for my scene and adjust their looks, i also have a surface shader which serves as a replacement shader in a camera to provide a "normal vision". However when i use textures the two shaders seem to interact differently on the tiling. Here is an image of the same cube using the same bumpmap for both shaders, left (unlit) shader seems to stretch the texture around the cube whereas the right one just applies the whole texture to every side of the cube. In the unlit shader i'm using TRANSFORM_TEX and UnpackNormal(tex2D(_BumpMap, i.uv_BumpMap)) In the surface shader i'm using o.Normal = UnpackNormal(tex2D(_BumpMap, IN.uv_BumpMap)); Is there a macro i am missing in my unlit shader? I feel like it should behave the way my surface shader does.
Thanks in advance!
Okay, so i just found out, that the Tiling in the unlit shader is the same as in the surface shader as long as the material is used on a plane. This makes me wonder: what is the difference between a cube and a plane texture-wise for each shader? Why does the cube not just use the entire bumpmap texture on every side of itself but wraps it around? And why does that only happen in an unlit shader?
Answer by tifff · Jan 14, 2019 at 09:36 AM
Update: I found out what was causing the issue. In the unlit shader i used multiple uv maps (one for albedo, one for bumpmap etc) but only texcoord0 gets the correct value for the default cube. So all i had to do was remove the other uvmaps and replace them with the one in texcoord0.
Your answer
Follow this Question
Related Questions
'.' is not a valid texture file name on asset warning/error 1 Answer
Blender to unity, importing UV mapped image textures 1 Answer
Gradient transparency results in full opacity for half of the gradient 1 Answer
Colour tinting layered textures with transparencies. 1 Answer
Is it possible to UV map a cylinder without duplicating a column of vertices? 1 Answer