Search Unity

PrimitivesPro [RELEASED]

Discussion in 'Assets and Asset Store' started by reindeer-games, Mar 11, 2013.

  1. reindeer-games

    reindeer-games

    Joined:
    Mar 5, 2013
    Posts:
    547
    Hello everybody,

    Let me introduce you Unity package PrimitivesPro 2.0.

    version2.png


    screenshot01.jpg

    PrimitivesPro is an ultimate package for procedural modeling. It contains 20 procedural primitives, mesh editor and high performance mesh cutter. Create infinite number of objects in editor with tons of parameters. Edit any mesh, manipulate triangles, edges or vertices as you like. Cut game object's mesh in two pieces with high performance mesh-cutter. Save your work as Unity mesh, prefab or export to OBJ.

    Main Features:
    • 20 procedural primitives
    • high performance mesh cutter
    • mesh editor with vertex-face-edge editing
    • vertex or face normal vectors
    • tangents generation
    • uv mapping
    • flipping normals
    • custom pivot position
    • export to OBJ
    • scene handles
    • full source code included

    LIVE DEMO
    CUTTING LIVE DEMO








    Collection contains:
    • Triangle
    • Plane
    • Circle
    • Ellipse
    • Ring
    • Box
    • Sphere (Hemisphere)
    • Cone
    • Cylinder
    • Ellipsoid
    • Pyramid
    • GeoSphere (IcoSphere)
    • Tube
    • Capsule
    • Rounded box
    • Torus
    • Torus knot
    • Superellipsoid
    • Arc
    • Spherical cone

    Link to AssetStore
     
    Last edited: Sep 22, 2014
  2. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,670
    Please add a single triangle and a single 2-triangle quad to the list of primitives.
     
  3. reindeer-games

    reindeer-games

    Joined:
    Mar 5, 2013
    Posts:
    547
    Hi,

    no problem, I will update the list.

    However 2-triangle quad is basically the Plane primitive with 1 width and 1 length segments.

    Cheers.
     
  4. p6r

    p6r

    Joined:
    Nov 6, 2010
    Posts:
    1,146
    Very nice asset... I like it !
    6R
     
  5. p6r

    p6r

    Joined:
    Nov 6, 2010
    Posts:
    1,146
    I asked you (PM) if it works under Unity 3.5.x !?!
    6R
     
  6. reindeer-games

    reindeer-games

    Joined:
    Mar 5, 2013
    Posts:
    547
    Hi,

    All the scripts are working in 3.5.x. Unfortunately I built the package with Unity 4.0. It means it cannot be opened with Unity 3.5.x.

    I will fix this issue with the next version. If you can wait few days for the next version (most of the time I just wait for submission review by Unity) and I let you know here.

    And thank you for your interest!
     
  7. reindeer-games

    reindeer-games

    Joined:
    Mar 5, 2013
    Posts:
    547
    I added a single triangle primitive. The new version is already in the asset store.
     
  8. reindeer-games

    reindeer-games

    Joined:
    Mar 5, 2013
    Posts:
    547
    Hello there,

    a new version of PrimitivesPro was just published on Unity Asset Store.

    Changes:
    * fixed uv mapping for Capsule (Spherical)
    * fixed uv mapping for Rounded Cube
    * price is now only $15


    $115.jpg


    Link to Asset Store
     
  9. p6r

    p6r

    Joined:
    Nov 6, 2010
    Posts:
    1,146
    Your primitives are working perfectly with Megafiers.
    It means an infinity of shapes !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    I don't have anymore to create my primitives in another app and import them with too many or not enough vertices.
    Now I simply add one of your primitives, change the number of vertices in one or two clicks and I add Megafiers !!!
    Perfect !!!

    6R
     
  10. sloopidoopi

    sloopidoopi

    Joined:
    Jan 2, 2010
    Posts:
    242
    Hi,
    just bought the asset and I like it very much!
    Just have some feature request: Is it possible to have a hemisphere that is open at the bottom? Right now it is always closed, so when I flip the normals I can't see inside the sphere. Another cool feature would be to have some border thickness, so you can define the outer- and inner radius of the hemisphere.
     
  11. sloopidoopi

    sloopidoopi

    Joined:
    Jan 2, 2010
    Posts:
    242
    Another feature that come in my mind: Save a generated mesh to the AssetDatabase. On the Unity documentation is some example: http://docs.unity3d.com/Documentation/ScriptReference/EditorUtility.SaveFilePanelInProject.html

    Another Problem : Right now when I try to make a prefab from a primitive, the mesh and the material gets lost. When I drag this prefab into the scene I can recreate the mesh when I change some value in the inspector of the primitive. But when I duplicate the prefab they share the same mesh and a change in one prefab is mirrored in another prefab. (The same happens when I just duplicate a normal primitive gameobject that not a prefab is.)
    If I click on the prefab in the project inspector and change some value a mesh is recreated directly on the prefab (but in the meshfilter the text 'type mismatch' is displayed). When I drag this prefab into the scene a couple of times all the instances share the same mesh so the 'mirror' problem arise.
    Is there a way that I can generate a prefab from a primitive gameobject and don't have only one shared mesh in all instances?
    [EDIT] Ok I solved the problem with the shared mesh by myself. For example in the RoundedCube script I changed in the GenerateGeometry method a couple of sharedMesh calls to mesh. Now I can duplicate a prefab instance and change them independently from each other. [/EDIT]
     
    Last edited: Mar 27, 2013
  12. reindeer-games

    reindeer-games

    Joined:
    Mar 5, 2013
    Posts:
    547
    Hi there,

    thanks for buying the asset!

    For your requests:

    1) Open hemisphere is a good idea, I will make it for the next version.
    2) Sphere thickness - by that you want to achieve something like this?

    http://www.metoffice.gov.uk/media/image/q/b/weather_experiments_watercycle_bowl.jpg

    Anyway, that shouldn't be a problem, I will look into that for the next version.

    3) AssetDatabase - I am not aware of this feature, I will look into that, thanks for suggestion.

    I am glad you fixed the problem with a shared mesh. I read some recommendations about using
    shared mesh for procedural generation inside Unity, but it does not seem to be working in all cases.

    Regards,
    RG
     
  13. sloopidoopi

    sloopidoopi

    Joined:
    Jan 2, 2010
    Posts:
    242
    exactly.

    Me too. Unity suprises me every day. ;)

    Well after testing I realized that it's not a optimal solution. Beside the anoying console warnings 'Instantiating mesh due to calling MeshFilter.mesh during edit mode. This will leak meshes. Please use MeshFilter.sharedMesh instead.' every time I close and reopen the project the mesh of my prefab instance gets another 'Instance' appended to it's name when i change some value the first time on the the component. This all is not a real problem (i hope) but is not optimal for a asset.
    Don't know how other assets work with all this mesh/sharedmesh madness.
     
  14. sloopidoopi

    sloopidoopi

    Joined:
    Jan 2, 2010
    Posts:
    242
    I hacked a little bit further into the code:
    There is some problem with leaking objects. (In the Plane.cs for example there is the GenerateGeometry method that is called everytime you change some value. There is this if clause:
    if (!meshFilter.sharedMesh)
    {
    meshFilter.sharedMesh = new Mesh();
    }
    which is always false :eek: => leaking meshes all the time.
    (better: if (meshFilter.sharedMesh == null) )
    I realized it when I saved the scene and get always some console warnings with more and more leaking objects.


    I also made a save mesh routine that saves the current mesh to the assetDatabase and load it back as a new sharedmesh for the primitive

    I did it for the roundedCube:
    CreateRoundedCube.cs:

    private PrimitivesPro.GameObjects.RoundedCube _target;

    public override void OnInspectorGUI()
    {
    .......orginal code......

    if(GUILayout.Button("Save Mesh")){
    SaveMesh();
    }

    }


    void OnEnable()
    {
    _target = (PrimitivesPro.GameObjects.RoundedCube) target;
    }


    private void SaveMesh(){
    Mesh orginalMesh = _target.GetComponent<MeshFilter>().sharedMesh;

    Mesh newMesh = CopyMesh(orginalMesh);


    var path = EditorUtility.SaveFilePanelInProject("Save mesh","myMesh.asset","asset","Enter File Name");
    if(path.Length != 0){

    AssetDatabase.CreateAsset(newMesh,path);
    AssetDatabase.SaveAssets();
    AssetDatabase.Refresh();
    _target.GetComponent<MeshFilter>().sharedMesh = (Mesh)AssetDatabase.LoadAssetAtPath(path,typeof(Mesh));

    }
    // DestroyImmediate(newMesh); //gives error
    }


    static Mesh CopyMesh(Mesh orginalMesh)

    {

    Mesh newmesh = new Mesh();

    newmesh.vertices = orginalMesh.vertices;

    newmesh.triangles = orginalMesh.triangles;

    newmesh.uv = orginalMesh.uv;

    newmesh.normals = orginalMesh.normals;

    newmesh.colors = orginalMesh.colors;

    newmesh.tangents = orginalMesh.tangents;

    return newmesh;

    }

    I hacked it together from stuff I found on the forum. Would be great if this, or something similar would be a feature for the official asset.
     
    Last edited: Mar 29, 2013
  15. reindeer-games

    reindeer-games

    Joined:
    Mar 5, 2013
    Posts:
    547
    Looks like you found one nasty bug :). Thanks for info I will update the package soon.
     
  16. Jerware

    Jerware

    Joined:
    May 15, 2012
    Posts:
    41
    Please add a half-pipe to the assets (basically your hollow cylinder sliced in half). I would buy this! Thank you.
     
  17. reindeer-games

    reindeer-games

    Joined:
    Mar 5, 2013
    Posts:
    547
    Hello there,

    yes, I will update the package. Next version should be out next week.
     
  18. Jerware

    Jerware

    Joined:
    May 15, 2012
    Posts:
    41
    Thank you!
     
  19. reindeer-games

    reindeer-games

    Joined:
    Mar 5, 2013
    Posts:
    547
    Hello there,

    a new version of PrimitivesPro was just published on Unity Asset Store.

    Changes:
    * added pyramid uv map (5 images of each pyramid side in one texture)
    * added cube uv map (6 images of each box side in one texture)
    * tube slicing parameter (0 ... 360) - to generate a 'half-pipe' primitive
    * sphere inner radius - to generate a 'bowl' primitive
    * saving mesh to asset database


    $121.jpg


    Link to AssetStore
     
  20. reindeer-games

    reindeer-games

    Joined:
    Mar 5, 2013
    Posts:
    547
    Hi,

    a new version was just published. I added a "slice" parameter to Tube primitive.
    If you set the "slice" to 180 you will get your 'half-pipe'.

    Enjoy.
     
  21. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,670
    You may not be interested to do so, it may be difficult but constructive solid geometry operations to cut out a chunk from one primitive using another would be really useful for customizing the mesh shapes.
     
  22. Jerware

    Jerware

    Joined:
    May 15, 2012
    Posts:
    41
    Wonderful! I've already purchased the pack and put the half-pipe to good use. I'm glad you added saving to .asset too, because there is a conflict with another plug-in I use (Spline Bend), and it would crash Unity if I tried to add a spline to a PrimivesPro GameObject that had a mesh collider applied. Thankfully saving as .asset offered a workaround (you have to create PrimivePro -> apply the spline -> save mesh -> load mesh and add mesh collider).

    Now, I wonder if it's possible to make a ramp using one of the primitives? Something like this:

    View attachment 49574

    Thank you!
     
  23. reindeer-games

    reindeer-games

    Joined:
    Mar 5, 2013
    Posts:
    547
    Great to hear it works for you. I am not sure about the crash, I don't have a Spline Bend plugin. Could you attach error log or console output, if it is possible?

    For the ramp, I cannot see your attachment, the link is broken.
     
  24. reindeer-games

    reindeer-games

    Joined:
    Mar 5, 2013
    Posts:
    547
    CSG is definitely an interesting topic. I would like to see it in the future version of my package. However I cannot promise when, for now I keep it in my TODO list with lower priority.
     
  25. Jerware

    Jerware

    Joined:
    May 15, 2012
    Posts:
    41
  26. Jerware

    Jerware

    Joined:
    May 15, 2012
    Posts:
    41
    I just read the documentation and came across this:

    Can you possibly point me to such a shader? I prefer the flat shaded, face normals look for my game, but I can't seem to find a shader that will produce it.
     
  27. reindeer-games

    reindeer-games

    Joined:
    Mar 5, 2013
    Posts:
    547
    About the ramp, the closest looking primitive you can get is a Tube with inner radius set to 0 and high slice parameter. Try to play with those parameters, otherwise there is no such primitive. But I am now thinking about "cutting" plane feature, where you will be able to cut any primitive in two pieces by a plane, that might help a lot.
     
    Last edited: Apr 10, 2013
  28. reindeer-games

    reindeer-games

    Joined:
    Mar 5, 2013
    Posts:
    547
    I just quick looked over the forum and google and I haven't found any "flat" shader for Unity. Everybody just duplicates vertices as I do. However I believe there is a way to do it, interesting information can be found for example here:

    http://athile.net/library/blog/?p=970

    But it requires a little bit more work and research.
     
  29. p6r

    p6r

    Joined:
    Nov 6, 2010
    Posts:
    1,146
    Great !!!
    You have added some very nice features.
    I like the clever way to choose the UVmapping on the cube or the pyramid.

    Thanks,

    6R
     
  30. sloopidoopi

    sloopidoopi

    Joined:
    Jan 2, 2010
    Posts:
    242
    Great release! Like the new features very much. Makes this asset a lot more usable.

    Any insights in your TODO list? I'm curious about what's next.

    cheers
     
  31. reindeer-games

    reindeer-games

    Joined:
    Mar 5, 2013
    Posts:
    547

    I am glad you like it.

    For the next version I am thinking about plane cutting feature where you can cut any primitive by a plane into
    two pieces. And after that maybe global deformation techniques.
     
  32. sloopidoopi

    sloopidoopi

    Joined:
    Jan 2, 2010
    Posts:
    242
    Sounds good, Do you thought about some boolean operations?
    I also saw that you reference Paul Bourke. On his site is a couple of more very interesting stuff. For example : http://paulbourke.net/geometry/superellipse/ (Don't know if this is the same as the rounded cube, but it's amazing how much different geometry you get from one algorithm)
    Global deformation is also fantastic, but in my opinion it's a topic that is already been coverd very well by Megafiers. Why reinvent(or copy) the wheel? The world need more Paul Bourke stuff ;)
     
  33. reindeer-games

    reindeer-games

    Joined:
    Mar 5, 2013
    Posts:
    547
    I agree, Paul Bourke's website is an excellent resource. Yes, the super-ellipsoid is a superset of rounded cube and many other geometry objects...

    http://upload.wikimedia.org/wikipedia/commons/8/8a/Superellipsoid_collection.png

    I was thinking about implementing super-ellipsoid before, then I realized it would be maybe too general for people and not so usable for game development with Unity. However, if you think it's a good idea I can do it :).

    And for deformations and Megafiers, I haven't tried it yet, but I guess you are right.
     
  34. p6r

    p6r

    Joined:
    Nov 6, 2010
    Posts:
    1,146
    I don't agree...
    All you can add to YOUR assets is great for old customers and to attract future customers.
    Things can be similar but different.
    Creation be with you ! ;-)

    6R
     
  35. sloopidoopi

    sloopidoopi

    Joined:
    Jan 2, 2010
    Posts:
    242
    You forgot that unity is not only used for games! :wink:
    I vote for super-ellipsoid !!!

    Another feature that comes in my mind is more control over a sphere. So you could define the start and end of your angles (phi/theta). With this you could create slices of a sphere etc.
     
  36. Jerware

    Jerware

    Joined:
    May 15, 2012
    Posts:
    41
    Possible bug? If I create a torus, it gets spawned with the name TorusPro and I can change all the settings. Good. But if I then rename the GameObject, the settings no longer have any effect. If I change the name back to TorusPro, they work again. Is this a known limitation?
     
  37. reindeer-games

    reindeer-games

    Joined:
    Mar 5, 2013
    Posts:
    547
    Yes, it is a known limitation because I compare objects with a name. I can fix that in next version. But not sooner that 2 weeks, I will be offline next days...
     
  38. sloopidoopi

    sloopidoopi

    Joined:
    Jan 2, 2010
    Posts:
    242
    Playing around with different primitives I got some feature suggestions:
    Triangle: subdivision (so you could better use it with a mesh deformer)
    Circle,Ring,Torus: Slice parameter like the Tube has.
    Torus: a cone angle to adjust the alignment of the cone.
     
  39. Jerware

    Jerware

    Joined:
    May 15, 2012
    Posts:
    41
    That works for me! PrimitivesPro is fast becoming one of my favorite plug-ins. As someone who never took the time to learn a 3D modeling app, this is a really empowering toolset. Thanks for making it!
     
  40. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,317
    Just bought this Amazing Plugin. Wow. Fantastic work.

    In the process of learning how to use the package.

    I have 2 questions perhaps you can help with:

    1. How to make box that is open inside. Would this work by using a 4-sided Tube?
    Edit: Just tested a 4 sides tube, it works, but the UV on the top cap is a bit off. I think this is a simple fix and then Primitive Pro can support a 4 sided tube. Can you tell me where in the code I need to change to fix the UV.

    2. Is it possible to make something like the Frilly Paper shape of a cup cake. http://en.wikipedia.org/wiki/Cupcake

    Thanks.
     
    Last edited: Apr 13, 2013
  41. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,317
    Would it be possible to add Boolean Operations. This would be really useful.

    Thanks.
     
  42. reindeer-games

    reindeer-games

    Joined:
    Mar 5, 2013
    Posts:
    547
    Hi,

    sorry for late reply, I wasn't at my computer last week.

    To answer your questions:

    If you are still looking for the uv mapping code for a tube, look into file "TubePrimitive.cs" line 248 (look for my comment "generate caps"). I hope it is useful.

    No, with current primitives, it is not possible. It looks like a very specialized shape.

    Yes, I am considering the implementation. I hope it will be in one of the future version of the package.

    And thank you for buying the asset!

    Cheers.
     
  43. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,317
    Cool, thanks for the reply.

    One other request, someone mentioned that Lofting has already being covered by megashapes/megafiers and PrimitivesPro should not try to reinvent the wheel. I have to disagree with this statement.

    Primitives Pro can allow users to add much more variations to the existing collection of primitives if it adds basic lofting support.

    For example, the user can define the side profile of a shape and path, say a circle. The profile is lofted around the circular path. We now have a new primitive. This adds tremendous flexibility to the idea of primitives. Users can create their own primitives easily and not limited to stock primitives. Also with a more flexible support for custom primitives, reindeer games can focus on creating other cool features instead of making more primitives.

    An example of basic lofting can be seen here.

    http://richie.idc.ul.ie/~keogana/max/How to create a picture frame in 3d studio max.pdf

    To recap:
    Megafiers and Megashapes is a very big ecosystem that has different use cases and also comes with a Big price and is quite CPU hungry.

    Primitives Pro, on the other hand is a Lean Streamlined package that's focused at giving the users a flexible primitives system that can be used in any project with minimal impact.


    If anyone else thinks this feature is useful, please add your comments.

    Thanks.
     
  44. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,317
    Primitives Pro is really amazing so far. Really enjoy using and exploring what it can do.

    I have a question about Texturing and UV mapping.

    I made a test PrimitivesPro Tubes object and applied a Tiling Texture.

    Here are the results:

    1. https://dl.dropboxusercontent.com/u/48378123/TubesProTexturing.tiff
    2. https://dl.dropboxusercontent.com/u/48378123/TubesPro.png

    I used MeshBaker to generate the UV mapping.

    Question: Is it possible to somehow alter the direction of the UV placement for the various sides of the tube?
    For example, instead of the horizontal patterns that's on the lower left, we can rotate the UV direction so that the wooden planks are stand Vertically.
    Also for the planks on the top, we can make this a Radial pattern, like the spokes of a wheel.

    btw, which part of the code is responsible for laying out the UV's? My math is a bit weak, can you explain the logic behind how the layout is done.

    P.S. found a bug in RoundedCube 1seg.
    1. https://dl.dropboxusercontent.com/u/48378123/roundCube1seg.tiff
    2. https://dl.dropboxusercontent.com/u/48378123/RoundedCube1segUV.tiff
    (The right-most UV face is thinner in width which created more spaced out planks)

    Thanks.
     
    Last edited: Apr 20, 2013
  45. brianbraatz

    brianbraatz

    Joined:
    Apr 21, 2013
    Posts:
    17
    Love PrimitivesPro!
    But I am having a problem thats driving me nuts:

    The connection between the tubescript or whatever script seems to get lost .

    I can then no longer edit the shape... I..e I move the sliders in the inspector and NOTHING happens in the scene view, but the slider does effect the numbers...

    This is very frustrating as it seems like I need to completely re-create the shape to get editing back again..

    is anyone else having this problem?

    Is there a workaround?

    Thanks!

    Brian
     
  46. reindeer-games

    reindeer-games

    Joined:
    Mar 5, 2013
    Posts:
    547
    I sent you private message with patch, let me know if it works!


    I know about that. The thing is that Rounded cube is a hybrid of cube and sphere and
    it uses spherical uv mapping (which best fit for this primitive). It does not work all the time
    - like you just found, but it works very well for most cases. If you need a simple cube
    I would recommend you the "box" primitive.
     
  47. reindeer-games

    reindeer-games

    Joined:
    Mar 5, 2013
    Posts:
    547
    Hi,

    I think I know what is the problem. It looks like you renamed the game object from "TubePro" to something else. I compare objects with name, it is a known issue and it will be fixed in next version of the package ... (in a couple of days). For now rename it back to "TubePro" and it should work.

    Thanks.
     
  48. brianbraatz

    brianbraatz

    Joined:
    Apr 21, 2013
    Posts:
    17
    AHA!
    that worked

    I just rename my object to the original name and the inspector started working again!
    Very nice!


    My "Unity time" is evenings and weekends and this problem was stopping me from getting alot done this weekend
    Thanks!
    Brian :)
     
  49. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,317
  50. brianbraatz

    brianbraatz

    Joined:
    Apr 21, 2013
    Posts:
    17
    Ok- So things are working for me now- I just do NOT rename any of the game objects..

    BUT- Sometimes - I still lose inspector to object connection.. I have found a workaround I am posting here in case anyone else has the problem: Just close and reopen the scene and that seems to fix it

    Also - ONE time I did have a problem when I duplicated the scene- and then on the duplicated scene the mesh renderer lost the material it was supposed to have- I only saw this once though- and do not have repro steps... if I can figure out repro steps ill post here...

    while the lib has some problems- I AM VERY HAPPY with it and encourage others to purchase..