Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by eckhard · Jan 31 at 07:53 PM · shader

Shader Graph restricted Billboard to one axis

Hey guys,

Can you help me out with "billboarding" a quad so that it can still be stretched forward with z axis scale. Goal is to have it face the camera / view but be transformed what would be a local z rotation.


I started of with the mentioned billboard shader resulting in translating everything as if it was rotated on x by 90 degrees. I cant figure out how to keep if flat like the one next to it seen here on the second screenshot.


192012-unity-acsbvykv9j.jpg
192013-unity-tvk5umstuu.jpg

Picking up from here: (thanks for pointing out new question @andrew-lukasik )

https://answers.unity.com/questions/1621611/how-to-do-billboard-shader-with-shadergraphhow-to.html?childToView=1884561#comment-1884561


unity-tvk5umstuu.jpg (62.1 kB)
unity-acsbvykv9j.jpg (83.6 kB)
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by andrew-lukasik · Feb 02 at 10:27 PM


This graph will rotate a default Plane mesh along it's Z axis to always face the camera (local Y+):


Z axis billboard


preview:

Z axis billboard preview

mesh scale is (1,1,2) hence a rectangle


BillboardZ.shadergraph.zip



billboardzshadergraph.zip (6.2 kB)
Comment
Add comment · Show 5 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image eckhard · Feb 03 at 07:41 AM 0
Share

Thanks Andrew! I am investigating today to give you a proper feedback here.

FYI: This takes so much longer than expected. For whatever reason unity is doing "nothing" with the shader on screen. I saw it working only one time.. idk why - cannot replicate. No errors besides the implicit truncation warnings from shader graph. So I get the very latest 2020.3 now and set up a new project to have a second look at it.

avatar image andrew-lukasik eckhard · Feb 03 at 01:04 PM 0
Share

Idk, this is my shadergraph file: BillboardZ.shadergraph.zip (RMB/save file as). Works fine on my computer :T

File is from Unity 2021.2 / URP / Shader Graph 12.1.4

avatar image vladalexsh · May 31 at 10:30 PM 0
Share

Andrew сan you suggest how to change this shader so that it is applied to each polygon instead of the entire mesh? Like grass on Terrain. I'm assuming it should be about Tangent Space, but I still can't get it right. Sorry for my stupidity, I'm new to Unity and really need some advice! Thanks.

avatar image andrew-lukasik vladalexsh · Jun 01 at 07:06 AM 1
Share

You either need a geometry shader or a pre-calculated rotation pivot/vertex to do that. Geometry shader is available from HLSL not Shader Graph. I suggest looking into geometry shaders.

avatar image vladalexsh andrew-lukasik · Jun 01 at 12:59 PM 1
Share

Thanks a lot for your answer! :)

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

204 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to force the compilation of a shader in Unity? 5 Answers

Animated Texture based on Movement 0 Answers

Shader From Assetbundle Compiled On PC with Target of Android Platform Turn Pink 0 Answers

Minecraft style pixels 1 Answer

Shader not whiter than the original sprite color? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges