I am currently taking a video game design course. We have free range on what type of game to make, language to use, genre, etc. My group and I have decided to make a 3d java game.
Some of you might be familiar with the book “Ender’s Game”. We are going to be making a game based loosely on that material.
I would like to have a spacestation arena in earth-orbit. The hull of the station would be constructed out of some sort of metal framing with “glass” as the main surface. I will be using a skybox that has space backgrounds, so I want the stars and Earth to show through these glass surfaces.
My question is how do I create a surface that has both a RGB texture (so that the framing can be seen) and an alpha texture to allow the skybox to show through?
Here are some screenshots of what I’ve been able to do so far…
Here are the textures I want to apply.
RGB:
Alpha:
I can sort of do one or the other. When I say sort of, I mean that when I set up only the alpha map, the objects in the scene blend with one another, but the image on the skybox will not show through the textures.
typically I do this by having the rgb and aplha info all in one image and then using an alphastate. If you dig around with that and get no results let me know and I’ll look into some code for ya. There’s probably a way to do what you are saying (2 seperate image method) using stencils or something like that, but I don’t know it.
It seems that unless the alpha channel is exactly 0 on my “station” texture, none of the background (skybox) will show through. I’ve tried converting the images used in the skybox to PNGs as well, but that did not help.
I’m using the same AlphaState and ZBufferState for both my model and skybox. I have added the model to the rootnode before the skybox (although I have tried the opposite as well).
Do I need to set up something with the blending function for the textures (or textureStates) for either (or both) the model and skybox?
Here is a pic of the behavior. Notice you can see the station through the spot top spot, but not the skybox:
Here is the relevent code for the model and skybox:
Yes. I have experimented with numerous permutations, but none have yeilded the desired result. I must be missing something fundamental here, but I do not understand how the textures of the station will show through the transparency, but the texture of the skybox will not.
// And attach the skybox as a child
attachChild(skyboxQuads[i]);
}
I am assuming that something to do with this texture combine mode or light combine mode is causing the behavior.
If I make a new quad and apply my same earth texture without messing with these flags, I get the correct results (note: the lighting is not correct in this picture, but I was able to correct that as well):
What do I need to disable in the skyBox code to get back to what a default quad would have? Thanks.
The default setting is INHERIT, but if it were those flags then you would have to have multitexturing or lighting on the skybox itself, which is not what is happening. Actually, that code was written before we had the OFF mode which is what it is emulating for LightState.
Something else is causing the issue, like the renderqueue usage as Mojo was mentioning. Just making a quad and throwing it in is not a valid test because you are sticking it in a different place in the scenegraph and their are other factors going on as well.