Giter Club home page Giter Club logo

com.unity.probuilder's Introduction

Table of Contents

About

ProBuilder is a 3D modeling plugin for Unity.

This readme provides a brief introduction for developers interested in working with the API. For more information, the following guides are available:

  • See the Manual for information about working with ProBuilder in the Unity Editor.
  • See the Scripting Reference for API documentation.

Working code samples are also available from the package repository under the Samples~ subfolder, or from the Package Manager you can import them directly into your Unity project.

Development

Unity provides ProBuilder as a package, distributed with the Package Manager.

To start working with ProBuilder source, clone the repository into your Packages directory.

~/Desktop/MyProject$ cd Packages/
~/Desktop/MyProject/Packages$ git clone https://github.com/Unity-Technologies/com.unity.probuilder

Then you can install the cloned package directly in the Package Manager using the "local" method. For more information on installing local packages in the Package Manager, see the Package Manager documentation.

API

There are 3 major namespaces.

Namespace Function
UnityEngine.ProBuilder Mesh types and functions to compile meshes to Unity compatible assets.
UnityEngine.ProBuilder.MeshOperations Mesh editing.
UnityEditor.ProBuilder Editor integration.

Mesh data is stored in a component (ProBuilderMesh) and compiled to a UnityEngine.Mesh (referred to as UMesh from here on) as necessary.

ProBuilderMesh retains the following mesh information:

  • Positions
  • UVs
  • Faces
    • Triangles
    • Material
    • Smoothing group
    • Auto/Manual UVs*
  • Tangent (if user set)
  • UV3/4 (if user set)
  • Colors
  • Shared vertices (also referred to as "common vertices")

Normals, tangents, collisions, and UVs are calculated as necessary.

*ProBuilder can automatically UV unwrap triangles on a per-face basis. Face has a toggle to enable or disable this feature (users are free to unwrap faces by manually as well).

Modifying a ProBuilder mesh is a bit different from a Unity mesh. Instead of working with the MeshFilter.sharedMesh you'll instead be operating on the ProBuilder representation of the mesh: ProBuilderMesh.

A typical workflow looks like this:

// Create a new cube primitive
var mesh = ShapeGenerator.CreateShape(ShapeType.Cube);

// Extrude the first available face along it's normal direction by 1 meter.
mesh.Extrude(new Face[] { mesh.faces.First() }, ExtrudeMethod.FaceNormal, 1f);

// Apply the changes back to the `MeshFilter.sharedMesh`.
// 1. ToMesh cleans the UnityEngine.Mesh and assigns vertices and sub-meshes.
// 2. Refresh rebuilds generated mesh data, ie UVs, Tangents, Normals, etc.
// 3. (Optional, Editor only) Optimize merges coincident vertices, and rebuilds lightmap UVs.
mesh.ToMesh();
mesh.Refresh();
mesh.Optimize();

License

Unity Companion License

Third Party Notices

Third Party Licenses

Contributing

All contributions are subject to the Unity Contribution Agreement(UCA).

By making a pull request, you are confirming agreement to the terms and conditions of the UCA, including that your Contributions are your original creation and that you have complete right and authority to make your Contributions.

Pull Requests

Please include an entry to the changelog for any PR, along with a Fogbugz ticket number if applicable.

New logs should be placed under the ## [Unreleased] header at the top of the changelog. See Contributing for more details.

com.unity.probuilder's People

Contributors

antoine-unity avatar aybe avatar chikuba avatar etherelric avatar gabrielw-us avatar gytis-zasciurinskas avatar joelfortin avatar karl- avatar lopezt-unity avatar martinbarrette avatar martinimgspc avatar meckzqz avatar modrimkus avatar modrimkus-unity avatar neilunity avatar peterolsted-unity avatar phobos2077 avatar roxannecor avatar roxanneunity avatar swahhillie avatar thaina avatar thomas-tu avatar tomaskucinskas avatar unitalg avatar vkovec avatar

Watchers

 avatar

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.