Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
-1
Question by Jazzer008 · Sep 07, 2013 at 01:56 PM · prefabmodelcubenormalized

Pre-Normalized cube model?

I need a normalized cube model/prefab that has been pre-generated, rather than normalized in code.

Edit: If people could stop telling me about Unity's primitive cubes, that would be great. :P This is a cube that has had it's vertices normalized, as is what I'm looking for:

Normalize Example

Anyone know where I can find one?

Comment
Add comment · Show 11
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image meat5000 ♦ · Sep 07, 2013 at 02:23 PM 0
Share

What about the basic prefab cube?

If not, make one in Blender.

avatar image meat5000 ♦ · Sep 07, 2013 at 03:45 PM 1
Share

tbh all I see is a mesh. There is no indication of 'normalised' there. To me, normalised means that the face is set to be outwardly perpendicular. There are no faces on that cube. $$anonymous$$aybe you should explain what you mean by normalised...in words.

Edit: If people could stop telling mr about Unity's primitive cubes, that would be great. :P This is a cube that has had it's vertices normalized, as is what I'm looking for:

And if you didn't want this maybe you should have specified?

avatar image Hoeloe · Sep 07, 2013 at 04:46 PM 1
Share

Umm... that normalises a vector to have magnitude 1. That can't be directly applied to a cube. Explain what you mean by "normalised".

avatar image meat5000 ♦ · Sep 07, 2013 at 05:19 PM 1
Share

I'm finding you quite offensive Jazzer008. Try to be civil ins$$anonymous$$d of throwing around comments. I'm here trying to help you and you are being quite rude about it. Frankly if I hadn't bothered your question probably would have disappeared in to the realms of UA unanswered...

avatar image Hoeloe · Sep 07, 2013 at 07:11 PM 1
Share

The reason no-one understands is because you haven't made much sense - the "normalised cube" you're talking about isn't standard ter$$anonymous$$ology, and since that's the only thing you said, of course no-one knows what you're talking about. Try saying something along the lines of: "I want to normalise the position vectors of all the vertices of a cube such that it approximates a sphere", which is a more accurate description of what you want, and highlights why a standard Unity cube won't work (as only has 8 vertices).

As for how to do it, there is a free script hanging around somewhere that lets you export a mesh from Unity. If you first create a cube with enough vertices in a separate modelling program, you can then import it into Unity, run a script to deform the mesh, and then export it using the aforementioned script, you can use the exported model for what you need.

Show more comments

3 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by meat5000 · Sep 07, 2013 at 08:03 PM

Here is the answer and you won't like it.

Make a new project and scene. Use code to modify your cube, then Save the results into a separate object or prefab. Use that object/prefab in your other project. Look up Procedural Examples, everything you need should be in it.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
1

Answer by karl_ · Sep 07, 2013 at 05:49 PM

I think you may have some terms confused. Normalization is used to clamp values to a specific range (0-1) with relative differences remaining intact (see http://en.wikipedia.org/wiki/Normalized_vector). Saying 'normalize a cube' does not make much sense, unless you're specifically referring to vertex normals.

The image you've linked to shows a subdivided cube rendering as a wireframe. Unity has a MeshTopology enum that can be used to build meshes using (among other things) lines. Here is a quick example showing the use of this class. It creates a new menu item

 GameObject->Create Other->Create Wireframe Cube

that builds a wireframe cube.

 using UnityEngine;
 using UnityEditor;
 using System.Collections;
 
 public class CreateWireframeCube : Editor {
     [MenuItem("GameObject/Create Other/Wireframe Cube")]
     public static void InitWireCube()
     {
         float scale = .5f;
 
         Mesh m = new Mesh();
         m.vertices = new Vector3[8]
         {
             new Vector3(-1f, -1f, 1f) * scale,
             new Vector3(1f, -1f, 1f) * scale,
             new Vector3(-1f, -1f, -1f) * scale,
             new Vector3(1f, -1f, -1f) * scale,
             
             new Vector3(-1f, 1f, 1f) * scale,
             new Vector3(1f, 1f, 1f) * scale,
             new Vector3(-1f, 1f, -1f) * scale,
             new Vector3(1f, 1f, -1f) * scale
         };
         m.subMeshCount = 1;
         m.uv = new Vector2[]
         {
             Vector2.zero,
             Vector2.zero,
             Vector2.zero,
             Vector2.zero,
 
             Vector2.zero,
             Vector2.zero,
             Vector2.zero,
             Vector2.zero
         };
         
         m.SetIndices(
             new int[]
             {
                 0, 1,
                 1, 3,
                 3, 2,
                 2, 0,
 
                 0, 4,
                 1, 5,
                 2, 6,
                 3, 7,
 
                 4, 5,
                 5, 7,
                 7, 6,
                 6, 4
             },
             MeshTopology.Lines,
             0
             );
 
         GameObject go = new GameObject();
         go.AddComponent<MeshFilter>().sharedMesh = m;
         go.AddComponent<MeshRenderer>();//.sharedMaterial.color = Color.green;
     }
 }



See also:

http://docs.unity3d.com/Documentation/ScriptReference/Mesh.html http://docs.unity3d.com/Documentation/ScriptReference/Mesh.SetIndices.html http://docs.unity3d.com/Documentation/ScriptReference/MeshTopology.html

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Jazzer008 · Sep 07, 2013 at 06:57 PM 0
Share

Thanks for the help but I'm looking to find a model cube that has had it's vertices Normalized.

You can see the difference between a normal cube and a cube that has had it's vertices normalized in the animated image I posted.

avatar image
0

Answer by _dns_ · Sep 07, 2013 at 05:54 PM

I think what is called a "normalized cube" is this "spherized" cube we see next to the regular cube. It could be done by code easily, in Unity script or by a script in Blender for example. Maybe this kind of primitive already exists in Blender.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Jazzer008 · Sep 07, 2013 at 06:59 PM 0
Share

I guess some people may called it 'spherized', but it's accomplished by passing the vertices through the normalize function. And yes I can easily do it in code, but my issue is that I don't want to spend any runtime generating the normalized cube, I want to have it pre-generated. :P

I've already checked blender, unfortunately either nothing exists or I've yet to find it, even function or modifier wise.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

20 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Generate colliders on a prefab 0 Answers

Custom prefabed spawner 2 Answers

can you make a prefab but without a model? 3 Answers

Only instantiate if clear space beside prefab 1 Answer

New prefab system problem 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges