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 aBs0lut30 · May 14, 2012 at 03:47 PM · shaders

Tilt Shift Shader

Hi Guys, I am pretty new to the unity environment and am still trying to figure everything out... I have run across a question though that I cannot figure out. I have an old GLSL shader(I have not tried to convert it to Cg yet...) that I have plugged into unity that does a tilt shift effect. Now, I have gotten it to compile alright and I can apply it using SetReplacementShader() but, of course it does not handle lighting or anything like that so it completely screws up the rendered output. My question is this, how (assuming there is a way) can I insert the shader into the global scene without replacing the existing one? I dont want to turn off the built in shader, just render the tilt shift on the end of the process? I know unity has the built in Image Effect, but A) I am not overly impressed with it, and B) dont feel like dropping that much money for it...

Thanks

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

3 Replies

· Add your reply
  • Sort: 
avatar image
-1

Answer by Jessy · May 14, 2012 at 06:25 PM

Rewrite your own Image Effect.

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
-2

Answer by aBs0lut30 · May 15, 2012 at 02:39 PM

--Jessy Wouldn't that still require Unity Pro to have access to the Image Effects??

--Owen The shader I am playing with is actually not a unity shader. I found it out on a old blog post, it's a GLSL shader that was created in blender... Like I said, I got it to compile and execute, just does not work correctly, but how I am applying it I would not expect it to... So I guess my question becomes this... A) is it even possible to modify the default/built in shader? If so I could just inject my DoF/TiltShift code into it and be done with it... However I dont see anything obvious as to the location of an actual shader file for the default one, so I am guessing no... So it then becomes a matter of either figuring out how to do it with image effects (assuming any of that is accessable without unity pro) or adding enough functionality to make it the default shader. As it stands now, when I apply that shader to the camera in my test scene, the terrain texture still applies although with no lighting, so it looks really funky, and primitives just render completely white... Does anyone have any good link's on the details of unity shaders? They have never been my strong suite but I guess I am going to have to dig in a good bit to make this do what I need it to. So, any links for info or tutorials would be great! I am reading over the Nvidia Cg book now trying to get a better idea of what I need to do.

Thanks!

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 Jessy · May 15, 2012 at 02:42 PM 0
Share

Of course it requires Unity Pro. I don't know why you'd expect to achieve this without render textures.

avatar image Owen-Reynolds · May 15, 2012 at 05:00 PM 0
Share

I was describing how to turn non-Unity per-model shaders into something that works with Unity.

SetReplacementShader isn't what you want. It just temporarily changes the shader on each model. Even if you made them depthwise blurry that way (which you could) they would still have hard edges.

A full-screen effect (I looked up Tilt-Shift) isn't a replacement. It's an extra step. You draw as normal to a fake screen (the render texture) then do an extra pass on that. Adding the extra pass is part of Pro.

Unity does a good job on making sure the things in Pro really require Pro. Generally, if it says Pro on a feature, you can't duplicate it in Free. The thing is, Unity Free has such a crazy amount of functionality -- you can modify source code to even the particle shaders, for $0, with not just their blessing, but their encouragement.

avatar image aBs0lut30 · May 15, 2012 at 05:55 PM 0
Share

Thanks guys... Sounds like I am just going to have to breakdown and buy pro to get anything working. Ohh well, just trying to save some money ;)

avatar image
0

Answer by Owen-Reynolds · May 15, 2012 at 02:28 PM

Simplest is to find the shader you're using (search for Unity builtin shaders,) drag it over, change the name and modify it.

It's likely a Unity "surf" shader -- a partial fragment shader which has lighting auto-applied after. That means if you have any post-lighting effects, that trick won't work. Unity recognizes certain fields in the fragment input structure, and will auto-supply that data if you add the field, but there are a few that it won't -- you can still add your own "do nothing" vert shader to supply those.

If the shader just sets a pile of parameters, it's likely in shaderLab syntax (the old setting switches method, before programmable shaders) and is a huge pain to figure 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

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

6 People are following this question.

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

Related Questions

Doom Classic Effect - Realtime Pixelated Shadows 1 Answer

shader problem 0 Answers

Unity 5 and PhysX shaders. 0 Answers

Shaders crashing game on iOS 6 0 Answers

Unity 5 Standard shader to legacy shader 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