GithubHelp home page GithubHelp logo

ikaroon / tmp3d Goto Github PK

View Code? Open in Web Editor NEW
90.0 5.0 8.0 2.17 MB

A small extension that makes 3D text with Unity's TextMeshPro possible. It uses raymarching and a geometry shader to work around the limitations of TMP at the moment

License: Other

C# 38.17% HLSL 42.06% ShaderLab 19.77%
extension shader textmeshpro unity unity3d 3d textmesh tmp volumetric

tmp3d's Introduction

TMP3D Logo

GitHub (Pre-)Release Date

Text Mesh Pro 3D

This is a small extension that makes 3D text with Unity's TextMeshPro possible. It uses raymarching and a geometry shader to work around the limitations of TMP at the moment.

Features

  • Solid, unlit shader (3D)
  • 3D character properties and animation
  • Outline support
  • Bold text support
  • Italic text support
  • Debug rendering
    • Steps: Showing shader complexity
    • Mask: 3D uvs
  • Text Creation Helper
  • Multiple Raymarching Algorithms
    • Simple: Equal sized steps
    • Temporal: Optimized for Temporal Antialiasing
    • SDF: Using TextMeshPro's distance values
  • Strikethrough text support
  • Underline text support
  • Face texture support
  • Documentation
  • Solid, surface shader
  • Solid, unlit shader (UI)
  • Sprite support

In Evaluation

  • Bevelled text1
  • Full fledged freeform text using textures1
  • Translucent, unlit shader
  • VR optimizations2

Compatibility

Graphics API Built-in HDRP URP
DirectX 11 ✔️ Compatible ✔️ Compatible ✔️ Compatible
DirectX 12 ✔️ Compatible ✔️ Compatible ✔️ Compatible
Vulkan ✔️ Compatible ✔️ Compatible ✔️ Compatible
OpenGL Core ✔️ Compatible ⚠️ Invalid ✔️ Compatible
OpenGLES23 ❌ Incompatible ⚠️ Invalid ❌ Incompatible
OpenGLES3 ✔️ Compatible ⚠️ Invalid ✔️ Compatible
Metal4 〰️ To Be Tested 〰️ To Be Tested 〰️ To Be Tested

If the shader doesn't work for a compatible combination try to reimport the shader file first! When the issue persists contact me!

Installation

PackageInstallation

  1. Open the package manager in Unity from Window>Package Manager
  2. Select the + dropdown button in the top-left corner of the package manager
  3. Select Add package from git URL...
  4. Enter https://github.com/Ikaroon/TMP3D.git as url and confirm

This method will always install the current state of the git. To get a released version head to the release page!

How to use

To understand how to setup a TextMeshPro for 3D you can check out the sample in the package. For downloading that follow these steps:

  1. Open the package manager in Unity from Window>Package Manager
  2. Select Text Mesh Pro 3D Support in the section Ikaroon
  3. Expand Samples
  4. Click Import next to Solid Text
  5. Now open the scene from Assets/Samples/Text Mesh Pro 3D Support/<version>/Solid Text/Scenes/Sample_TMP3D

If you still need help, here are some steps how you setup a TextMeshPro for 3D. There are two ways of creating a TextMeshPro 3D.

The Automatic way:

  1. Create a TextMeshPro in a scene from 3D Object>Text - TextMeshPro (3D)
  2. Replace the FontAsset with another font
  3. Click Create 3D Font Asset Variant if it's not a 3D font already (The button will be disabled otherwise)
  4. You have now access to 3D text!

The Manual way:

  1. Create a new FontAsset by using the Font Asset Creator from Window>Text Mesh Pro>Font Asset Creator
  2. Expand the created Asset and select the Material
  3. Change the Material's shader to TextMeshPro/3D/Unlit
  4. Create a TextMeshPro in a scene from 3D Object>Text - TextMeshPro NOT from UI>Text - TextMeshPro this is not supported yet.
  5. Add a TMP3D_Handler component from Script>Ikaroon.TMP3D>TMP3D_Handler
  6. Apply the FontAsset to the TextMeshPro component
  7. You have now access to 3D text!

Notice

Work on this project happens in my freetime and, therefore, I cannot promise if and when certain features are added. I am considering to open this up for contribution but for now you can manipulate the code as you please. This project is MIT licensed and may be used freely. (Check the license file for more information)

Bugs

When you find a bug you can create a bug report on Github! I will try to cover them as quickly as possible.

Donation

If this project helped you, you can treat me to a coffee if you want ☕

ko-fi

Contact

If you need support with this package please contact me: [email protected]

Footnotes

  1. Tempering with the SDF values in the distance makes raymarching more difficult, I need to find a good way of evaluating the shortest distance. 2

  2. I currently don't have access to any VR device and, therefore, cannot optimize for it right now.

  3. Support for OpenGLES2 is currently NOT planned.

  4. I currently don't have access to any Mac and, therefore, cannot test it for Metal right now.

tmp3d's People

Contributors

ikaroon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

tmp3d's Issues

Reduce usage of "if" in shader

At the moment the shader uses a lot of ifs. Given that they aren't recommended in shaders and should be used with caution they should be reduced if they cannot be eliminated.

Secondary Raymarcher

Use the setup for implementing an actual secondary raymarcher that does not rely on SDF steps but marches in equal sized steps

One-click 3D creation

At the moment you have to follow multiple steps to create a working 3D text mesh pro.
This should be simplified by adding a Create menu option

Doesn't work with WebGL builds.

Describe the bug
Well...
image

Desktop (please complete the following information):

  • OS: Windows 11 22H2
  • Browser Chrome
  • Version 116.0.5845.98

Additional context
Add any other context about the problem here.

Italic text support

At the moment the shader does not allow italic characters. This is a minimum feature and must be supported

Custom material inspector

At the moment all the shader properties are just displayed in one go and unordered. It would be great to have an actual inspector script for easier understanding

Performance Pass

Reevaluate the performance of the shader and apply optimizations

Strikethrough

Add support for rendering strikethrough correctly

Bold text support

At the moment bold text only increased the quads but does not increase the threshold for the SDF texture.

Documentation

A documentation for setting up a TMP3D and how to write own shader variants would be useful

VR Optimizations

This shader would be great for VR but needs further optimizations to make sure it works flawlessly and fast.

(Can't do as of now, as I don't have access to VR Hardware)

Not working on URP

Describe the bug
The sample scene renders nothing.

To Reproduce
Steps to reproduce the behavior:

  1. Add the git package as stated in the README
  2. Import the sample files from PackageManager as stated in the README
  3. Open the sample scene as stated in the README
  4. There's nothing visible in the scene.

Expected behavior
A 3D object in the scene.

Screenshots
微信截图_20240718130317

Desktop

  • OS: Windows 11

Additional context

  • Unity Editor version: 2021.3.23f1c1
  • Render Pipeline: URP 12.1.11
  • Graphics API: Direct3D11
  • Graphic card: RTX 3070

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.