Jump to content
  • Advertisement
Sign in to follow this  
keyofrassilon

Understanding masking...

This topic is 4832 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

I need to know if it is possible to blend a mask texture with an object... If I use a gradient sphere as a mask and apply a lit sphere on top should I have what appears to be a lit gradient? example: enable texturing disable lighting Bind mask glDisable(GL_ALPHA_TEST); glEnable(GL_BLEND); glBlendFunc(GL_DST_COLOR, GL_ZERO); Draw Mask disable texturing enable lighting glDisable(GL_ALPHA_TEST); glEnable(GL_BLEND); glBlendFunc(GL_ONE, GL_ONE); Draw untextured lit sphere If not it could explain why I get a solid sphere instead of the mask lit by the blending of the sphere with the mask... Basically I want only the mask to show with the lighting of the sphere...No portion of the sphere should lie outside of the mask...

Share this post


Link to post
Share on other sites
Advertisement
AN alternate explanation of what I am trying to do in a sense is I want to use an object as an alpha map and another object as the color map...Consider it a 3d RGBA....Like in a 32 bit Targa image anything in white is drawn to the buffer and anything black is not and anything grey is transparent...

Share this post


Link to post
Share on other sites
Well after consistant tries in various combinations I have come to the conclusion this is not possible...so if anyone else has had a similar problem...there is your answer...It cannot be done unless you use two textures in ortho mode...

Share this post


Link to post
Share on other sites
what u want to do is certainly possible, trouble is i cant understand exactly what u want show images of the 2 textures/objects and how u want the final image to look like

Share this post


Link to post
Share on other sites
Well in basic terms I want to render a planets atmosphere using a gradient ring as a mask and a lit sphere as the color map...A gradient ring is a circle thats very blurred and a lit sphere is a 3d object with light on one side...When I mean color map I mean that I want the mask to look like the lit sphere but inside the mask..same color...same side lit...The rest is cut away and tossed into the peverbial trash can!


I want to combine this:

With this:

to get whats around the main body of saturn...and its not the rings...

Share this post


Link to post
Share on other sites
I'm a little confused. Can't you just do simple lighting to achieve the effect? If you supply vertex normals, it won't look as much like a golfball (if that's what you're worried about) like surface normal lighting does, and you can always increase the resolution for either method to alleviate the effect as well.

Perhaps I don't understand what you're trying to do, but basically what masking does is it allows you to specify a map to blend parts of a shape in ways you specify. I suppose it is possible to do what you're looking to do, but I can't imagine why you would chose to do it that way over just lighting the sphere.

Good luck!

Share this post


Link to post
Share on other sites
u want an halo effect to simulate the atmosphere
youre using the wrong texture u want something like
http://uk.geocities.com/sloppyturds/stuff/halo.jpg
with blending GL_SRC_COLOR .... (DST_COLOR, or GL_ONE) experiment

Quote:
I give up....

fair enuf, programming is difficult, if its not for u its not for you

Share this post


Link to post
Share on other sites
Quote:

to get whats around the main body of saturn...and its not the rings...


Oooh, I totally misread that. I thought that said you wanted the main body, I guess I missed the "what's around" part.

I'm not sure it will work. It sounds good, but typically you bind a mask map to an object's geometry, don't you? I'll be honest I've never implemented it, but that's the way I understand it.

Unless of course you're talking about masking a giant quad with just the halo effect on it, binding it to the planet and making it bilboard and failing the depth test compared to the planet? That could work. A normal map might even make the effect look better.

Is this what you were talking about? If not, I hope it helps!

Good luck! Whether or not you're still with us [wink]

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!