Sun Shader

First let me start by saying that I know this is not the best way of doing things.

Second, I’m on a very tight deadline, I’m trying to create a 3D model for our Sun, I have tried everything with the current shaders that ship with unity but nothing works, I realize that this is a very lame request, but can someone help me out? I’m going for the lava / solar flames look.

Have you tried the self-illum shaders? You might want to use Particles/Additive for the flares, and a camera-facing billboard with an additive shader for the corona.

how we could do that? i tried the self-illum shader but didn’t get the look that i want… it look like a light ball … what we need is lava looking surface for the sun …

What do you mean by lava looking? If you want an animated texture, you can either provide your own and use MovieTexture, or you’ll have to write a shader that does what you want.

Hi Daniel,

The problem is we’re not too good with Shaders, we tried adding an animated texture through a movie but its taking a lot of CPU power, so I was wondering if there are any shaders for unity3D that simulate the sun like shaders for Ogre, Panda and XNA, if you could explain your first reply in a simpler way I would really appreciate it.

Use the particle system. I created this in my first 30 minutes of using Unity. Very low quality but if you actually spent an hour on it im sure you could get a pretty realistic looking sun. And the sun would also look alive aswell since the particles are animated.

Unfortunately, I don’t know of any shaders that do what you want out-of-the-box. If you have source code for one of those shaders, someone might be able to port it to Cg for use with Unity.

I was just listing built-in shaders that might be able to achieve the effects you want. You obviously want something opaque but self-illuminated for the main ball (possibly Self-Illum/VertexLit), and something transparent but bright (Particles/Additive, Particles/Additive (Soft) or Particles/Alpha Blended) for the corona and flares. The corona, rather than being a set of spheres or some other complicated solution, could be a single square that faces the camera all the time.

You’d have to model the flares yourself, but you might get a decent effect by UV mapping them such that you can change the texture offset and animate a flare image moving around a single strip of triangles, going out of and back into the surface.