I am using Unity C# Script to create shapes.
My shapes can be like box (6 faces without rounded corner), curve and polygon.
I create shapes with basic method like creating new Mesh and Meshfilter. Then assigning UVs, Normals, Vertices etc to the mesh. Usually one cube shape contains 24 vertices. But these shapes are not giving me realistic results when I Bake my scene.
Right now my output after baking scene is like
private void Awake()
{
GameObject Shape = new GameObject("Cupboard");
MeshRenderer mr = Shape.AddComponent<MeshRenderer>();
mr.material = Material;
MeshFilter meshFilter = Shape.AddComponent<MeshFilter>();
meshFilter.mesh.Clear();
Mesh mesh = new Mesh();
mesh.vertices = Vertices();
//It return vertices of each face (total 24)
// 1 face= 4 corners
// 1 corner = 3 points(x,y,z)
// 1 box have total 8 corners. So 8x3=24
mesh.triangles = Triangles();
// this function will return traingles (total 12 traingles)
// 1 face = 2 triangles
// 1 box have total 6 faces. So 6x2=12
mesh.uv = UV(); // returns UVs for each face
meshFilter.mesh = mesh;
mesh.RecalculateNormals();
}
I want this kind of output, video link:
If I use some pre-made FBX models, that models are giving better result than the models I created myself from Unity3D Scripting. Can someone guide me how to make it possible?
Please ignore I can’t bake at run-time or it might take long time.
My target is to display this youtube video demo kind of output. How do I make shapes by using scripting that can give me this kind of output?
If this method is not suitable, then where can I draw a box that can be used to get realistic output after baking in Unity3d? I just want unity3d to bake.
those premade cabinets have probably thousands of vertices, carefully modeled edges, proper UV maps,
maybe special hand crafted texture maps (could have also baked normals, AO or other textures assigned…)
i’d check how those models are made, then try to generate similar models from script (if that’s the requirement),
possibly some plugins can do parametric models from Houdini, not sure if theres runtime support…
This old name from the times when UT could not afford to buy a domain unity.com.
Now they have this domain name and if you will open it you will not find Unity3D in a single place.
Also the name of the company is Unity Technologies not Unity3D Technologies.
Also there is no 3D in a single Unity logo.
Because otherwise I will start mentioning how actually Unity branding guidelines say we need to refer to Unity as “Unity Software”, so your correction is also technically wrong.
Or I could point out that a ton of e-mail still use the Unity3d domain, like for example the one about trademarks.
But instead, can we just agree that sometimes people might type Unity3d instead of Unity and that’s okay and we shouldn’t derail a whole thread for a pretty minor mistake.
But still my main quastion, is there a way to create Box shapes with more vertices in Unity Scripting? Kindly guide me. Any kind of guidance will be Appreciated
because shapes will be drawn according to my client want. they will first draw shapes in an app, that app is simple OpenGL. Then I have shape information like size, position and angle. I will redraw in Unity with script.
Now that shape be such a good quality if I bake it in Unity3D editor, it must look realistic. Shapes are random size, position and angles, depends on what user want