Jump to content

Moon shader


Go to solution Solved by Saiaku,

Recommended Posts

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 ^^

Link to comment

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.

Link to comment
  • Solution

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
Link to comment
  • 4 weeks later...

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...