• 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 yosh · Mar 03, 2010 at 04:09 PM · shader

Colorize main-color of the iPhone/lightmap/reflective shader doesnt work...

Hi,

the "Penelope"-iPhone-Tutorial for example is using the "iPhone/lightmap/reflective"-shader. (object-example in penelope: "polySurface973").

I would like to make the same reflection for the iphone and use this shader. But im wondering, while im changing the "Main-Color"-property in the inspector, nothing changes. What are the requirements for the three different textures using this reflective shader? I have to colorize the material...

Its a pity thats no iphone-shader declaration like for the standard unity shaders.

Thanks for your time, yosh

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

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Jessy · Mar 03, 2010 at 05:34 PM

Shaders that work on the iPhone can currently only use fixed function ShaderLab commands; no Cg or GLSL. As such, the shaders are extremely simple, and ShaderLab is pretty well-documented, so I don't think they warrant explanations. I'd rather have the developers work on something that we shouldn't be worrying about ourselves.

In addition, this shader in particular isn't put together very well. The Main Color property actually does nothing whatsoever. Give me the requirements for what you need, and I'll write it for you, though.

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 yosh · Mar 04, 2010 at 08:23 AM 0
Share

@Jessy: You would write it for me??? How great is that. Yeah! Actually i need that "iphone/lightmap/reflective"-shader, in which i can colorize the main-color of that material. But unfortunately i dont know if you should now colorize the base-rgb oder the lightmap texture. I think the base-rgb-texture should work... Again jessy, helping me out would be really great. Thanks for your time for that.

avatar image yosh · Mar 04, 2010 at 08:32 AM 0
Share

@Jessy: And again, would there be a way to adjust the alpha-value of that Texture2D-reflection?

avatar image yosh · Mar 04, 2010 at 08:38 AM 0
Share

@Jessy: .. and maybe the alpha-value of that main-color-value? :) Hope thats not too much work for you...

avatar image
1

Answer by Jessy · Apr 01, 2010 at 02:14 AM

I'm sorry. This terrible website did not contact me about you having commented. Now it's a month later, and only now, via the RSS feed sending out your question again, due to it being unanswered, do I see these comments. I'm posting this in a new answer in hopes that it makes the website work better. Ug! >8-O

Everything you mentioned is doable, but the more textures you want to use, the more passes you're going to need, because the iPhone's GPU isn't very good. Here is an option that would work in one pass. It doesn't require a mask for the "main color", because it uses the vertex colors for that. If you don't want colorization in a certain area, then use white. It also uses the vertex colors' alpha channel as a reflectivity mask.

So, this is probably the fastest method to achieve everything you mentioned, but it does require that vertex colors will work for your application. That should be the case if you have hard edges or are just using smooth gradients. Let me know if this is not sufficient, and I'll give you something more appropriate. However, do be very clear, and don't ask for things you don't need. Every little bit counts, on the iPhone. The more you can get away with, with vertex colors, instead of textures, the better you can do in terms of batching, as long as your meshes have few enough vertices.

Shader "iPhone/Vertex Lightmap + Masked Spheremap" {

Properties { _MainTex ("Main Texture (RGB)", 2D) = "" _Spheremap ("Spheremap (RGB)", 2D) = "" {TexGen SphereMap} }

SubShader {Pass {
// ShaderLab doesn't provide a way that I know of // to not screw up the SphereMap with BindChannels. ColorMaterial Ambient Lighting Off

 SetTexture[_MainTex] {Combine primary * texture}
 SetTexture[_Spheremap] {Combine texture Lerp(primary) previous}

}}

}

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

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

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

No one has followed this question yet.

Related Questions

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

Can i force a renderer with standard shader material to crossfade? 0 Answers

Illuminate specific parts of a texture? 1 Answer

How can I change the self ilumshader its emission value on a material from a script? 2 Answers

Problem when combining Vertex Displacement + Outlines 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