• 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
0
Question by dyamanoha · Jun 02, 2012 at 06:14 PM · transformshaderlabtypepropertiesmatrix

Is there a list of ShaderLab property types somewhere?

I'm just getting my feet wet in ShaderLab and am a bit confused as to why I can't find a simple list of property types. Is there a reference for this out there? I'm looking for a way to specify a 4x4 transformation matrix as a property.

As a secondary question, is there any helper methods to generate a model-view-transform given a world-space-transform, near/far plane distances, aspect ratio and view angle? (or maybe even just the dimensions of a texture?).

My end goal is to simply render the scene from the perspective of an object that is not a camera... (Yes, it's a light source, and this is as much of a way for me to start learning the shader pipeline as it is me not wanting to fork out the money for pro).

To be completely explicit -- this doesn't compile:

 Properties 
 {
   _LightSource ("Light Source", float4x4)
 }
Comment
Add comment · Show 2
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 Jessy · Jun 02, 2012 at 06:18 PM 0
Share

One question per page, please.

avatar image dyamanoha · Jun 02, 2012 at 06:31 PM 0
Share

Yeah, my bad, I found those same sources right after I posted the question.

2 Replies

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

Answer by Bunny83 · Jun 02, 2012 at 06:18 PM

A quick google gave me this:
http://forum.unity3d.com/threads/68245-How-to-set-Matrix-as-a-Property

edit

You should also check the CG include files in the Unity folder (`%Unity_install_path%/Editor/Data/CGIncludes/`). They should help you with most tiny problems. There are already a lot of global shader parameters set by Unity, so check them out.

Comment
Add comment · 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
0

Answer by Jessy · Jun 02, 2012 at 06:24 PM

I'm just getting my feet wet in ShaderLab and am a bit confused as to why I can't find a simple list of property types.

Me too! Google "shaderlab properties" and they're the first hit!

Matrix parameters are not exposed in the material inspector, but can be set and queried with SetMatrix and GetMatrix from scripts.

http://unity3d.com/support/documentation/ScriptReference/Material.SetMatrix.html

Comment
Add comment · Show 3 · 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 Owen-Reynolds · Jun 02, 2012 at 07:00 PM 1
Share

There's an old rule in computers that if something is tricky to use, and most people won't need it, make it hard to find. $$anonymous$$eeps new users form accidentally trying to most difficult stuff first. I think Unity is using that trick for shaders.

Sort of "if you can't take an hour to find all the commands, you won't have patience to write a shader."

avatar image Shadoninja Owen-Reynolds · Sep 21, 2019 at 06:42 PM 0
Share

That way of thinking is fundamentally misguided.

avatar image badweasel · Mar 03, 2015 at 08:58 AM 2
Share

But when I've been writing GLSL shaders for years, to now try to do simple things in Cg is like hours and hours of googling and pulling out my hair. And the info is scattered all over the net and that link above doesn't answer the specific thing I'm looking for. If I had enough karma I'd be down voting a lot of these "smarter than you" answers that I come across on my day long search for what should be a simple 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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

7 People are following this question.

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

Related Questions

Adding data to a set of transforms 1 Answer

Variable of Type Transform 3 Answers

Checking if a Transform/Matrix is Mirrored 0 Answers

Modify position in transform matrix 3 Answers

ShaderLab: Init a property from a builtin value? 0 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges