Transparent textured box doesnt seem to darken with the DirectionalLight

I have put texture on a simple box with transparency AlphaState. The texture is correct, but the texture on the side of the boxes doesn't get dark when the light go dark. What should I do to make the transparent textured box shade with the lights? (The box when yet untextured does get dark, so it is related to adding texture!) Anyone with a solution?



Thanks!

I've found the problem and solved it. Texture was not set to combine, only replace. Doing so solved the lighting problem, but it didn't look good. So now as a final solution I've set a solidcolor to the Quad and combine it with the texture. The solid color is changed with the lightpower of the environment light, from black to white depending on it. And so it looks good from all sides.



t1.setApply(Texture.AM_MODULATE);

t1.setCombineFuncRGB(Texture.ACF_MODULATE);

t1.setCombineSrc0RGB(Texture.ACS_TEXTURE);

t1.setCombineOp0RGB(Texture.ACO_SRC_COLOR);

t1.setCombineSrc1RGB(Texture.ACS_PRIMARY_COLOR);

t1.setCombineOp1RGB(Texture.ACO_SRC_COLOR);

t1.setCombineScaleRGB(1.0f);

quad.setRenderState(ts==null?default_ts:ts);

quad.setRenderState(as);

quad.setLightCombineMode(LightState.OFF);

quad.setSolidColor(new ColorRGBA(1,1,1,1));





And the color:



q.setSolidColor(new ColorRGBA(vTotal+0.2f,vTotal+0.2f,vTotal+0.2f,1));



// set fog state color to the light power !

fs.setColor(new ColorRGBA(vTotal/2f,vTotal/2f,vTotal/2f,1));



The result screenshots are here (sun light and dark night  :D)



jClassicRPG - Developer Blog: Night darkening

Very nice looking.  :slight_smile:

renanse said:

Very nice looking.  :)


Thanks! :)

.. i have now problems with billboarding the grass wit setLocalRotation... :S I will try to solve this, but billboardNode desnt help me now with the shared nodes and quads... it doesnt want to work and align with the screen!

t1.setApply(Texture.AM_MODULATE);
            t1.setCombineFuncRGB(Texture.ACF_MODULATE);
            t1.setCombineSrc0RGB(Texture.ACS_TEXTURE);
            t1.setCombineOp0RGB(Texture.ACO_SRC_COLOR);
            t1.setCombineSrc1RGB(Texture.ACS_PRIMARY_COLOR);
            t1.setCombineOp1RGB(Texture.ACO_SRC_COLOR);
            t1.setCombineScaleRGB(1.0f);           


This won't work. In order to use the combine properties, you need to use the combine apply modifier. Replace setApply(Texture.AM_MODULATE) with setApply(Texture.AM_COMBINE). However, The AM_MODULATE apply modifier already does what you want to do with the combine modes.