• 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 1337GameDev · Apr 14, 2013 at 09:27 PM · shadercolorpixelcgpass

Get color of pixel before pass: prefer cg, shaderlab is last resort

I want to get the color of a pixel in one pass, save this color to a color object and then use it in another pass. I heard shaderlab can have problems on certain graphics cards/chips when using grab pass, so this is why I want to prefer cg if I can.

I tried using grabpass("_Texture") to store this information, but I think this is the entire screen and not the pixel. This is also a sampler2D object and I am unsure how to get the color of a sampler2D. I believe I also need the pixel coordinates I am rendering, so would I need this in my structs?

I also want to avoid surface shaders (as I am not using light and my object is flat colored).

How do I get a pixel that makes up an object this shader is made up of, and grab the color that the pixel was prior, and then save this color to use for a later pass?

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

0 Replies

· Add your reply
  • Sort: 

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

11 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

Related Questions

Font Color changing shader [color changes based on what background color is] 1 Answer

Is there a way to set an alpha color? 3 Answers

Forcing Multi-Pass shader to use Deferred passes instead of Forward passes? 1 Answer

Shader - Share values between different pass 0 Answers

Colors tint at shader 0 Answers

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