Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plane texture not visible #10

Closed
Aupuma opened this issue Jun 28, 2018 · 7 comments
Closed

Plane texture not visible #10

Aupuma opened this issue Jun 28, 2018 · 7 comments
Labels
feature request New feature or request fixed Fixed in newer release

Comments

@Aupuma
Copy link

Aupuma commented Jun 28, 2018

Hi, I wanted to change the plane texture to an opaque seamless texture of my choice, but when I change the material only its base color is visible, not the texture.
Does this API work with plane materials differently or I'm missing something?

@ghost
Copy link

ghost commented Jun 28, 2018

You can use whatever material you'd like. The ARPlaneManager will instantiate whatever prefab you assign to its "Plane Prefab" field. The plane prefab used in the sample (which is the same one you get with the menu item GameObject > XR > AR Default Plane) uses a material with an orange color set on its Mesh Renderer. It's a simple material which uses a shader with a solid color, but you can create a new material with your texture and assign that to the prefab's Mesh Renderer instead.

@Aupuma
Copy link
Author

Aupuma commented Jun 28, 2018

It isn't working :(
If I use the same material with a texture with more grey and white, the plane changes its color towards grey, and If I use a brownish texture, its color is brownish. However the texture is not visible. The texture parameters are set by default.

Could it be something related to the quality, graphic settings? I'm using a Samsung Galaxy S8

@Aupuma
Copy link
Author

Aupuma commented Jun 29, 2018

I have tried with the planeGrid material that comes with the ARCore unity package, and the same is happening, the material is semitransparent but the grid texture is not visible.

@Aupuma
Copy link
Author

Aupuma commented Jun 30, 2018

A user from the Unity forum found the solution: uv's are not assigned when the mesh is generated. This code from Unity documentation fixed it:

Vector3[] vertices = mesh.vertices;
Vector2[] uvs = new Vector2[vertices.Length];
 
for (int i = 0; i < uvs.Length; i++)
{
         uvs[i] = new Vector2(vertices[i].x, vertices[i].z);
}
mesh.uv = uvs;

With this code, textures are visible (they move when new vertices are added to the plane, but for me is enough) I think it should be fixed in the next update, more users could need it.

@ghost
Copy link

ghost commented Jul 3, 2018

Ah, I understand. The ARPlaneMeshVisualizer does not compute UVs, that's true. I've added this for the next version (and they won't move when new vertices are added).

@ghost
Copy link

ghost commented Jul 10, 2018

We published version 1.0.0-preview.13 of ARFoundation today (and updated the sample project to use it). The ARPlaneMeshVisualizer now computes UVs for the mesh. Let me know if that works for you.

To update, go to Window > Package Manager > AR Foundation > Update to 1.0.0-preview.13

@ghost ghost added feature request New feature or request fixed Fixed in newer release labels Jul 11, 2018
@gameboyJ3
Copy link

gameboyJ3 commented Dec 5, 2018

A user from the Unity forum found the solution: uv's are not assigned when the mesh is generated. This code from Unity documentation fixed it:

Vector3[] vertices = mesh.vertices;
Vector2[] uvs = new Vector2[vertices.Length];
 
for (int i = 0; i < uvs.Length; i++)
{
         uvs[i] = new Vector2(vertices[i].x, vertices[i].z);
}
mesh.uv = uvs;

With this code, textures are visible (they move when new vertices are added to the plane, but for me is enough) I think it should be fixed in the next update, more users could need it.
Hi mate,
My goal is to apply textures with cubemap for getting reflection.I am currently using planegrid material and shader , can you please help me how i can replace this plane shader with my vertex shader which has a cubemap reflection property whcih will work well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request fixed Fixed in newer release
Projects
None yet
Development

No branches or pull requests

3 participants