This commit is contained in:
zzz
2025-07-01 18:33:27 +08:00
parent f239c48158
commit 703071de1c
14 changed files with 372 additions and 6 deletions

View File

@@ -0,0 +1,282 @@
---
原文发布链接: https://github.com/Syomus/ProceduralToolkit
tags:
- 工具包
---
## Toolkit structure
### Runtime/
[](https://github.com/Syomus/ProceduralToolkit#runtime)
- [ArrayE](https://github.com/Syomus/ProceduralToolkit/blob/master/Runtime/ArrayE.cs): Various Array and List extensions, such as looped getters/setters and flood fills.
- [CellularAutomaton](https://github.com/Syomus/ProceduralToolkit/blob/master/Runtime/CellularAutomaton.cs): Generic cellular automaton for two-state rulesets. Common rulesets can be found in CellularAutomaton.Ruleset.
- [ClipperUtility](https://github.com/Syomus/ProceduralToolkit/blob/master/Runtime/ClipperUtility.cs): Utility class for conversion of Clipper data from and to Unity format.
- [ColorE](https://github.com/Syomus/ProceduralToolkit/blob/master/Runtime/ColorE.cs): Color extensions, HTML colors, Gradient constructors.
- [ColorHSV](https://github.com/Syomus/ProceduralToolkit/blob/master/Runtime/ColorHSV.cs): Serializable representation of color in HSV model.
- [CompoundMeshDraft](https://github.com/Syomus/ProceduralToolkit/blob/master/Runtime/CompoundMeshDraft.cs): Helper class for mesh generation supporting large meshes and submeshes.
- [DebugE](https://github.com/Syomus/ProceduralToolkit/blob/master/Runtime/DebugE.cs): Collection of drawing methods similar to Debug.DrawLine.
- [Directions](https://github.com/Syomus/ProceduralToolkit/blob/master/Runtime/Directions.cs): Enum with direction flags along three axes.
- [Draw](https://github.com/Syomus/ProceduralToolkit/blob/master/Runtime/Draw.cs): Collection of generic vector drawing algorithms.
- [DrawRaster](https://github.com/Syomus/ProceduralToolkit/blob/master/Runtime/DrawRaster.cs): Collection of generic raster drawing algorithms.
- [GizmosE](https://github.com/Syomus/ProceduralToolkit/blob/master/Runtime/GizmosE.cs): Collection of drawing methods similar to Gizmos.
- [GLE](https://github.com/Syomus/ProceduralToolkit/blob/master/Runtime/GLE.cs): Collection of GL drawing methods similar to Gizmos.
- [MeshDraft](https://github.com/Syomus/ProceduralToolkit/blob/master/Runtime/MeshDraft.cs): Helper class for mesh generation.
- [MeshDraftPrimitives](https://github.com/Syomus/ProceduralToolkit/blob/master/Runtime/MeshDraftPrimitives.cs): Constructors for MeshDraft primitives.
- [MeshE](https://github.com/Syomus/ProceduralToolkit/blob/master/Runtime/MeshE.cs): Mesh extensions.
- [PathClipper](https://github.com/Syomus/ProceduralToolkit/blob/master/Runtime/PathClipper.cs) and [PathOffsetter](https://github.com/Syomus/ProceduralToolkit/blob/master/Runtime/PathOffsetter.cs): [Clipper](http://www.angusj.com/delphi/clipper.php) library wrappers.
- [PTUtils](https://github.com/Syomus/ProceduralToolkit/blob/master/Runtime/PTUtils.cs): Various useful methods and constants.
- [RandomE](https://github.com/Syomus/ProceduralToolkit/blob/master/Runtime/RandomE.cs): Class for generating random data. Contains extensions for arrays and other collections.
- [RendererProperties](https://github.com/Syomus/ProceduralToolkit/blob/master/Runtime/RendererProperties.cs): Serializable Renderer properties, use Renderer.ApplyProperties extension to apply them to a target renderer.
- [Tessellator](https://github.com/Syomus/ProceduralToolkit/blob/master/Runtime/Tessellator.cs): [LibTessDotNet](https://github.com/speps/LibTessDotNet) library wrapper.
- [TextureE](https://github.com/Syomus/ProceduralToolkit/blob/master/Runtime/TextureE.cs): Texture extensions.
- [VectorE](https://github.com/Syomus/ProceduralToolkit/blob/master/Runtime/VectorE.cs): Vector extensions.
### Runtime/Buildings/
[](https://github.com/Syomus/ProceduralToolkit#runtimebuildings)
- [BuildingGenerator](https://github.com/Syomus/ProceduralToolkit/blob/master/Runtime/Buildings/BuildingGenerator.cs): The main generation class. Generates buildings based on input configuration and strategies, reusable. See examples for details.
- [ILayout](https://github.com/Syomus/ProceduralToolkit/blob/master/Runtime/Buildings/Interfaces/ILayout.cs), [ILayoutElement](https://github.com/Syomus/ProceduralToolkit/blob/master/Runtime/Buildings/Interfaces/ILayoutElement.cs), [IConstructible](https://github.com/Syomus/ProceduralToolkit/blob/master/Runtime/Buildings/Interfaces/IConstructible.cs), [Layout](https://github.com/Syomus/ProceduralToolkit/blob/master/Runtime/Buildings/Layout.cs), [HorizontalLayout](https://github.com/Syomus/ProceduralToolkit/blob/master/Runtime/Buildings/HorizontalLayout.cs), [VerticalLayout](https://github.com/Syomus/ProceduralToolkit/blob/master/Runtime/Buildings/VerticalLayout.cs): Interfaces and classes used in facade layout generation.
- [IFacadePlanner](https://github.com/Syomus/ProceduralToolkit/blob/master/Runtime/Buildings/Interfaces/IFacadePlanner.cs), [IFacadeConstructor](https://github.com/Syomus/ProceduralToolkit/blob/master/Runtime/Buildings/Interfaces/IFacadeConstructor.cs), [IRoofPlanner](https://github.com/Syomus/ProceduralToolkit/blob/master/Runtime/Buildings/Interfaces/IRoofPlanner.cs), [IRoofConstructor](https://github.com/Syomus/ProceduralToolkit/blob/master/Runtime/Buildings/Interfaces/IRoofConstructor.cs): Interfaces for strategies controlling the details of the building generation process.
- [FacadePlanner](https://github.com/Syomus/ProceduralToolkit/blob/master/Runtime/Buildings/FacadePlanner.cs), [FacadeConstructor](https://github.com/Syomus/ProceduralToolkit/blob/master/Runtime/Buildings/FacadeConstructor.cs), [RoofPlanner](https://github.com/Syomus/ProceduralToolkit/blob/master/Runtime/Buildings/RoofPlanner.cs), [RoofConstructor](https://github.com/Syomus/ProceduralToolkit/blob/master/Runtime/Buildings/RoofConstructor.cs): Serializable wrappers for strategy interfaces.
- [ProceduralRoofs](https://github.com/Syomus/ProceduralToolkit/blob/master/Runtime/Buildings/ProceduralRoofs.cs): A collection of roof constructors for the building generator.
### Runtime/Geometry/
[](https://github.com/Syomus/ProceduralToolkit#runtimegeometry)
See [this wiki page](https://github.com/Syomus/ProceduralToolkit/wiki/Geometry-algorithms) for a matrix of available algorithms.
- [Circle2](https://github.com/Syomus/ProceduralToolkit/blob/master/Runtime/Geometry/Circle2.cs), [Circle3](https://github.com/Syomus/ProceduralToolkit/blob/master/Runtime/Geometry/Circle3.cs), [Sphere](https://github.com/Syomus/ProceduralToolkit/blob/master/Runtime/Geometry/Sphere.cs), [Line2](https://github.com/Syomus/ProceduralToolkit/blob/master/Runtime/Geometry/Line2.cs), [Line3](https://github.com/Syomus/ProceduralToolkit/blob/master/Runtime/Geometry/Line3.cs), [Segment2](https://github.com/Syomus/ProceduralToolkit/blob/master/Runtime/Geometry/Segment2.cs), [Segment3](https://github.com/Syomus/ProceduralToolkit/blob/master/Runtime/Geometry/Segment3.cs): Representations of geometric primitives.
- [Geometry](https://github.com/Syomus/ProceduralToolkit/blob/master/Runtime/Geometry/Geometry.cs): Utility class for computational geometry algorithms, contains various point samplers and helper methods.
- [Closest2D](https://github.com/Syomus/ProceduralToolkit/blob/master/Runtime/Geometry/Closest2D.cs), [Closest3D](https://github.com/Syomus/ProceduralToolkit/blob/master/Runtime/Geometry/Closest3D.cs): Collection of closest point(s) algorithms.
- [Distance2D](https://github.com/Syomus/ProceduralToolkit/blob/master/Runtime/Geometry/Distance2D.cs), [Distance3D](https://github.com/Syomus/ProceduralToolkit/blob/master/Runtime/Geometry/Distance3D.cs): Collection of distance calculation algorithms.
- [Intersect2D](https://github.com/Syomus/ProceduralToolkit/blob/master/Runtime/Geometry/Intersect2D.cs), [Intersect3D](https://github.com/Syomus/ProceduralToolkit/blob/master/Runtime/Geometry/Intersect3D.cs): Collection of intersection algorithms.
- [IntersectionType](https://github.com/Syomus/ProceduralToolkit/blob/master/Runtime/Geometry/IntersectionType.cs): Enum used in intersection algorithms.
- [Intersections](https://github.com/Syomus/ProceduralToolkit/blob/master/Runtime/Geometry/Intersections) folder: Structures containing information about intersections.
### Runtime/Geometry/StraightSkeleton/
[](https://github.com/Syomus/ProceduralToolkit#runtimegeometrystraightskeleton)
Classes used in [straight skeleton](https://en.wikipedia.org/wiki/Straight_skeleton) generation.
- [StraightSkeletonGenerator](https://github.com/Syomus/ProceduralToolkit/blob/master/Runtime/Geometry/StraightSkeleton/StraightSkeletonGenerator.cs): A straight skeleton generator, computes a straight skeleton for the input polygon, reusable. The generation algorithm is loosely based on the work of Tom Kelly (2014) [Unwritten procedural modeling with the straight skeleton](http://www.twak.co.uk/2014/02/unwritten-procedural-modeling-with.html).
- [StraightSkeleton](https://github.com/Syomus/ProceduralToolkit/blob/master/Runtime/Geometry/StraightSkeleton/StraightSkeleton.cs): A straight skeleton representation.
- [Plan](https://github.com/Syomus/ProceduralToolkit/blob/master/Runtime/Geometry/StraightSkeleton/Plan.cs): Representation of the active plan during generation process.
### Runtime/ClipperLib/
[](https://github.com/Syomus/ProceduralToolkit#runtimeclipperlib)
The [Clipper](http://www.angusj.com/delphi/clipper.php) library. Use [PathClipper](https://github.com/Syomus/ProceduralToolkit/blob/master/Runtime/PathClipper.cs) and [PathOffsetter](https://github.com/Syomus/ProceduralToolkit/blob/master/Runtime/PathOffsetter.cs) for seamless interoperability with Unity.
### Runtime/LibTessDotNet/
[](https://github.com/Syomus/ProceduralToolkit#runtimelibtessdotnet)
The [LibTessDotNet](https://github.com/speps/LibTessDotNet) library. The recommended use is through the wrapper class [Tessellator](https://github.com/Syomus/ProceduralToolkit/blob/master/Runtime/Tessellator.cs).
### Runtime/FastNoiseLib/
[](https://github.com/Syomus/ProceduralToolkit#runtimefastnoiselib)
The [FastNoise](https://github.com/Auburns/FastNoise_CSharp) library.
### Shaders/
[](https://github.com/Syomus/ProceduralToolkit#shaders)
Depending on the installation type, the shader library can be used like this:
```hlsl
#include "Packages/com.syomus.proceduraltoolkit/Shaders/SDF.cginc"
```
Or like this:
```hlsl
#include "Assets/ProceduralToolkit/Shaders/SDF.cginc"
```
- [Common.cginc](https://github.com/Syomus/ProceduralToolkit/blob/master/Shaders/Common.cginc): Collection of shaping and debug functions.
- [Easing.cginc](https://github.com/Syomus/ProceduralToolkit/blob/master/Shaders/Easing.cginc): Normalized easing functions.
- [SDF.cginc](https://github.com/Syomus/ProceduralToolkit/blob/master/Shaders/SDF.cginc): Collection of signed distance functions.
- [Transitions.cginc](https://github.com/Syomus/ProceduralToolkit/blob/master/Shaders/Transitions.cginc): Collection of transition animations.
- [Gradient Skybox](https://github.com/Syomus/ProceduralToolkit/blob/master/Shaders/Gradient%20Skybox.shader): Simple gradient skybox.
- [Debug](https://github.com/Syomus/ProceduralToolkit/blob/master/Shaders/Debug) folder: Debug shaders for some of the most common mesh channels.
- [VertexColor](https://github.com/Syomus/ProceduralToolkit/blob/master/Shaders/VertexColor) folder: Textureless shaders for use with color information from the vertices.
### Editor/
[](https://github.com/Syomus/ProceduralToolkit#editor)
- [ColorHSVDrawer](https://github.com/Syomus/ProceduralToolkit/blob/master/Runtime/Editor/ColorHSVDrawer.cs): PropertyDrawer for ColorHSV.
- [MeshFilterExtension](https://github.com/Syomus/ProceduralToolkit/blob/master/Runtime/Editor/MeshFilterExtension.cs): Mesh saving utility available at .`MeshFilter context menu > Save Mesh`
- [ProceduralToolkitMenu](https://github.com/Syomus/ProceduralToolkit/blob/master/Runtime/Editor/ProceduralToolkitMenu.cs): Submenu with constructors for primitives at .`GameObject > Procedural Toolkit`
- [RulesetDrawer](https://github.com/Syomus/ProceduralToolkit/blob/master/Runtime/Editor/RulesetDrawer.cs): PropertyDrawer for CellularAutomaton.Ruleset.
### Tests/
[](https://github.com/Syomus/ProceduralToolkit#tests)
Tests for the library
## Samples
### [Buildings](https://syomus.com/ProceduralToolkit/Buildings)
[](https://github.com/Syomus/ProceduralToolkit#buildings)
[![](https://camo.githubusercontent.com/735315a0fc2e06f029c69819b5458fddd3536a52c746e79c94966945f635243a/68747470733a2f2f73796f6d75732e636f6d2f50726f6365647572616c546f6f6c6b69742f73637265656e73686f742d6275696c64696e67732e706e67)](https://camo.githubusercontent.com/735315a0fc2e06f029c69819b5458fddd3536a52c746e79c94966945f635243a/68747470733a2f2f73796f6d75732e636f6d2f50726f6365647572616c546f6f6c6b69742f73637265656e73686f742d6275696c64696e67732e706e67)
A fully procedural building generator, creates an entire mesh from scratch and paints it's vertices. Keep in mind that the generated mesh has no uv map so using it with Standard shader is pointless.
- BuildingGeneratorComponent: A simple minimal example on how you can use BuildingGenerator
- BuildingGeneratorConfigurator: A configurator for BuildingGenerator with UI and editor controls.
- BuildingGeneratorReuse: An example on how you can reuse the same generator to generate multiple buildings.
- ProceduralFacadePlanner: A facade planning strategy, controls the layouts of the facades.
- ProceduralFacadeConstructor: A facade construction strategy, used in conjunction with ProceduralFacadePlanner.
- ProceduralRoofPlanner: A roof planning strategy, generates a roof description based on the input config.
- ProceduralRoofConstructor: A roof construction strategy, used in conjunction with ProceduralRoofPlanner.
- ProceduralFacadeElements: A collection of fully procedural facade panels for the building generator.
- PolygonAsset: A ScriptableObject container for vertices.
- BuildingGeneratorConfiguratorEditor: A custom inspector for BuildingGeneratorConfigurator.
### [Chairs](https://syomus.com/ProceduralToolkit/Chairs)
[![](https://camo.githubusercontent.com/26d9a87a3f912a162bda356d8000bcc052798f777f2752fa66450c051618a643/68747470733a2f2f73796f6d75732e636f6d2f50726f6365647572616c546f6f6c6b69742f73637265656e73686f742d6368616972732e706e67)](https://camo.githubusercontent.com/26d9a87a3f912a162bda356d8000bcc052798f777f2752fa66450c051618a643/68747470733a2f2f73796f6d75732e636f6d2f50726f6365647572616c546f6f6c6b69742f73637265656e73686f742d6368616972732e706e67)
A fully procedural chair generator, creates an entire mesh from scratch and paints it's vertices.
- ChairGenerator: Main generator class. Generates chairs based on input configuration.
- ChairGeneratorConfigurator: Configurator for ChairGenerator with UI and editor controls.
- ChairGeneratorConfiguratorEditor: Custom inspector for ChairGeneratorConfigurator.
- Armrests, Backs, Stretchers: Chair parts constructors.
### [Low Poly Terrain](https://syomus.com/ProceduralToolkit/LowPolyTerrain)
[](https://github.com/Syomus/ProceduralToolkit#low-poly-terrain)
[![](https://camo.githubusercontent.com/3e29b07fce0d650233b9affb875a556b7671d09d9b553a150992dc505c047b8a/68747470733a2f2f73796f6d75732e636f6d2f50726f6365647572616c546f6f6c6b69742f73637265656e73686f742d6c6f772d706f6c792d7465727261696e2e706e67)](https://camo.githubusercontent.com/3e29b07fce0d650233b9affb875a556b7671d09d9b553a150992dc505c047b8a/68747470733a2f2f73796f6d75732e636f6d2f50726f6365647572616c546f6f6c6b69742f73637265656e73686f742d6c6f772d706f6c792d7465727261696e2e706e67)
A simple low poly terrain generator based on fractal noise. Doesn't support chunking or anything like that, just an example of how you can use a noise function in a plane generation algorithm.
- LowPolyTerrainGenerator: Main generator class. Generates terrain based on input configuration.
- LowPolyTerrainExample: Configurator for LowPolyTerrainGenerator with UI and editor controls.
- LowPolyTerrainExampleEditor: Custom inspector for LowPolyTerrainExample.
### [Signed Distance Functions](https://syomus.com/ProceduralToolkit/SDF)
[](https://github.com/Syomus/ProceduralToolkit#signed-distance-functions)
[![](https://camo.githubusercontent.com/311818ba566f2959e4ede0d748979bcfa1b305b761b0aafdedb51e5b848e5ba6/68747470733a2f2f73796f6d75732e636f6d2f50726f6365647572616c546f6f6c6b69742f73637265656e73686f742d7364662e706e67)](https://camo.githubusercontent.com/311818ba566f2959e4ede0d748979bcfa1b305b761b0aafdedb51e5b848e5ba6/68747470733a2f2f73796f6d75732e636f6d2f50726f6365647572616c546f6f6c6b69742f73637265656e73686f742d7364662e706e67)
A collection of shaders showing how you can utilise functions from the shader library.
- StarPolygon: A simple shader that draws a star polygon and shows a difference between "normal" and "cheap" functions.
- Shapes: A demonstration of some of the available shapes.
- DistanceOperations: A square and a circle combined with different functions.
- Easing: All easing functions in one shader showing the ease curve and the easing motion.
- Transitions: An example showing the sequencing and animation techniques.
- Animation: A more complex example on how you can create patterns and animate them in shader.
### [Cellular Automata](https://syomus.com/ProceduralToolkit/CellularAutomata)
[](https://github.com/Syomus/ProceduralToolkit#cellular-automata)
[![](https://camo.githubusercontent.com/44f7a508ab234ec52a9d44aa6e3268d7e1fe64da8473399fe9effd126d9565f6/68747470733a2f2f73796f6d75732e636f6d2f50726f6365647572616c546f6f6c6b69742f73637265656e73686f742d63656c6c756c61722d6175746f6d6174612e706e67)](https://camo.githubusercontent.com/44f7a508ab234ec52a9d44aa6e3268d7e1fe64da8473399fe9effd126d9565f6/68747470733a2f2f73796f6d75732e636f6d2f50726f6365647572616c546f6f6c6b69742f73637265656e73686f742d63656c6c756c61722d6175746f6d6174612e706e67)
A demonstration of CellularAutomaton from the main library, draws the automaton simulation on a texture. Note that some of the rulesets need noise value different from the default setting.
- CellularAutomatonConfigurator: Configurator for the automaton with UI controls.
### [Mazes](https://syomus.com/ProceduralToolkit/Mazes)
[](https://github.com/Syomus/ProceduralToolkit#mazes)
[![](https://camo.githubusercontent.com/1dcb674041b0050154917acc828ab331eff24fe17d74a64363926805f4a73a02/68747470733a2f2f73796f6d75732e636f6d2f50726f6365647572616c546f6f6c6b69742f73637265656e73686f742d6d617a65732e706e67)](https://camo.githubusercontent.com/1dcb674041b0050154917acc828ab331eff24fe17d74a64363926805f4a73a02/68747470733a2f2f73796f6d75732e636f6d2f50726f6365647572616c546f6f6c6b69742f73637265656e73686f742d6d617a65732e706e67)
A generic maze generator, draws the maze generation process on a texture.
- MazeGenerator: Main generator class. Generates mazes based on input configuration.
- MazeGeneratorConfigurator: Configurator for MazeGenerator with UI controls.
- Maze: Maze graph representation.
### [Noise](https://syomus.com/ProceduralToolkit/Noise)
[](https://github.com/Syomus/ProceduralToolkit#noise)
[![](https://camo.githubusercontent.com/a6f5362fe2188bfea2d55c99dcb8e5cfacebdf7b36ab7a1f760e2ba3ff234424/68747470733a2f2f73796f6d75732e636f6d2f50726f6365647572616c546f6f6c6b69742f73637265656e73686f742d6e6f6973652e706e67)](https://camo.githubusercontent.com/a6f5362fe2188bfea2d55c99dcb8e5cfacebdf7b36ab7a1f760e2ba3ff234424/68747470733a2f2f73796f6d75732e636f6d2f50726f6365647572616c546f6f6c6b69742f73637265656e73686f742d6e6f6973652e706e67)
An example demonstrating various noise types from the [FastNoise](https://github.com/Auburns/FastNoise_CSharp) library.
### [Breakout](https://syomus.com/ProceduralToolkit/Breakout)
[](https://github.com/Syomus/ProceduralToolkit#breakout)
[![](https://camo.githubusercontent.com/e47c47ac4ed574bc9753587c59feb5274fbdb007b4ef224cabb442e5994a789f/68747470733a2f2f73796f6d75732e636f6d2f50726f6365647572616c546f6f6c6b69742f73637265656e73686f742d627265616b6f75742e706e67)](https://camo.githubusercontent.com/e47c47ac4ed574bc9753587c59feb5274fbdb007b4ef224cabb442e5994a789f/68747470733a2f2f73796f6d75732e636f6d2f50726f6365647572616c546f6f6c6b69742f73637265656e73686f742d627265616b6f75742e706e67)
A [Breakout](https://en.wikipedia.org/wiki/Breakout_\(video_game\)) clone with procedurally generated levels.
- Breakout: Game engine and level generator.
- BreakoutConfigurator: Configurator for the game with UI controls.
- Brick: Disables game object on collision.
### [Characters](https://syomus.com/ProceduralToolkit/Characters)
[](https://github.com/Syomus/ProceduralToolkit#characters)
[![](https://camo.githubusercontent.com/fa720682ac1cee0566e794e176c567e632c22267c138016805d28b742d6e7f42/68747470733a2f2f73796f6d75732e636f6d2f50726f6365647572616c546f6f6c6b69742f73637265656e73686f742d636861726163746572732e676966)](https://camo.githubusercontent.com/fa720682ac1cee0566e794e176c567e632c22267c138016805d28b742d6e7f42/68747470733a2f2f73796f6d75732e636f6d2f50726f6365647572616c546f6f6c6b69742f73637265656e73686f742d636861726163746572732e676966)
A simple 2D character generator. Sprites made by [Kenney](http://kenney.nl/).
- Character: A container for sprite renderers
- CharacterGenerator: Generates a sprite set and a name for character.
- CharacterGeneratorConfigurator: Configurator for CharacterGenerator.
- NameGenerator: Generates a random name from a large array of names.
### [Primitives](https://syomus.com/ProceduralToolkit/Primitives)
[](https://github.com/Syomus/ProceduralToolkit#primitives)
[![](https://camo.githubusercontent.com/a14cbae0a0009b6c2be38b5c3605be404902d5d65555a9b1ae01e4d3feb1392a/68747470733a2f2f73796f6d75732e636f6d2f50726f6365647572616c546f6f6c6b69742f73637265656e73686f742d7072696d6974697665732e706e67)](https://camo.githubusercontent.com/a14cbae0a0009b6c2be38b5c3605be404902d5d65555a9b1ae01e4d3feb1392a/68747470733a2f2f73796f6d75732e636f6d2f50726f6365647572616c546f6f6c6b69742f73637265656e73686f742d7072696d6974697665732e706e67)
A demonstration of some of the available MeshDraft primitives.
- Cylinder, Dodecahedron, FlatSphere, Hexahedron...: Mesh generators that can be configured via the inspector.
### Drawing
[](https://github.com/Syomus/ProceduralToolkit#drawing)
Three identical shapes made with three different methods: DebugE, GLE and GizmosE.
### Clipper
[](https://github.com/Syomus/ProceduralToolkit#clipper)
A simple example demonstrating the api's of PathClipper and PathOffsetter.
### Tessellator
[](https://github.com/Syomus/ProceduralToolkit#tessellator)
An example showing the usage of Tesselator.
### StraightSkeleton
[](https://github.com/Syomus/ProceduralToolkit#straightskeleton)
An StraightSkeletonGenerator example showing how you can generate a straight skeleton from a polygon and use the result.
### Common
[](https://github.com/Syomus/ProceduralToolkit#common)
UI prefabs and the skybox material used in examples.
- SkyBoxGenerator: Skybox generator, assuming that scene uses gradient skybox shader, animates transitions to new parameters every few seconds.
- ButtonControl, SliderControl, TextControl, ToggleControl: UI controls for generators.
- CameraRotator: Orbiting camera controller.
- ConfiguratorBase: Base class for configurators.

View File

@@ -1,4 +0,0 @@
https://zhuanlan.zhihu.com/p/68530142 Batch的前世今生
但是因为Pass不同
透明度不同,可能需要半透明混合而另外一个不需要,就会形成两次[[DrawCall]]渲染层级不同等等原因

View File

@@ -1 +0,0 @@
一个Batch即为同一批材质的游戏对象

View File

@@ -1 +0,0 @@
CPU调用一次GPU即为一次

View File

@@ -0,0 +1,6 @@
---
原文发布链接: https://github.com/UnityPatterns/PolyMesh/tree/master
tags:
- 网格
- 2D
---

View File

@@ -0,0 +1 @@
把数据加载到显存设置渲染状态CPU调用GPU渲染的过程称之为一个Batch。这其实就是渲染流程的运用阶段最终输出一个渲染图元(点、线、面等)再传递给GPU进行几何阶段和光栅化阶段的渲染显示。一个Batch必然会触发一次或多次DrawCal目包含了该对象的所有的网格和顶点数据以及材质信息。把数据加载到显存是指把清染所蛋的数据从硬盘加载到内存(RAM),再将网格和纹理等加载到显卡 VRAM),这一步比较释时。设置清染状态就是设置场景中的网格的顶点 Verex)片元(Fragment)着色器光源属性材质等。Unitv提供的动态合批(Dvnamic Batching)合并的就是这一过程,将清染状态相同的对象合并成-个Batch减少DrawCall。

View File

@@ -0,0 +1 @@
CPU每次调用图像编程接口 glDrawElements(0penGl日中的图元清染函数)或者 DrawIndexedPrimitive(Direct中的顶点绘制方法)命令GPU渲染的操作称为一次Draw CalDraw Cal就是一次渲染命令的调用它指向一个需要被渲染的图元(primitive)列表不包含任何材质信息glDrawElements 或者 DrawIndexedPrimitive 函数的作用是将CPU准备好的顶点数据渲染出来.

View File

@@ -0,0 +1 @@
Shader脚本中一个Pass语义块就是一个完整的渲染流程一个着色器可以包含多个Pass语义块每当GPU运行-个Pass之前就会产生一个SetPassCall所以可以理解为一次完整的染流程次数。

View File

@@ -0,0 +1,19 @@
---
原文发布链接: https://blog.csdn.net/Wei_Yuan_2012/article/details/88677172?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.nonecase&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.nonecase
tags:
- 性能优化
- Batch
- DrawCall
- SetPassCall
---
- [[DrawCall]]:CPU每次调用图像编程接口 glDrawElements(0penGl日中的图元清染函数)或者 DrawIndexedPrimitive(Direct中的顶点绘制方法)命令GPU渲染的操作称为一次Draw CallDraw Call就是一次渲染命令的调用它指向一个需要被渲染的图元(primitive)列表不包含任何材质信息glDrawElements 或者 DrawIndexedPrimitive 函数的作用是将CPU准备好的顶点数据渲染出来.**在Unity FrameDebugger中每一项都是一个DrawCall**
- [[Batch]]:把数据加载到显存设置渲染状态CPU调用GPU渲染的过程称之为一个Batch。这其实就是渲染流程的运用阶段最终输出一个渲染图元(点、线、面等)再传递给GPU进行几何阶段和光栅化阶段的渲染显示。**一个Batch必然会触发一次或多次DrawCall且包含了该对象的所有的网格和顶点数据以及材质信息。把数据加载到显存是指把清染所蛋的数据从硬盘加载到内存(RAM),再将网格和纹理等加载到显卡 VRAM)**,这一步比较释耗时。设置清染状态就是设置场景中的网格的顶点 Verex)片元(Fragment)着色器光源属性材质等。Unitv提供的动态合批(Dvnamic Batching)合并的就是这一过程将清染状态相同的对象合并成一个Batch减少DrawCall。
- [[SetPassCall]]:Shader脚本中一个Pass语义块就是一个完整的渲染流程一个着色器可以包含多个Pass语义块每当GPU运行一个Pass之前就会产生一个SetPassCall所以可以理解为一次完整的染流程次数。
由此可见一个Batch包含一个或多个DrawCall都是产生是在CPU阶段而目前普遍渲染的瓶颈恰恰就是CPUGPU的处理速度比CPU快多了Draw Call太高CPU会把大量时间花费在处理Draw Call调用上如果Batch太大CPU需要频繁的从硬盘加载数据切换渲染状态这个消耗要比DrawCall大所以后面Unity才逐渐弱化了DrawCall的显示。
再提一下优化的时候还要关注下Statistics窗口上的三角形数(Tris)和顶点数(Verts),这两个数据也是会影响到性能,比如**单个物体的顶点数最好不要超过900不然会影响到Unity的动态合批**。Unity的Statistics窗口上的三角形数(Tris)和顶点数(Verts)并不仅仅是视链中的梯形内的三角形数和顶点数而是Camera中 feld ofview所有取值下的三角形数和顶点数也就是说即使当前Gam视图中看不到这个 cube只有 field ofview在1-179 范围内都看不到这个cubestats面板才不会统计GPU才不会渲染否则都会渲染而且Unity不会把模型四拆分这个模型哪怕只有1个顶点需要渲染Unity也会把整个模型都渲出来。

View File

@@ -0,0 +1,7 @@
---
原文发布链接: https://zhuanlan.zhihu.com/p/444413015?utm_psn=1903740548596097377
tags:
- 性能优化
- URP
---
- 基于安卓平台开发的。因此你需要把编辑器的环境设置如上。在Command Line Arguments上输入`-force-vulkan`让其作为vulkan api运行。

View File

@@ -0,0 +1,6 @@
---
链接1: https://github.com/killop/anything_about_game
链接2: https://github.com/michidk/Unity-Script-Collection
tags:
- 工具包
---

View File

@@ -0,0 +1,3 @@
---
资源链接: https://sonniss.com/gameaudiogdc/
---