Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 11 Next capture
2021 2022 2023
1 capture
11 Jun 22 - 11 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
0
Question by YK9 · Jul 28, 2015 at 10:42 AM · shadertexturepropertiessetpost-processing

How do you choose/set the texture used in shader properties?

Greetings! In short, I can't seem to find how shaders know automatically which texture to use for each texture declared in a shader's properties. For example, if you declare a diffuse (albedo) map, a normal map, etc. in the properties the shader will set these by default automatically. All objects in our game will contain both a diffuse map and a thermal map, and I am looking to create an effect that renders the thermal map instead of a diffuse/albedo map when I enable the effect.

For more detail, I'm trying to create an infrared post-processing effect, where, when enabled, all objects in the scene use a thermal texture instead of their diffuse texture. Disabling the post-processing effect, of course, will revert back to rendering normal diffuse colors. The most basic of post-processing shaders, if they don't do anything, will pass along the diffuse color in the fragment shader. How can I set up the image effects script for all objects in the scene to use a particular texture "type"? Thank you.

Example of the effect:

Example of the effect

black-hot-white-hot-infrared.jpg (31.1 kB)
Comment
Add comment · Show 1
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 Polymo · Jul 28, 2015 at 11:03 AM 0
Share

I think what you are looking for is replacement shaders http://docs.unity3d.com/$$anonymous$$anual/SL-ShaderReplacement.html

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by PAHeartBeat · Jul 28, 2015 at 11:13 AM

Hi

First-of all shader will not identifiy which texture is set or change it on some particular condition. we can assing two texture on shader via matiial with a flag based value and lerp to texutre on based on flag value.

Still you can change your shader texture via cs / js script. Unity In-built shaders and most other third party shader has _MainTex varialble for it's main texture. which you can change it via script as bellow maintain

 public Texture2D ThermalTex;
 renderer.material.SetTexture("_MainTex",ThermalTex);

You can also replace ment shaders or Image Effect shaders to make your scene view looks like thermal Map,

you also can use render texture with camera, and process render texture with Image effect like thermal map and then use it.

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.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Clean up Material Properties 1 Answer

Finding a list of properties in Shaders 1 Answer

Multiple materials on same object 0 Answers

How to apply different textures to one model? 1 Answer

Two Textures Dissolve Shader (clip & lerp) 1 Answer


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