Jump to content
  • Advertisement
Sign in to follow this  
MoonDemon

1D texture to fade a scene

This topic is 3080 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

With reference to this old thread http://www.gamedev.net/community/forums/topic.asp?topic_id=556895 I figured that the first test would be to see if I could shade a scene based on the depth value, so rather than playing with alpha values, I have created a 1D texture and I am attempting to texture my scene so that the greater the z distance, the lighter the colour. My 1d texture is effectively a gradient. However, I can't seem to make this work. function BeginDraw() gl.Clear( gl.COLOR_BUFFER_BIT ) gl.Clear( gl.DEPTH_BUFFER_BIT ) gl.LoadIdentity() -- Test multitexturing gl.TexParameter(gl.TEXTURE_1D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE) gl.Enable(gl.TEXTURE_GEN_S) gl.TexGen(gl.S, gl.TEXTURE_GEN_MODE, gl.EYE_LINEAR) gl.TexGen(gl.S, gl.EYE_PLANE, 0.0, 0.0, -1/75, 0.0 ) gl.Enable(gl.TEXTURE_2D) gl.BindTexture(gl.TEXTURE_1D, textureArray["FogTexture"]) end ( I am using a LUA binding ). The s coordinate is still being generated from the x coordinate, not the z coordinate, so I get a split screen effect with the start colour taking up most of the left and the end colour taking up most of the right. Any ideas why it's not being generated from the z coordinate?

Share this post


Link to post
Share on other sites
Advertisement
Ah. Turned out to be a lua issue :$ This code does seem to work fine in case someone else is looking to use it. Hopefully I will be able to create this fade to sky box effect using multitexturing. I will post an update if I manage to get this working.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!