W810 compositing mode alpha bug

 FW: http://developer.sonyericsson.com/thread.jspa?threadID=39278&tstart=0

boinged

Posts: 96
Registered: 4/1/04
 W810 compositing mode alpha bug
Posted: Apr 18, 2007 4:43 AM
 
 Click to reply to this thread Reply

I've just experienced a very strange issue on this device where ALPHA and MODULATE compositing mode blendings are reverting to REPLACE when another compositing mode is used with the REPLACE mode.

Here's a test summary.

I have a simple quad mesh with a 24-alpha texture applied to it. The texture is loaded as an Image to get around the Loader bug.
midpImg = Image.createImage("/tex.png");
image2d = new Image2D(Image2D.RGBA, midpImg);
texture = new Texture2D(image2d);
texture.setBlending(Texture2D.FUNC_REPLACE);
compositingMode.setBlending(CompositingMode.ALPHA);


Another similar mesh has a non-transparent texture, loaded exactly the same way, the only difference being:
compositingMode2.setBlending(CompositingMode.REPLACE);


1) When I draw just the alpha mesh, it looks as expected - with the background showing through the transparent parts of the texture.

2) When I draw the solid mesh before the alpha mesh, the transparent parts become black which is the transparent colour value. The background colour is different - so it's not the background I'm seeing.

3) When I now stop drawing the solid mesh, the alpha mesh is still drawn non-transparent.

Even creating the transparent mesh on the fly during each render frame results in the same issue.

As a further test I changed the first mesh to use CompositingMode.MODULATE, to try and pin down the issue. The same problem occurs - 1) it's ok, 2) it reverts to REPLACE, 3) it gets permanently stuck in REPLACE mode.

These tests were done with a background colour clear only. Each compositing mode additionally has:
compositingMode.setDepthTestEnable(false);
compositingMode.setDepthWriteEnable(false);


Setting all compositing modes to use ALPHA blending works but slows the framerate down to an unacceptable level.

Has anyone seen anything like this or thinks they can explain what is going wrong?
Are there any workarounds besides my one?

SonyEricsson: I've not tried any other Java Platform 5 devices but is it a known issue of these?

bjourne

Posts: 8
Registered: 3/6/07
 Re: W810 compositing mode alpha bug
Posted: Jun 15, 2007 6:25 AM   in response to: boinged
 
 Click to reply to this thread Reply

I'm not able to reproduce your problem. Does it make any difference what textures you are using or how you load them? Could you post a full code example, that demonstrates the bug?

boinged

Posts: 96
Registered: 4/1/04
 Re: W810 compositing mode alpha bug
Posted: Jun 15, 2007 1:39 PM   in response to: bjourne
 
 Click to reply to this thread Reply

I'll see if I can put some test code together. This kind of test app is starting to look useful with the amount of weird bugs I get :) I suspect there are underlying bugs in the device's software renderer that only become apparent when you have certain combinations of textures/appearances/compositing modes/polygon modes etc.

The textures are indexed but I also have an RGBA image for a different texture and this has the same problem. They're not being loaded with Loader.load().

It's very strange: W710, K800 are fine. K610, W810 are broken.

boinged

Posts: 96
Registered: 4/1/04
 Re: W810 compositing mode alpha bug
Posted: Jun 19, 2007 12:28 PM   in response to: boinged
 
 Click to reply to this thread Reply

I've managed to solve this but there seems to be a bug with this firmware (R1AA049) as I don't need the workaround for a different K610 device I tried.

In my sample code I paint a quad with an opaque texture, then one with a transparent texture.

If depth writing is turned off for the opaque quad then the 2nd quad doesn't appear transparent unless FUNC_MODULATE is used for the blending mode

This is irrespective of whether a depth buffer is even used!

Can anyone explain why this would happen? Maybe then I can find a better workaround because I'd rather not use modulate unless I have to.

	private static final void initTest1()
{
try
{
CompositingMode solidCompositing = new CompositingMode();
solidCompositing.setBlending(CompositingMode.REPLACE);
solidCompositing.setColorWriteEnable(true);
solidCompositing.setAlphaWriteEnable(false);
solidCompositing.setDepthTestEnable(false);
// solidCompositing.setDepthWriteEnable(false);

CompositingMode transparentCompositing = new CompositingMode();
transparentCompositing.setBlending(CompositingMode.ALPHA);
transparentCompositing.setColorWriteEnable(true);
transparentCompositing.setAlphaWriteEnable(false);
transparentCompositing.setDepthTestEnable(false);
// transparentCompositing.setDepthWriteEnable(false);

Texture2D solidTexture = null, transparentTexture = null;
Appearance solidAppearance = new Appearance(), transparentAppearance = new Appearance();

solidTexture = loadTexture("solid", Texture2D.FUNC_REPLACE);
solidAppearance.setTexture(0, solidTexture);
solidAppearance.setCompositingMode(solidCompositing);
solidMesh = createQuad(solidAppearance, 100, 100);

transparentTexture = loadTexture("transparent", Texture2D.FUNC_REPLACE);
transparentAppearance.setTexture(0, transparentTexture);
transparentAppearance.setCompositingMode(transparentCompositing);
transparentMesh = createQuad(transparentAppearance, 50, 50);
}
catch(Exception e)
{
e.printStackTrace();
}

bg.setDepthClearEnable(false);
bg.setColorClearEnable(false);
}

private static final Texture2D loadTexture(String filename, int mode)
{
Texture2D tex = null;

try
{
tex = new Texture2D(new Image2D(Image2D.RGBA, Image.createImage("/"+filename+".png")));
tex.setBlending(mode);
}
catch(Exception e)
{
e.printStackTrace();
}

return tex;
}
public void paint(Graphics g)
{
g.setColor(0xff0000);
g.fillRect(0, 0, getWidth(), getHeight());

try
{
g3d.bindTarget(g);
g3d.clear(bg);
g3d.render(solidMesh, null);
g3d.render(transparentMesh, null);
}
catch(Exception e)
{
e.printStackTrace();
}
finally
{
g3d.releaseTarget();
}
}


【无人机】基于改进粒子群算法的无人机路径规划研究[和遗传算法、粒子群算法进行比较](Matlab代码实现)内容概要:本文围绕基于改进粒子群算法的无人机路径规划展开研究,重点探讨了在复杂环境中利用改进粒子群算法(PSO)实现无人机三维路径规划的方法,并将其与遗传算法(GA)、标准粒子群算法等传统优化算法进行对比分析。研究内容涵盖路径规划的多目标优化、避障策略、航路点约束以及算法收敛性和寻优能力的评估,所有实验均通过Matlab代码实现,提供了完整的仿真验证流程。文章还提到了多种智能优化算法在无人机路径规划中的应用比较,突出了改进PSO在收敛速度和全局寻优方面的优势。; 适合人群:具备一定Matlab编程基础和优化算法知识的研究生、科研人员及从事无人机路径规划、智能优化算法研究的相关技术人员。; 使用场景及目标:①用于无人机在复杂地形或动态环境下的三维路径规划仿真研究;②比较不同智能优化算法(如PSO、GA、蚁群算法、RRT等)在路径规划中的性能差异;③为多目标优化问题提供算法选型和改进思路。; 阅读建议:建议读者结合文中提供的Matlab代码进行实践操作,重点关注算法的参数设置、适应度函数设计及路径约束处理方式,同时可参考文中提到的多种算法对比思路,拓展到其他智能优化算法的研究与改进中。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值