Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 Fraser · Apr 28, 2011 at 03:46 PM · shadereditorgraphics

Shader works in Editor Mode, breaks when running.

I have a shader that combines two textures based upon a projection matrix. This shader works fine in the editor but the uvs don't seem to map properly while the game is running. The texture is vertically compressed and tears at the bottom of the screen.

I rewrote the below shader as a cg shader and the effect was the same, vertically compressed and torn.

So what would cause a shader to behave differently in editor as opposed to in play mode in engine.

Shader "AngleCombine" {

 Properties {        
     _MainTex ("Base (RGB) Gloss(A)", 2D) = "white" {}   
     _Other("Other", 2D) = "white" { }
 }

 Subshader {
     Pass {
         SetTexture[_MainTex] { combine texture }

         SetTexture[_Other] {                
             matrix [_ProjMatrix]
             combine texture * previous DOUBLE
         }
     }
 }

 Subshader {
     Pass {
         SetTexture [_MainTex] { combine texture }
     }
 }

}

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 Jessy · Apr 28, 2011 at 04:08 PM 0
Share

Where are you setting _Proj$$anonymous$$atrix? Also, you don't ever need to use { combine texture }, if you care.

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by taoa · Apr 28, 2011 at 04:15 PM

It would look like your _ProjMatrix might be the only possible culprist.

How do you process it? How do you set it?

Comment
Add comment · Show 1 · 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 Fraser · Apr 28, 2011 at 04:35 PM 0
Share

The _Proj$$anonymous$$atrix is set by a script that calculates it based upon the camera angle. It seems to calculate it properly because it displays properly in the the editor (it would be impossible for it to display like that without the _Proj$$anonymous$$atrix).

avatar image
0

Answer by Fraser · Apr 28, 2011 at 05:12 PM

The issue was caused by the matrix not properly transforming at non-zero values. I still don't know why it behaved differently in editor than in game (as the object is static and never moves).

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

No one has followed this question yet.

Related Questions

Allow shaders with 'time' variable to update in editor 1 Answer

Multiply Mode uses strange Alpha 1 Answer

How to replicate renderer.worldToLocalMatrix 0 Answers

Black Texture on Initial Load 1 Answer

Fake PS1 "jittery movement" effect in Unity? 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