Code Monkey home page Code Monkey logo

Comments (7)

 avatar commented on June 10, 2024

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.

from arfoundation-samples.

Aupuma avatar Aupuma commented on June 10, 2024

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

from arfoundation-samples.

Aupuma avatar Aupuma commented on June 10, 2024

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.

from arfoundation-samples.

Aupuma avatar Aupuma commented on June 10, 2024

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.

from arfoundation-samples.

 avatar commented on June 10, 2024

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).

from arfoundation-samples.

 avatar commented on June 10, 2024

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

from arfoundation-samples.

gameboyJ3 avatar gameboyJ3 commented on June 10, 2024

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.

from arfoundation-samples.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.