Skydome for unity3D 3.x

Got it. Will test it tomorrow, thanks!

Oh I almost forgot:

Make sure the texture you use as curveTexture is set to “clamp” or else you will get some weird results when the sun dips below the horizon.

Thanks again to PixelStudio for this awesome script/shader. Now all we need is astronomically accurate lunar cycles :wink:

@PixelStudio Antitheory - Gave the packages a try on my Macbook Pro. Works perfectly and I love the colors! I’ll give it a spin on my windows machine tomorrow, but just couldn’t wait to give it a try. Thank you both very much!

can you guys post a webplayer for us unity basic users?

Hey no problem. The thanks should really go to PixelStudio, I’m just a nitpicker. Usually game designers go overboard with color saturation but I felt this was the one case where we needed more of it. It’s strange that the physically accurate models PixelStudio used to compute the vertex colors weren’t cutting it.

Anyhow I have another thing you might like. change this line 198 in the shader to…

color+= tint*cloud_color.a*(intensity)*float4(Saturate(g_vSunColor,0,1.5,1,0,0),1);

Now you have nice orangey-purple clouds at sunset :slight_smile: You’ll probably want to turn the “tint” up a bit in the inspector.

Oh, and make sure you check “Generate Alpha from Greyscale” for whatever clouds texture you are using. I wasn’t getting any stars until I checked this off. As soon as I looked at the code for the clouds it became pretty obvious.

Its not a complete cloud lighting solution, because really the clouds should be darker “on top”… But seeing as how they are a flat texture they don’t really have a “top”.

I am using Unity Basic and it works fine here. Have you tried the package?

Oh I just realized that “saturate” is a built-in function in Cg. I guess I shouldn’t have named my method “Saturate”… bad practice

hmmm… It did not seam very organized… I could not find out how to get it to work I guess…

You need to drag the camera light to the respective slots in the inspector. Basically follow the error messages that appear when you launch it. Easy-peasy.

I am able to get everything into unity and see it and it works perfectly fine, however the sun does not rotate or orbit at all… Is there something I need to setup to make it do this?? I have all of the objects setup int eh skydome script, and have the radius set correctly, but it still won’t rotate for some reason… Is there something that I am forgetting to do??? Any help would be great, Thanks! :slight_smile:

There must be a typo because that throws a bunch of errors. Line 198 is this one: “color+=(g_vSunColor.z+tint)cloud_color.z(intensity)*cloud_color;”

I’m running it on Unity Pro and so far only on my Mac. Haven’t had a chance to test it on my PC yet.

Yeah there is a typo sorry… somehow a space got thrown in the middle of the variable g_vSunColor. Here is the correct line:

color+= tint*cloud_color.a*(intensity)*float4(Saturate(g_vSunColor,0,1.5,1,0,0),1);

Are you getting any errors? Most likely you have forgotten to set the Skydome parameter in the Sun inspector. Check your Sun gameobject and make sure you have it setup. You will also want to set the “Dome radius” variable in there too, set it to (you guessed it) the radius of the skydome.

BTW:
The sun doesn’t automatically rotate, but you can set the position based on the time, calendar date, and longitude/latitude. You could write a fairly simple script that increments the “time” if you want the sun to animate. Additionally you could keep the position geographically accurate if you change the longitude/latitude variables as you move around… however you would have to be moving pretty damn fast (useful for a flying game, for example).

That fixed it, thanks!

Beautiful work … thanks so much for this!!

Great work people,

Love the better color controls! special thanks to Antitheory!
i adjusted the script and put the sun stuff inside the skydome class, think i like it better this way.

think tomorrow i add stuff to caculate a right julian day.

All the stuff is here: Pixelstudio (Martijn Dekker) · GitHub

post screenshot and settings if you have a nice setup!

i also was trying to implement other clouds, with a particle system and billboards to simulate them…

Great Stuff!!! No doubt! But the online storage looks a bit messy xD
would you please make a new updated package? so i don’t need to download the asset folder with all the files in it spearatly, cause the inclued package is from 13. dez., which is compared to the asset folder outdated.

xD BIG THNX!!!

Skydome is an absolutly nesessary feature unity was missing!!!

can you make a tutorial for us noobs? I can’t get it to look right in unity :frowning:

Wellll, you’ll need all the stuff inside the skydome folder exclusive the old shader.

Then just create a sphere, put the shader on it and put the script on it.
Apply settings and press play…

a little short :wink:

I made all the cameras lights and other objects needed and still got some errors and it did not look right.

Could you maybe include in the unity package a scene with all the variables set right?

thanks

Here is a unity package with a few changes to it that I made.

Changes:

-Made the Star Texture Work
-Added a separate script to control a basic Time Cycle

I’m still new to Unity and still learning the scripting so my Time Cycle script may be inefficient and / or have bugs and I’m not sure how accurate it is (it lets you input how long you want a game day to last in real minutes, and I’m not sure how accurate my equation for this is…). Here is the link:

http://dl.dropbox.com/u/16295628/SkydomeUpdated.unitypackage

Edit: Oops, just realized that I left some unnecessary stuff in the package. I’ll re-package it and re-upload it real quick…

Edit 2: Okay, package re-uploaded.

Edit 3: There is one problem however, and I’m not sure how to fix it… The problem is that once the sun sets, the color of the light remains the red-orange color that it was when the sun set, even after the sun is completely gone… This means that on tall mountains and such, there is still an orange glow even after the sun has gone down… I’m not sure how to fix this, but if someone more knowledgeable could take a look at it, that would be awesome!

~~Tofugames