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 ataxkt · Sep 14, 2013 at 09:25 PM · shadermatrixminecraftpost effectsprojection-matrix

Replicating the Minecraft Acid Mod

Hi! I'm curious to know how this effect was achieved. http://www.youtube.com/watch?v=JpksyojwqzE I've had a look into projection matricies and post-processing effects, and I wondered if this could perhaps be how this was achieved.

It seems to have an ever-changing screen-space distortion map which affects items based on their distance, I thought might be a more complicated projection matrix, if such a thing exists. They claim to use a shader on their video, but that doesn't make sense to me - are shaders not material specific? This seems to work on the entire world.

Can anyone shed any light?

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

1 Reply

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by tanoshimi · Sep 14, 2013 at 11:07 PM

It is done with a GLSL shader, as stated in the link in the video description.

Note that "shader" can have slightly different meanings in different contexts - in Unity, "Shaders" are implemented through materials, which are then attached to individual gameobjects to define how they should be drawn to the screen. A "shader" in the general sense is a program executed on the graphics card to determine what pixel values should be displayed on the screen - they can apply to individual objects, parts of a scene, or the full world. Unity's "Image Effects" are basically just types of shader that affect the entire scene (rendered to a texture) rather than just objects in the scene. To make it more confusing, "Shaders" themselves are composed of one or more "Subshaders", which in turn contain a "Pixel Shader", "Fragment Shader", or "Surface Shader". It's not exactly the best nomenclature in the world :)

The particular shader used here looks to use a vertex modifier that uses a sinewave distortion over time multiplied by the distance to the vertex in x/z planes calculated in view space. It would certainly be possible to recreate this effect in Unity.

Comment
Add comment · Show 5 · 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 ataxkt · Sep 15, 2013 at 01:17 AM 1
Share

That's so helpful, thanks! So to replicate this I'm going to need Unity Pro? From what I read GLSL isn't too compatible with Unity, so I suppose I'll need to look into writing shaders for a bit. How intensive might you estimate this effect? I was hoping to get it running on mobile.

avatar image Bunny83 · Sep 15, 2013 at 01:27 AM 1
Share

You don't need Unity pro. This might get you started

avatar image ataxkt · Sep 15, 2013 at 03:46 AM 0
Share

Just the effect I was looking for. Now my last subquestion - to avoid putting that shader on all my gameobjects, would I need to look into building an post-processing image effect so to apply it to the whole world?

avatar image tanoshimi · Sep 15, 2013 at 07:21 AM 2
Share

Not necessarily - you could create "warped" versions of each of the shaders you used in the game, and then just swap them in via a script. Remember that although each of your gameobjects have their own material, many of those materials share the same shader, so you don't necessarily need that many shaders.

So, let's say all the materials in your game used either a Diffuse shader, a Bumped Diffuse shader, or a Specular shader. To warp the entire game world, you could create versions of each of these shaders based on their existing shader code and additionally incorporated the warping code. Then you could run a script that changed objects' shaders to their warped versions, as in the following (pseudo)code:

 if(renderer.material.shader = Shader.Find ("Diffuse")){
   // Switch to the warped diffuse shader
   renderer.material.shader = Shader.Find ("Warped/Diffuse");
 }
 else if(renderer.material.shader = Shader.Find ("Specular")){
   // Switch to the warped specular shader
   renderer.material.shader = Shader.Find ("Warped/Specular");
 }
 ...

I'm not saying this is the best way to do it, but it should work and it doesn't require any Pro features.

avatar image ataxkt · Sep 15, 2013 at 12:30 PM 0
Share

Sounds like a great solution, I'll have a peek into it. I'd quite like to explore making it a post-effect too - would you have any advice for where to start hunting? Doesn't seem to be much documentation on building your own. Thanks, by the way, I love this community! :D

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

17 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 avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Change projection matrix for each objects 0 Answers

_WorldSpaceCameraPos and converting to object space 1 Answer

Is it possible to use a single function for OnRenderImage AND [ImageEffectOpaque]OnRenderImage? 0 Answers

How to set ortho projection / model view matrix without a camera? 2 Answers

Previous Model*View*Projection Matrix 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