Sky not being rendered through transparent object

Ok, I’m trying to render the sky through the transparency of an object, but its not really working out, even though I’ve set the RenderQueue to transparent.



This is how it looks in-game:

http://farm8.staticflickr.com/7045/6899656179_16092f6a04.jpg



And this is the code I have for rendering the sky:

[snippet id=“26”]



And this loads my model (this happens after loading the sky):

[snippet id=“27”]



Oh, and for those of you who can’t read dutch, “lucht” means sky, and “niewModel” means newModel



So if anyone could tell me why it is still not rendering the sky, then I would be very grateful.



Thanks in advance!

Are you using the correct blend mode?

Alpha means that the shader will use the alpha channel of the texture.

If your transparent areas are black in your texture you have to set the blend mode to Additive

Hmm, I’ve tried setting it to additive but to no result… Well, actually there is a result but the parts that should not be transparent of the image suddently become transparent… Here is what I mean:

http://farm8.staticflickr.com/7049/6902163929_40716a67b3.jpg



Eh, here is one of my textures with an alpha channel in it:

http://farm8.staticflickr.com/7209/6902164123_a3ed20d8a3.jpg



(I don’t know if the transparency works with the image host I use, but the black areas are supposed to be transparent)

Generally JPGs do not have alpha. Some software fakes it, I guess by messing with other channels. Use PNGs instead?

Or is it the image host turning them to jpg? If so, then use a different image host like imgur.com that won’t mess up the images.

I think the image host is turning them to jpg, because they are png originally. Here is the image from imgur.com:

http://i.imgur.com/4YcI9.png



Oh, and please reply quickly as I have a deadline for this project which is tomorrow morning so yeah… else I’m going to have to just let the blackness in the tower stay there but it looks kind of ugly…

Thanks in advance

Try turning on the alpha threshold stuff in the Material’s additional render state:



http://hub.jmonkeyengine.org/javadoc/com/jme3/material/RenderState.html#setAlphaFallOff(float)

http://hub.jmonkeyengine.org/javadoc/com/jme3/material/RenderState.html#setAlphaTest(boolean)

Try Bucket.translucent?

Hmm, that doesn’t work either… Its a real strange problem

Already tried bucket.translucent, and it doesn’t work… Please help, I have little time left!



Here is my full source:

[snippet id=“28”]

For your model add:

mat.getAdditionalRenderState().setAlphaTest(true);

mat.getAdditionalRenderState().setAlphaFallOff(0.5f);



If that doesn’t fix your problem or at least change it then it has nothing to do with alpha.

@pspeed



You are the best! It works! Finally, thank you very much! And also thanks to all the others who helped!