Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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
8
Question by mlkielb · May 31, 2010 at 05:55 AM · renderingvisual-effectsunderwater

Is there a tutorial for creating the underwater effect from scratch?

Is there a tutorial for creating an underwater effect from scratch? I'm having troubles recreating the underwater features from the island demo.

Thanks.

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 mukul18khanna · Dec 26, 2017 at 11:36 AM 0
Share

https://medium.com/@mukulkhanna/creating-basic-underwater-effects-in-unity-9a9400bde928

3 Replies

· Add your reply
  • Sort: 
avatar image
11

Answer by josif · Jun 01, 2010 at 11:19 PM

try this its inset the best on but it will have to do you need to put it on the main cam and you need to call it underwater its also a JavaScript good luck

//This script enables underwater effects. Attach to main camera.

//Define variables var underwaterLevel = 7;

//The scene's default fog settings private var defaultFog = RenderSettings.fog; private var defaultFogColor = RenderSettings.fogColor; private var defaultFogDensity = RenderSettings.fogDensity; private var defaultSkybox = RenderSettings.skybox; var noSkybox : Material;

function Start () { //Set the background color camera.backgroundColor = Color (0, 0.4, 0.7, 1); }

function Update () { if (transform.position.y < underwaterLevel) { RenderSettings.fog = true; RenderSettings.fogColor = Color (0, 0.4, 0.7, 0.6); RenderSettings.fogDensity = 0.04; RenderSettings.skybox = noSkybox; }

 else {
     RenderSettings.fog = defaultFog;
     RenderSettings.fogColor = defaultFogColor;
     RenderSettings.fogDensity = defaultFogDensity;
     RenderSettings.skybox = defaultSkybox;
 }

}

Comment
Add comment · Show 6 · 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 Phoebert · Jun 06, 2012 at 05:58 PM 0
Share

I tried this script and it seems to work, but Unity is giving me errors. I'm using 3.5.

The error I get is:

ArgumentException: get_fog can only be called from the main thread. Constructors and field initializers will be executed from the loading thread when loading a scene.

If this is a version difference, do you have a similar script that works with 3.5?

avatar image Scribe · Jun 06, 2012 at 06:17 PM 2
Share

@Phoebert I think that error is when you can't read some data outside of a function, most likely becuase the data hasn't loaded yet. Try putting

private var defaultFog;
at the beggining and putting
defaultFog = RenderSettings.fog;
at the beggining of the Start function. Do the same thing for each of the 4 private vars... private var defaultFog;

private var defaultFogColor;

private var defaultFogDensity;

private var defaultSkybox;

var noSkybox : $$anonymous$$aterial;

function Start () {

 defaultFog = RenderSettings.fog;

 defaultFogColor = RenderSettings.fogColor;

 defaultFogDensity = RenderSettings.fogDensity;

 defaultSkybox = RenderSettings.skybox;

 //Set the background color

 camera.backgroundColor = Color (0, 0.4, 0.7, 1);

}

Scribe

avatar image Phoebert · Jun 07, 2012 at 01:06 AM 0
Share

Thanks Scribe :) That fixed it!

avatar image All.Else · Sep 24, 2012 at 04:52 AM 0
Share

I tried it and I was wondering if you could go into more detail on the error correction? And one more thing, is it possible to add a skybox at all? I tried adding it to the script, that didn't work, (hence the var noskybox) so I tried attaching it separately. Which didn't work either.

avatar image RHD · Dec 05, 2014 at 02:09 PM 0
Share

Thanks Scribe that complexly fixed it. Struggling to get the water level at the correct hight though. $$anonymous$$aybe it needs to be a Float or something, am trying to figure it out. Thanks for the fix!

Show more comments
avatar image
4

Answer by Kos-Dvornik · Jun 08, 2013 at 08:35 PM

Here it is: http://kostiantyn-dvornik.blogspot.com/2013/05/unity-worlds-coolest-tutorial-about.html

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
0

Answer by mukul18khanna · Dec 26, 2017 at 11:36 AM

This might help-

https://medium.com/@mukulkhanna/creating-basic-underwater-effects-in-unity-9a9400bde928

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

Visual Effect Graph: How to expose parameter to flexibly set Capacity from Inspector? 0 Answers

Visual Effects Graph and Custom Renderer not working together 0 Answers

Want Main Camera to show what fxcamera is rendering 0 Answers

Weird iPad render bug 0 Answers

Why my particle system is rendering behind a standard 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