Jump to content

Moon shader


Go to solution Solved by Saiaku,

Recommended Posts

Posted

I've been trying to make a grey moon that moves over the sky, but whatever I do with my shader, or if I use a jpg with black background or transparent background on png, the moon itself seems to be halfway transparent as well.

 

Does anyone know the correct flags for such a shader?

 

Thanks ^^

Posted

It looks like this now

textures/a_afl_grand_skies/grand_skyobj_moon1
{
	surfaceparm	noimpact
	surfaceparm	nomarks
	surfaceparm	nonsolid
	surfaceparm	trans
	q3map_nolightmap
	q3map_novertexshadows
    {
        map textures/a_afl_grand_skies/grand_skyobj_moon1a
        blendFunc GL_ONE GL_ONE
        glow
        rgbGen wave square 0 1 0 0.0007
        tcMod scroll 0 0.0014
    }
}

The texture grand_skyobj_moon1 is just a black stripe with an arrow showing the orientation in the editor.

The texture grand_skyobj_moon1a is black with the moon on it, which is gray.

I've tried the same setup with a transparent background for the moon texture, without luck.

  • Solution
Posted

Fear not, I was able to solve it.

Just looking into the base shaders for some similar cases, and I found what I was looking for.

 

Here's the shader I ended up with.

textures/a_afl_grand_skies/grand_skyobj_moon1
{
	surfaceparm	noimpact
	surfaceparm	nomarks
	surfaceparm	nonsolid
	surfaceparm	trans
	q3map_nolightmap
	q3map_novertexshadows
    {
        map textures/a_afl_grand_skies/grand_skyobj_moon1b
        alphaFunc GE192
        blendFunc GL_ONE GL_ZERO
        glow
        rgbGen wave square 0 1 0 0.0007
        alphaGen wave square 0 1 0 0.0007
        tcMod scroll 0 0.0014
    }
}

rgbGen and alphaGen is used for hiding the moon during daytime in my map.

 

Result:

https://jkhub.org/images/4Bs814C.jpg

https://jkhub.org/images/vQ0ryTz.jpg

 

Thanks for reading.

NumberWan likes this
Posted

Wow it's a magic sky! :o

Yep, it's very magic!

Actually it is a part of a new map for the clan.

The map features a day & night cycle, lasting 24 minutes, going from day to night, clouds moving, sun and moon going around, too.

Asgarath83 and Boothand like this
Posted

Thx. I have another box wrapped inside the portal skybox with the night sky. The shader fades in and out in sync with the moon and sun moving over the sky.

Posted

I tried adding some kind of "flare" effect to the sun, so it doesn't look so lonely kind of.

It's all just scrolling shaders really.

Posted

They are not light-emitting.

I don't think it would affect the world anyway.

I believe light from such shaders are calculated in the BSP and not real-time.

  • 4 weeks later...
Posted

I remember, that one guy wanted to create a mod for Episodes I-III strictly about Anakin. One particular mission - on Coruscant - would include the change of day and night. Unfortunately he stopped working on his project long ago.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...