mohamed.irshad.k Posted October 18, 2012 Share Posted October 18, 2012 I have a WidgetSprite with 2 layers. Layer 0 has normal RGB texture which acts as the minimap and layer1 has R8 texture which acts as the fog of war. The layer 1 blending function is set to Src = GUI_BLEND_ZERO and Dst = GUI_BLEND_SRC_COLOR. The blending works as expected in Directx9 renderer but in OpenGL it is giving a reddish shade. Below is the sample code to reproduce: Gui gui; WidgetSprite sprite; int init() { gui = engine.getGui(); sprite = new WidgetSprite( gui ); sprite.addLayer(); sprite.setLayerTexture( 0, "window_01.png" ); sprite.setLayerTexture( 1, "FoW.tga" ); sprite.setLayerBlendFunc( 1, GUI_BLEND_ZERO, GUI_BLEND_SRC_COLOR ); gui.addChild( sprite, GUI_ALIGN_OVERLAP ); return 1; } int shutdown() { return 1; } int update() { return 1; } PS: I couldn't attach the R8 texture file which is in TGA format. Link to comment
frustum Posted October 18, 2012 Share Posted October 18, 2012 Please convert R8 texture into the RGB8 format. R8 texture fetches as R,0,0,255 under OpenGL and Direct3D11. Link to comment
mohamed.irshad.k Posted October 19, 2012 Author Share Posted October 19, 2012 Thanks frustum. Your suggestion is working on D3D9 and OpenGL as expected. Link to comment
ashwin.sudhir Posted October 23, 2012 Share Posted October 23, 2012 @frustum - this particular texture which used to be R8 is updated quite frequently (it encodes the Fog of War data for our game). We had made this R8 to save on bandwidth, esp. on older GPUs. Now that it's RGB8 it would probably take thrice the bandwidth, causing a stutter. Is there any optimization that you'd suggest? Alternatively, does Unigine support some true L8 image type which can be used as low-bandwidth grayscale? Thanks! Link to comment
manguste Posted November 6, 2012 Share Posted November 6, 2012 Ashwin, RGB is just a trifle more expensive. But if it will become a bottleneck in your game, you can create a custom shader that replicates R channel data into G and B. Link to comment
ashwin.sudhir Posted November 8, 2012 Share Posted November 8, 2012 That sounds feasible...thanks Manguste! Link to comment
Recommended Posts