Giter Club home page Giter Club logo

unity3d-billboard-generator's Introduction

unity3d-billboard-generator

A Billboard Generator with support for multi-bake passes! Built in an afternoon ~

Foliage Example

Features

  • Generates a simple cross-section billboard for a prefab (auto picks last LOD of prefab to render if it exists)
  • Support for multiple "bake passes" - allows you to bake other data (masks, normals) that you want to use

Simple Tutorial

  • Create a BillboardRenderSettings via "Create/Ardenfall/Foliage/Billboard Render Settings"
  • Add a new Billboard Texture. This will be your albedo+alpha texture.
  • Ensure the Billboard Texture's textureID matches the texture property in your billboard shader
  • Add a new Bake Pass. Keep the values as they are by default. (this pass is using the default shader, so no custom shader needed)
  • Create a BillboardAssets via "Create/Ardenfall/Foliage/Billboard Asset"
  • Add your foliage prefab to the Prefab field
  • Add your render settings to the Render Settings field
  • Click "Generate Billboard"
  • To see the results, click "Spawn Visual"

Custom BakePasses

  • Lets create a custom bakepass to use normals in our billboard!
  • Add a new Billboard Texture to your Render Settings. Set the property id to "_Normals", and toggle off Alpha Is Transparency.
  • Add a new Bake Pass. Uncheck "A", since we have no need for the alpha channel (normals can be baked into 3 channels).
  • Create a new shader. This will be your "normal bake pass shader". Make your shader output the normals of each fragment. (Literally rendering the normals)
  • Insert this shader in the "Custom Shader" field in your new Bake Pass.
  • To use this normal texture, simply sample the texture "_Normals" in your billboard.

Notes

  • When baking a pass, you may want to ensure certain properties of the rendered material is a certain value. You can do this via the Material Overrides field.
  • There is a builtin "Cutoff" value that is applied to the generated billboard material. This is optional, but if you want to use it the property name must be "_Cutoff".
  • You don't Have to use multiple bake passes per texture - you could easily pack multiple things (normals and occlusion, for example) into a single RGBA texture in a single bake pass. The multiple bake pass per texture feature is merely for convenience.
  • There are a few lines dedicated to URP - if you want to use this in builtin/HDRP it will take a little bit of work to port, but I promise it would only take a few minutes.

unity3d-billboard-generator's People

Contributors

joshcamas avatar

Stargazers

 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.